Bug 1445764 - Remove redundant Places imports from pages that load browser.js;r=Standard8 draft
authorBrian Grinstead <bgrinstead@mozilla.com>
Tue, 03 Jul 2018 14:26:51 -0700
changeset 813782 ff283c5ec16470585985c3a8c9389ea79ff08c12
parent 813781 3da36fddc0fe6d6fbc03474e557ff206875cae0d
child 813783 137d613c8729d40e45a1295b981d54889f434d96
push id115004
push userbgrinstead@mozilla.com
push dateTue, 03 Jul 2018 21:27:14 +0000
reviewersStandard8
bugs1445764
milestone63.0a1
Bug 1445764 - Remove redundant Places imports from pages that load browser.js;r=Standard8 MozReview-Commit-ID: JsPiKMA21Fj
browser/base/content/browser.js
browser/base/content/browser.xul
browser/base/content/macWindow.inc.xul
browser/base/content/webext-panels.xul
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -36,16 +36,19 @@ XPCOMUtils.defineLazyModuleGetters(this,
   LoginManagerParent: "resource://gre/modules/LoginManagerParent.jsm",
   NetUtil: "resource://gre/modules/NetUtil.jsm",
   NewTabUtils: "resource://gre/modules/NewTabUtils.jsm",
   OpenInTabsUtils: "resource:///modules/OpenInTabsUtils.jsm",
   PageActions: "resource:///modules/PageActions.jsm",
   PageThumbs: "resource://gre/modules/PageThumbs.jsm",
   PanelMultiView: "resource:///modules/PanelMultiView.jsm",
   PanelView: "resource:///modules/PanelMultiView.jsm",
+  PlacesUtils: "resource://gre/modules/PlacesUtils.jsm",
+  PlacesUIUtils: "resource:///modules/PlacesUIUtils.jsm",
+  PlacesTransactions: "resource://gre/modules/PlacesTransactions.jsm",
   PluralForm: "resource://gre/modules/PluralForm.jsm",
   PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
   ProcessHangMonitor: "resource:///modules/ProcessHangMonitor.jsm",
   PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
   ReaderMode: "resource://gre/modules/ReaderMode.jsm",
   ReaderParent: "resource:///modules/ReaderParent.jsm",
   SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
   Sanitizer: "resource:///modules/Sanitizer.jsm",
@@ -68,16 +71,21 @@ XPCOMUtils.defineLazyModuleGetters(this,
   ZoomUI: "resource:///modules/ZoomUI.jsm",
 });
 
 if (AppConstants.MOZ_CRASHREPORTER) {
   ChromeUtils.defineModuleGetter(this, "PluginCrashReporter",
     "resource:///modules/ContentCrashHandlers.jsm");
 }
 
+XPCOMUtils.defineLazyScriptGetter(this, "PlacesTreeView",
+                                  "chrome://browser/content/places/treeView.js");
+XPCOMUtils.defineLazyScriptGetter(this, ["PlacesInsertionPoint", "PlacesController",
+                                         "PlacesControllerDragHelper"],
+                                  "chrome://browser/content/places/controller.js");
 XPCOMUtils.defineLazyScriptGetter(this, "PrintUtils",
                                   "chrome://global/content/printUtils.js");
 XPCOMUtils.defineLazyScriptGetter(this, "ZoomManager",
                                   "chrome://global/content/viewZoomOverlay.js");
 XPCOMUtils.defineLazyScriptGetter(this, "FullZoom",
                                   "chrome://browser/content/browser-fullZoom.js");
 XPCOMUtils.defineLazyScriptGetter(this, "PanelUI",
                                   "chrome://browser/content/customizableui/panelUI.js");
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -65,30 +65,16 @@
 # All JS files which are needed by browser.xul and other top level windows to
 # support MacOS specific features *must* go into the global-scripts.inc file so
 # that they can be shared with macWindow.inc.xul.
 #include global-scripts.inc
 
 <script type="application/javascript">
   Services.scriptloader.loadSubScript("chrome://global/content/contentAreaUtils.js", this);
   Services.scriptloader.loadSubScript("chrome://browser/content/tabbrowser.js", this);
