Bug 1442006 - WIP - Proof of concept for introducing XPCOMUtils and Services globals into chromeGlobals and out of browser.js draft
authorBrian Grinstead <bgrinstead@mozilla.com>
Thu, 01 Mar 2018 08:55:55 -0800
changeset 761898 5fe26c17ef70158791b8c9e2318ef91140f275b3
parent 761897 b95f31a1ba9f7b89a27d8be9108329f49430a991
push id101035
push userbgrinstead@mozilla.com
push dateThu, 01 Mar 2018 16:56:03 +0000
bugs1442006
milestone60.0a1
Bug 1442006 - WIP - Proof of concept for introducing XPCOMUtils and Services globals into chromeGlobals and out of browser.js This is just removing the reference from a single script - if we like this approach we'd want to remove it from all window scripts in tree as well MozReview-Commit-ID: BcZroeOJbVR
browser/base/content/browser.js
toolkit/content/chromeGlobals.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1,17 +1,15 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
  * 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/. */
 
 /* eslint-env mozilla/browser-window */
 
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 ChromeUtils.import("resource://gre/modules/NotificationDB.jsm");
 
 const {WebExtensionPolicy} = Cu.getGlobalForObject(Services);
 
 // lazy module getters
 
 XPCOMUtils.defineLazyModuleGetters(this, {
--- a/toolkit/content/chromeGlobals.js
+++ b/toolkit/content/chromeGlobals.js
@@ -1,12 +1,15 @@
 /* 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/. */
 
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+
 function closeWindow(aClose, aPromptFunction) {
   let { AppConstants } = ChromeUtils.import("resource://gre/modules/AppConstants.jsm", {});
 
   // Closing the last window doesn't quit the application on OS X.
   if (AppConstants.platform != "macosx") {
     var windowCount = 0;
     var e = Services.wm.getEnumerator(null);