Bug 1600448 - Follow-up for Bug 1434737. Replace ChromeUtils.import() part 2 in suite. r=IanN a=IanN CLOSED TREE
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Thu, 12 Dec 2019 19:38:21 +0100
changeset 32385 f103e65e5a6e2a02fe1b8b1f3bd9df9d025e6ef8
parent 32384 cf178c975a6a8d5227beb730289f7a5325e657aa
child 32386 f5f430ed547d7364ae44d29e4d9ceb9be04fed33
push id232
push userfrgrahl@gmx.net
push dateThu, 12 Dec 2019 18:52:58 +0000
treeherdercomm-esr60@6f606bccc252 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN, IanN
bugs1600448, 1434737
Bug 1600448 - Follow-up for Bug 1434737. Replace ChromeUtils.import() part 2 in suite. r=IanN a=IanN CLOSED TREE
suite/base/content/utilityOverlay.js
suite/browser/linkToolbarHandler.js
suite/browser/pageinfo/security.js
suite/browser/test/browser/browser_bug409624.js
suite/browser/test/browser/browser_bug413915.js
suite/components/downloads/DownloadsCommon.jsm
suite/components/downloads/DownloadsTaskbar.jsm
suite/components/helpviewer/content/contextHelp.js
suite/components/helpviewer/content/help.js
suite/components/migration/SuiteProfileMigrator.js
suite/components/places/content/controller.js
suite/components/places/content/places.js
suite/components/pref/content/pref-download.js
suite/components/sessionstore/nsSessionStore.js
suite/modules/Feeds.jsm
suite/modules/Sanitizer.jsm
--- a/suite/base/content/utilityOverlay.js
+++ b/suite/base/content/utilityOverlay.js
@@ -3,21 +3,19 @@
  * 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/. */
 
 /**
  * Communicator Shared Utility Library
  * for shared application glue for the Communicator suite of applications
  **/
 
-// Services = object with smart getters for common XPCOM services
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
-
 XPCOMUtils.defineLazyModuleGetters(this, {
   BrowserUtils: "resource://gre/modules/BrowserUtils.jsm",
   PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
   RecentWindow: "resource:///modules/RecentWindow.jsm",
 });
 
 // XPCOMUtils.defineLazyGetter(this, "Weave", function() {
 //   let tmp = {};
--- a/suite/browser/linkToolbarHandler.js
+++ b/suite/browser/linkToolbarHandler.js
@@ -1,14 +1,14 @@
 /* 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/. */
 
-XPCOMUtils.defineLazyModuleGetter(this, "Feeds",
-                                  "resource:///modules/Feeds.jsm");
+ChromeUtils.defineModuleGetter(this, "Feeds",
+  "resource:///modules/Feeds.jsm");
 
 /**
  * LinkToolbarHandler is a Singleton that displays LINK elements
  * and nodeLists of LINK elements in the Link Toolbar.  It
  * associates the LINK with a corresponding LinkToolbarItem based
  * on it's REL attribute and the toolbar item's ID attribute.
  * LinkToolbarHandler is also a Factory and will create
  * LinkToolbarItems as necessary.
--- a/suite/browser/pageinfo/security.js
+++ b/suite/browser/pageinfo/security.js
@@ -1,15 +1,15 @@
 /* -*- Mode: Javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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/. */
 
-XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
-                                  "resource://gre/modules/PluralForm.jsm");
+ChromeUtils.defineModuleGetter(this, "PluralForm",
+  "resource://gre/modules/PluralForm.jsm");
 
 var security = {
   init: function(uri, windowInfo) {
     this.uri = uri;
     this.windowInfo = windowInfo;
   },
 
   // Display the server certificate (static)
--- a/suite/browser/test/browser/browser_bug409624.js
+++ b/suite/browser/test/browser/browser_bug409624.js
@@ -1,13 +1,13 @@
 /* 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.defineModuleGetter(this, "FormHistory",
-                               "resource://gre/modules/FormHistory.jsm");
+  "resource://gre/modules/FormHistory.jsm");
 
 function test() {
   waitForExplicitFinish();
 
   // This test relies on the form history being empty to start with delete
   // all the items first.
   FormHistory.update({ op: "remove" },
                      { handleError: function (error) {
--- a/suite/browser/test/browser/browser_bug413915.js
+++ b/suite/browser/test/browser/browser_bug413915.js
@@ -1,10 +1,10 @@
-XPCOMUtils.defineLazyModuleGetter(this, "Feeds",
-                                  "resource:///modules/Feeds.jsm");
+ChromeUtils.defineModuleGetter(this, "Feeds",
+  "resource:///modules/Feeds.jsm");
 
 function test() {
   var exampleUri = Services.io.newURI("http://example.com/");
   var secman = Cc["@mozilla.org/scriptsecuritymanager;1"]
                  .getService(Ci.nsIScriptSecurityManager);
   var principal = secman.createCodebasePrincipal(exampleUri, {});
 
   function testIsFeed(aTitle, aHref, aType, aKnown) {
--- a/suite/components/downloads/DownloadsCommon.jsm
+++ b/suite/components/downloads/DownloadsCommon.jsm
@@ -36,17 +36,17 @@ XPCOMUtils.defineLazyModuleGetters(this,
   DownloadHistory: "resource://gre/modules/DownloadHistory.jsm",
   Downloads: "resource://gre/modules/Downloads.jsm",
   DownloadUIHelper: "resource://gre/modules/DownloadUIHelper.jsm",
   DownloadUtils: "resource://gre/modules/DownloadUtils.jsm",
   OS: "resource://gre/modules/osfile.jsm",
 });
 
 XPCOMUtils.defineLazyGetter(this, "DownloadsLogger", () => {
-  let { ConsoleAPI } = Cu.import("resource://gre/modules/Console.jsm", {});
+  let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm", {});
   let consoleOptions = {
     maxLogLevelPref: "browser.download.loglevel",
     prefix: "Downloads"
   };
   return new ConsoleAPI(consoleOptions);
 });
 
 const kDownloadsStringBundleUrl =
@@ -180,19 +180,19 @@ var DownloadsCommon = {
     }
     return DownloadsData;
   },
 
   /**
    * Initializes the Downloads Manager common code.
    */
   init() {
-    Cu.import("resource://gre/modules/Downloads.jsm");
-    Cu.import("resource://gre/modules/DownloadIntegration.jsm");
-    DownloadIntegration.shouldPersistDownload = function() { return true; }
+    ChromeUtils.import("resource://gre/modules/Downloads.jsm");
+    ChromeUtils.import("resource://gre/modules/DownloadIntegration.jsm");
+    DownloadIntegration.shouldPersistDownload = function() { return true; };
     DownloadsData.initializeDataLink();
   },
 
   /**
    * Returns the legacy state integer value for the provided Download object.
    */
   stateOfDownload(download) {
     // Collapse state using the correct priority.
--- a/suite/components/downloads/DownloadsTaskbar.jsm
+++ b/suite/components/downloads/DownloadsTaskbar.jsm
@@ -4,21 +4,20 @@
  * 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/. */
 
 var EXPORTED_SYMBOLS = [
   "DownloadsTaskbar",
 ];
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 ChromeUtils.defineModuleGetter(this, "Downloads",
-                               "resource://gre/modules/Downloads.jsm");
-ChromeUtils.defineModuleGetter(this, "Services",
-                               "resource://gre/modules/Services.jsm");
+  "resource://gre/modules/Downloads.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "gWinTaskbar", function() {
   if (!("@mozilla.org/windows-taskbar;1" in Cc)) {
     return null;
   }
   let winTaskbar = Cc["@mozilla.org/windows-taskbar;1"]
                      .getService(Ci.nsIWinTaskbar);
   return winTaskbar.available && winTaskbar;
--- a/suite/components/helpviewer/content/contextHelp.js
+++ b/suite/components/helpviewer/content/contextHelp.js
@@ -1,17 +1,16 @@
 /* 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");
 
-XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
-                                  "resource://gre/modules/AppConstants.jsm");
+ChromeUtils.defineModuleGetter(this, "AppConstants",
+  "resource://gre/modules/AppConstants.jsm");
 
 // Set the default content pack to the Mozilla content pack. Use the
 // setHelpFileURI function to set this value.
 var helpFileURI;
 
 // openHelp - Opens up the Mozilla Help Viewer with the specified
 //    topic and content pack.
 // see http://www.mozilla.org/projects/help-viewer/content_packs.html
--- a/suite/components/helpviewer/content/help.js
+++ b/suite/components/helpviewer/content/help.js
@@ -1,16 +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");
 
-XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
+ChromeUtils.defineModuleGetter(this, "AppConstants",
   "resource://gre/modules/AppConstants.jsm");
 
 // Global Variables
 var helpExternal;
 var helpBrowser;
 var helpSearchPanel;
 var emptySearch;
 var emptySearchText;
--- a/suite/components/migration/SuiteProfileMigrator.js
+++ b/suite/components/migration/SuiteProfileMigrator.js
@@ -3,17 +3,17 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import('resource://gre/modules/AppConstants.jsm');
 
-XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
+ChromeUtils.defineModuleGetter(this, "FileUtils",
   "resource://gre/modules/FileUtils.jsm");
 
 function ProfileMigrator() {
 }
 
 ProfileMigrator.prototype = {
   migrate: function PM_migrate(aStartup) {
     // By opening the wizard with a supplied migrator, it will automatically
--- a/suite/components/places/content/controller.js
+++ b/suite/components/places/content/controller.js
@@ -1,13 +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/. */
 
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+
 /**
  * Represents an insertion point within a container where we can insert
  * items.
  * @param {object} an object containing the following properties:
  *   - parentId
  *     The identifier of the parent container
  *   - parentGuid
  *     The unique identifier of the parent container
--- a/suite/components/places/content/places.js
+++ b/suite/components/places/content/places.js
@@ -2,17 +2,16 @@
 /* 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/. */
 
 /* import-globals-from editBookmarkOverlay.js */
 /* import-globals-from ../../../../../toolkit/content/contentAreaUtils.js */
 
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 ChromeUtils.defineModuleGetter(this, "MigrationUtils",
                                "resource:///modules/MigrationUtils.jsm");
 ChromeUtils.defineModuleGetter(this, "BookmarkJSONUtils",
                                "resource://gre/modules/BookmarkJSONUtils.jsm");
 ChromeUtils.defineModuleGetter(this, "PlacesBackups",
                                "resource://gre/modules/PlacesBackups.jsm");
--- a/suite/components/pref/content/pref-download.js
+++ b/suite/components/pref/content/pref-download.js
@@ -1,19 +1,18 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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/. */
 
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
 
-XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
-                                  "resource://gre/modules/Downloads.jsm");
+ChromeUtils.defineModuleGetter(this, "Downloads",
+  "resource://gre/modules/Downloads.jsm");
 
 const kDesktop = 0;
 const kDownloads = 1;
 const kUserDir = 2;
 var gFPHandler;
 var gSoundUrlPref;
 
 function Startup()
--- a/suite/components/sessionstore/nsSessionStore.js
+++ b/suite/components/sessionstore/nsSessionStore.js
@@ -85,17 +85,17 @@ ChromeUtils.import("resource://gre/modul
 
 XPCOMUtils.defineLazyServiceGetter(this, "SecMan",
   "@mozilla.org/scriptsecuritymanager;1", "nsIScriptSecurityManager");
 XPCOMUtils.defineLazyServiceGetter(this, "gScreenManager",
   "@mozilla.org/gfx/screenmanager;1", "nsIScreenManager");
 XPCOMUtils.defineLazyServiceGetter(this, "uuidGenerator",
   "@mozilla.org/uuid-generator;1", "nsIUUIDGenerator");
 
-XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
+ChromeUtils.defineModuleGetter(this, "AppConstants",
   "resource://gre/modules/AppConstants.jsm");
 ChromeUtils.defineModuleGetter(this, "Utils",
   "resource://gre/modules/sessionstore/Utils.jsm");
 
 function debug(aMsg) {
   Services.console.logStringMessage("SessionStore: " + aMsg);
 }
 
--- a/suite/modules/Feeds.jsm
+++ b/suite/modules/Feeds.jsm
@@ -3,20 +3,18 @@
 /* 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";
 
 var EXPORTED_SYMBOLS = [ "Feeds" ];
 
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
-                                  "resource://gre/modules/BrowserUtils.jsm");
+ChromeUtils.defineModuleGetter(this, "BrowserUtils",
+  "resource://gre/modules/BrowserUtils.jsm");
 
 var Feeds = {
 
   /**
    * isValidFeed: checks whether the given data represents a valid feed.
    *
    * @param  aLink
    *         An object representing a feed with title, href and type.
--- a/suite/modules/Sanitizer.jsm
+++ b/suite/modules/Sanitizer.jsm
@@ -181,18 +181,16 @@ var Sanitizer = {
         } catch (e) {}
       },
 
       canClear: true
     },
 
     history: {
       clear: function() {
-        ChromeUtils.import("resource://gre/modules/PlacesUtils.jsm");
-
         // use try/catch for everything but the last task so we clear as much as possible
         try {
           PlacesUtils.history.clear();
         } catch(ex) {}
 
         try {
           Services.obs.notifyObservers(null, "browser:purge-session-history");
         } catch(ex) {}