-
-  ChromeUtils.defineModuleGetter(window,
-    "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm");
-  ChromeUtils.defineModuleGetter(window,
-    "PlacesUIUtils", "resource:///modules/PlacesUIUtils.jsm");
-  ChromeUtils.defineModuleGetter(window,
-    "PlacesTransactions", "resource://gre/modules/PlacesTransactions.jsm");
-
-  ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-  XPCOMUtils.defineLazyScriptGetter(window, "PlacesTreeView",
-    "chrome://browser/content/places/treeView.js");
-  XPCOMUtils.defineLazyScriptGetter(window,
-    ["PlacesInsertionPoint", "PlacesController", "PlacesControllerDragHelper"],
-     "chrome://browser/content/places/controller.js");
 </script>
 
 # All sets except for popupsets (commands, keys, stringbundles and broadcasters)
 # *must* go into the browser-sets.inc file so that they can be shared with other
 # top level windows in macWindow.inc.xul.
 #include browser-sets.inc
 
   <popupset id="mainPopupSet">
--- a/browser/base/content/macWindow.inc.xul
+++ b/browser/base/content/macWindow.inc.xul
@@ -25,30 +25,16 @@
       dockSupport.activateApplication(true);
     });
 
     return win;
   }
 
   addEventListener("load",   function() { gBrowserInit.nonBrowserWindowStartup()  }, false);
   addEventListener("unload", function() { gBrowserInit.nonBrowserWindowShutdown() }, false);
-
-  ChromeUtils.defineModuleGetter(window,
-    "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm");
-  ChromeUtils.defineModuleGetter(window,
-    "PlacesUIUtils", "resource:///modules/PlacesUIUtils.jsm");
-  ChromeUtils.defineModuleGetter(window,
-    "PlacesTransactions", "resource://gre/modules/PlacesTransactions.jsm");
-
-  ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-  XPCOMUtils.defineLazyScriptGetter(window, "PlacesTreeView",
-    "chrome://browser/content/places/treeView.js");
-  XPCOMUtils.defineLazyScriptGetter(window,
-    ["PlacesInsertionPoint", "PlacesController", "PlacesControllerDragHelper"],
-     "chrome://browser/content/places/controller.js");
 </script>
 
 # All sets except for popupsets (commands, keys, stringbundles and broadcasters)
 # *must* go into the browser-sets.inc file so that they can be shared with
 # browser.xul
 #include browser-sets.inc
 
 # The entire main menubar is placed into browser-menubar.inc, so that it can be
--- a/browser/base/content/webext-panels.xul
+++ b/browser/base/content/webext-panels.xul
@@ -19,31 +19,16 @@
         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <script type="application/javascript" src="chrome://global/content/contentAreaUtils.js"/>
   <script type="application/javascript" src="chrome://browser/content/browser.js"/>
   <script type="application/javascript" src="chrome://browser/content/browser-places.js"/>
   <script type="application/javascript" src="chrome://browser/content/webext-panels.js"/>
   <script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
   <script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
-  <script type="application/javascript"><![CDATA[
-    ChromeUtils.defineModuleGetter(window,
-      "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm");
-    ChromeUtils.defineModuleGetter(window,
-      "PlacesUIUtils", "resource:///modules/PlacesUIUtils.jsm");
-    ChromeUtils.defineModuleGetter(window,
-      "PlacesTransactions", "resource://gre/modules/PlacesTransactions.jsm");
-
-    ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-    XPCOMUtils.defineLazyScriptGetter(window, "PlacesTreeView",
-      "chrome://browser/content/places/treeView.js");
-    XPCOMUtils.defineLazyScriptGetter(window,
-      ["PlacesInsertionPoint", "PlacesController", "PlacesControllerDragHelper"],
-       "chrome://browser/content/places/controller.js");
-  ]]></script>
 
   <broadcasterset id="mainBroadcasterSet">
     <broadcaster id="isFrameImage"/>
   </broadcasterset>
 
   <commandset id="mainCommandset">
     <command id="Browser:Back"
              oncommand="getPanelBrowser().webNavigation.goBack();"