Bug 1111142 - (Part 1) Turn aboutReader.js into an AboutReader module. r=mfinkle,bnicholson
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Fri, 19 Dec 2014 13:51:24 -0800
changeset 239209 4118e045b464d00cbaa2634d5d3d7332c6b62e25
parent 239208 1bc77d8c8681293b7baed676753f16e691dc0bd4
child 239210 931fc7ae771e0f7c57fb524e3d7abdccdc450ae6
push id7472
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 20:36:27 +0000
treeherdermozilla-aurora@300ca104f8fb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, bnicholson
bugs1111142
milestone37.0a1
Bug 1111142 - (Part 1) Turn aboutReader.js into an AboutReader module. r=mfinkle,bnicholson
mobile/android/chrome/content/browser.js
toolkit/components/reader/AboutReader.jsm
toolkit/components/reader/content/aboutReader.js
toolkit/components/reader/jar.mn
toolkit/components/reader/moz.build
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -104,27 +104,29 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://gre/modules/PermissionsUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "SharedPreferences",
                                   "resource://gre/modules/SharedPreferences.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "Notifications",
                                   "resource://gre/modules/Notifications.jsm");
 
+XPCOMUtils.defineLazyModuleGetter(this, "AboutReader",
+                                  "resource://gre/modules/AboutReader.jsm");
+
 XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode",
                                   "resource://gre/modules/ReaderMode.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "GMPInstallManager",
                                   "resource://gre/modules/GMPInstallManager.jsm");
 
 // Lazily-loaded browser scripts:
 [
   ["SelectHelper", "chrome://browser/content/SelectHelper.js"],
   ["InputWidgetHelper", "chrome://browser/content/InputWidgetHelper.js"],
-  ["AboutReader", "chrome://global/content/reader/aboutReader.js"],
   ["MasterPassword", "chrome://browser/content/MasterPassword.js"],
   ["PluginHelper", "chrome://browser/content/PluginHelper.js"],
   ["OfflineApps", "chrome://browser/content/OfflineApps.js"],
   ["Linkifier", "chrome://browser/content/Linkify.js"],
   ["ZoomHelper", "chrome://browser/content/ZoomHelper.js"],
   ["CastingApps", "chrome://browser/content/CastingApps.js"],
 #ifdef NIGHTLY_BUILD
   ["WebcompatReporter", "chrome://browser/content/WebcompatReporter.js"],
rename from toolkit/components/reader/content/aboutReader.js
rename to toolkit/components/reader/AboutReader.jsm
--- a/toolkit/components/reader/content/aboutReader.js
+++ b/toolkit/components/reader/AboutReader.jsm
@@ -1,20 +1,25 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+"use strict";
+
 let Ci = Components.interfaces, Cc = Components.classes, Cu = Components.utils;
 
+this.EXPORTED_SYMBOLS = [ "AboutReader" ];
+
 Cu.import("resource://gre/modules/Messaging.jsm");
 Cu.import("resource://gre/modules/Services.jsm")
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
-XPCOMUtils.defineLazyModuleGetter(this, "UITelemetry",
-                                  "resource://gre/modules/UITelemetry.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode", "resource://gre/modules/ReaderMode.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "UITelemetry", "resource://gre/modules/UITelemetry.jsm");
 
 XPCOMUtils.defineLazyGetter(window, "gChromeWin", function ()
   window.QueryInterface(Ci.nsIInterfaceRequestor)
     .getInterface(Ci.nsIWebNavigation)
     .QueryInterface(Ci.nsIDocShellTreeItem)
     .rootTreeItem
     .QueryInterface(Ci.nsIInterfaceRequestor)
     .getInterface(Ci.nsIDOMWindow)
@@ -781,17 +786,17 @@ AboutReader.prototype = {
         dropdownArrow.style.left = arrowLeft + "px";
       };
 
       win.addEventListener("resize", function(aEvent) {
         if (!aEvent.isTrusted)
           return;
 
         // Wait for reflow before calculating the new position of the popup.
-        setTimeout(updatePopupPosition, 0);
+        win.setTimeout(updatePopupPosition, 0);
       }, true);
 
       dropdownToggle.addEventListener("click", function(aEvent) {
         if (!aEvent.isTrusted)
           return;
 
         aEvent.stopPropagation();
 
--- a/toolkit/components/reader/jar.mn
+++ b/toolkit/components/reader/jar.mn
@@ -1,10 +1,9 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 toolkit.jar:
   content/global/reader/aboutReader.html             (content/aboutReader.html)
-  content/global/reader/aboutReader.js               (content/aboutReader.js)
   content/global/reader/Readability.js               (content/Readability.js)
   content/global/reader/JSDOMParser.js               (content/JSDOMParser.js)
   content/global/reader/readerWorker.js              (content/readerWorker.js)
--- a/toolkit/components/reader/moz.build
+++ b/toolkit/components/reader/moz.build
@@ -2,10 +2,11 @@
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 JAR_MANIFESTS += ['jar.mn']
 
 EXTRA_JS_MODULES += [
+  'AboutReader.jsm',
   'ReaderMode.jsm'
 ]