Bug 1434737 - Move to ChromeUtils.import() - Chat part. r=florian
authorPhilipp Kewisch <mozilla@kewis.ch>
Wed, 31 Jan 2018 23:25:50 +0100
changeset 31040 1ac48db6177e9ea975af601c25770fc50db1b6dc
parent 31039 ed473b3278b720c0df927d0b018cb0907d749e81
child 31041 932a8eee8f8ce33bfc5923b3effc51d9cf0e0d3b
push id383
push userclokep@gmail.com
push dateMon, 07 May 2018 21:52:48 +0000
reviewersflorian
bugs1434737
Bug 1434737 - Move to ChromeUtils.import() - Chat part. r=florian MozReview-Commit-ID: 4nli30dK4Lu
chat/components/src/imAccounts.js
chat/components/src/imCommands.js
chat/components/src/imContacts.js
chat/components/src/imConversations.js
chat/components/src/imCore.js
chat/components/src/logger.js
chat/components/src/smileProtocolHandler.js
chat/components/src/test/test_accounts.js
chat/components/src/test/test_commands.js
chat/components/src/test/test_conversations.js
chat/components/src/test/test_logger.js
chat/content/browserRequest.js
chat/content/convbrowser.xml
chat/modules/DNS.jsm
chat/modules/ToLocaleFormat.jsm
chat/modules/hiddenWindow.jsm
chat/modules/imContentSink.jsm
chat/modules/imServices.jsm
chat/modules/imSmileys.jsm
chat/modules/imStatusUtils.jsm
chat/modules/imTextboxUtils.jsm
chat/modules/imThemes.jsm
chat/modules/imXPCOMUtils.jsm
chat/modules/jsProtoHelper.jsm
chat/modules/socket.jsm
chat/modules/test/test_ArrayBufferUtils.js
chat/modules/test/test_NormalizedMap.js
chat/modules/test/test_filtering.js
chat/protocols/facebook/facebook.js
chat/protocols/gtalk/gtalk.js
chat/protocols/irc/irc.js
chat/protocols/irc/ircBase.jsm
chat/protocols/irc/ircCAP.jsm
chat/protocols/irc/ircCTCP.jsm
chat/protocols/irc/ircCommands.jsm
chat/protocols/irc/ircDCC.jsm
chat/protocols/irc/ircHandlers.jsm
chat/protocols/irc/ircISUPPORT.jsm
chat/protocols/irc/ircMultiPrefix.jsm
chat/protocols/irc/ircNonStandard.jsm
chat/protocols/irc/ircSASL.jsm
chat/protocols/irc/ircServerTime.jsm
chat/protocols/irc/ircServices.jsm
chat/protocols/irc/ircUtils.jsm
chat/protocols/irc/ircWatchMonitor.jsm
chat/protocols/irc/test/test_ctcpColoring.js
chat/protocols/irc/test/test_ctcpDequote.js
chat/protocols/irc/test/test_ctcpFormatting.js
chat/protocols/irc/test/test_ctcpQuote.js
chat/protocols/irc/test/test_ircCAP.js
chat/protocols/irc/test/test_ircCommands.js
chat/protocols/irc/test/test_ircMessage.js
chat/protocols/irc/test/test_ircNonStandard.js
chat/protocols/irc/test/test_ircServerTime.js
chat/protocols/irc/test/test_sendBufferedCommand.js
chat/protocols/irc/test/test_setMode.js
chat/protocols/irc/test/test_splitLongMessages.js
chat/protocols/irc/test/test_tryNewNick.js
chat/protocols/jsTest/jsTestProtocol.js
chat/protocols/matrix/matrix-sdk.jsm
chat/protocols/matrix/matrix.js
chat/protocols/odnoklassniki/odnoklassniki.js
chat/protocols/skype/skype.js
chat/protocols/skype/test/test_MagicSha256.js
chat/protocols/skype/test/test_contactUrlToName.js
chat/protocols/twitter/twitter.js
chat/protocols/xmpp/test/test_dnsSrv.js
chat/protocols/xmpp/test/test_parseJidAndNormalization.js
chat/protocols/xmpp/test/test_saslPrep.js
chat/protocols/xmpp/test/test_xmppParser.js
chat/protocols/xmpp/test/test_xmppXml.js
chat/protocols/xmpp/xmpp-authmechs.jsm
chat/protocols/xmpp/xmpp-commands.jsm
chat/protocols/xmpp/xmpp-session.jsm
chat/protocols/xmpp/xmpp.js
chat/protocols/xmpp/xmpp.jsm
chat/protocols/yahoo/yahoo.js
im/components/contentHandler.js
im/components/ibCommandLineHandler.js
im/components/ibConvStatsService.js
im/components/ibDockBadge.js
im/components/ibStatusCommandLineHandler.js
im/components/mintrayr/content/mintrayr.js
im/components/profileMigrator.js
im/content/account.js
im/content/accountWizard.js
im/content/accounts.js
im/content/blist.js
im/content/buddy.xml
im/content/contact.xml
im/content/conv.xml
im/content/conversation.xml
im/content/debug/fake/fake.js
im/content/debugLogPanel.xml
im/content/extensions-discover.js
im/content/extensions.js
im/content/instantbird.js
im/content/joinchat.js
im/content/menus.js
im/content/newtab.xml
im/content/nsContextMenu.js
im/content/preferences/advanced.js
im/content/preferences/main.js
im/content/preferences/messagestyle.js
im/content/preferences/privacy.js
im/content/preferences/smileys.js
im/content/preferences/themes.js
im/content/tabbrowser.xml
im/content/utilities.js
im/content/viewlog.js
im/modules/ibCore.jsm
im/modules/ibNotifications.jsm
im/modules/ibSounds.jsm
im/modules/ibTagMenu.jsm
im/modules/ibWinJumpList.jsm
im/modules/imWindows.jsm
--- a/chat/components/src/imAccounts.js
+++ b/chat/components/src/imAccounts.js
@@ -1,16 +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/. */
 
 var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
 
 var kPrefAutologinPending = "messenger.accounts.autoLoginPending";
 var kPrefMessengerAccounts = "messenger.accounts";
 var kPrefAccountPrefix = "messenger.account.";
 var kAccountKeyPrefix = "account";
 var kAccountOptionPrefPrefix = "options.";
 var kPrefAccountName = "name";
 var kPrefAccountPrpl = "prpl";
--- a/chat/components/src/imCommands.js
+++ b/chat/components/src/imCommands.js
@@ -1,16 +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/. */
 
 var {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
 
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "_", () =>
   l10nHelper("chrome://chat/locale/commands.properties")
 );
 
 function CommandsService() { }
 CommandsService.prototype = {
   initCommands: function() {
--- a/chat/components/src/imContacts.js
+++ b/chat/components/src/imContacts.js
@@ -1,15 +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/. */
 
 var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "_", () =>
   l10nHelper("chrome://chat/locale/contacts.properties")
 );
 
 var gDBConnection = null;
 
 function executeAsyncThenFinalize(statement)
--- a/chat/components/src/imConversations.js
+++ b/chat/components/src/imConversations.js
@@ -1,17 +1,17 @@
 /* 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/. */
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/imStatusUtils.jsm");
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imStatusUtils.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
 
 var gLastUIConvId = 0;
 var gLastPrplConvId = 0;
 
 XPCOMUtils.defineLazyGetter(this, "bundle", () =>
   Services.strings.createBundle("chrome://chat/locale/conversations.properties")
 );
 
--- a/chat/components/src/imCore.js
+++ b/chat/components/src/imCore.js
@@ -1,15 +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/. */
 
 var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(this, "categoryManager",
                                    "@mozilla.org/categorymanager;1",
                                    "nsICategoryManager");
 
 var kQuitApplicationGranted = "quit-application-granted";
 var kProtocolPluginCategory = "im-protocol-plugin";
 
--- a/chat/components/src/logger.js
+++ b/chat/components/src/logger.js
@@ -1,22 +1,22 @@
 /* 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/. */
 
 var {classes: Cc, interfaces: Ci, utils: Cu, Constructor: CC} = Components;
 
-Cu.import("resource:///modules/hiddenWindow.jsm");
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/jsProtoHelper.jsm");
-Cu.import("resource:///modules/ToLocaleFormat.jsm");
+ChromeUtils.import("resource:///modules/hiddenWindow.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource:///modules/ToLocaleFormat.jsm");
 
-Cu.import("resource://gre/modules/Task.jsm")
-XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
+ChromeUtils.import("resource://gre/modules/Task.jsm")
+ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "_", () =>
   l10nHelper("chrome://chat/locale/logger.properties")
 );
 
 var kLineBreak = "@mozilla.org/windows-registry-key;1" in Cc ? "\r\n" : "\n";
 
 /*
--- a/chat/components/src/smileProtocolHandler.js
+++ b/chat/components/src/smileProtocolHandler.js
@@ -1,17 +1,17 @@
 /* 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/. */
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource:///modules/imSmileys.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imSmileys.jsm");
 
 var kSmileRegexp = /^smile:\/\//;
 
 function smileProtocolHandler() { }
 
 smileProtocolHandler.prototype = {
   scheme: "smile",
   defaultPort: -1,
--- a/chat/components/src/test/test_accounts.js
+++ b/chat/components/src/test/test_accounts.js
@@ -1,17 +1,17 @@
 /* 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/. */
 
 var {interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource://testing-common/AppInfo.jsm");
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource://testing-common/AppInfo.jsm");
 
 function run_test() {
   do_get_profile();
 
   // Test the handling of accounts for unknown protocols.
   const kAccountName = "Unknown"
   const kPrplId = "prpl-unknown";
 
--- a/chat/components/src/test/test_commands.js
+++ b/chat/components/src/test/test_commands.js
@@ -1,15 +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/. */
 
 var {interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
 // We don't load the command service via Services as we want to access
 // _findCommands in order to avoid having to intercept command execution.
 var imCommands = {};
 Services.scriptloader.loadSubScript("resource:///components/imCommands.js", imCommands);
 
 var kPrplId = "green";
 var kPrplId2 = "red";
 
--- a/chat/components/src/test/test_conversations.js
+++ b/chat/components/src/test/test_conversations.js
@@ -1,14 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 var {interfaces: Ci, utils: Cu} = Components;
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
 
 var imConversations = {};
 Services.scriptloader.loadSubScript(
   "resource:///components/imConversations.js", imConversations
 );
 
 // Fake prplConversation
 var _id = 0;
--- a/chat/components/src/test/test_logger.js
+++ b/chat/components/src/test/test_logger.js
@@ -1,20 +1,20 @@
 /* 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/. */
 
 var {interfaces: Ci, utils: Cu} = Components;
 
 do_get_profile();
 
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource://gre/modules/osfile.jsm");
-Cu.import("resource://gre/modules/Task.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource://gre/modules/osfile.jsm");
+ChromeUtils.import("resource://gre/modules/Task.jsm");
 
 var gLogger = {};
 Services.scriptloader.loadSubScript("resource:///components/logger.js", gLogger);
 
 var logDirPath = OS.Path.join(OS.Constants.Path.profileDir, "logs");
 
 var dummyAccount = {
   name: "dummy-account",
--- a/chat/content/browserRequest.js
+++ b/chat/content/browserRequest.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/. */
 
-Components.utils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
 
 var wpl = Components.interfaces.nsIWebProgressListener;
 
 var reporterListener = {
   _isBusy: false,
   get statusMeter() {
     delete this.statusMeter;
     return this.statusMeter = document.getElementById("statusbar-icon");
--- a/chat/content/convbrowser.xml
+++ b/chat/content/convbrowser.xml
@@ -106,17 +106,17 @@
       <field name="_finder">null</field>
 
       <property name="finder" readonly="true">
         <getter><![CDATA[
           if (!this._finder) {
             if (!this.docShell)
               return null;
 
-            let Finder = Components.utils.import("resource://gre/modules/Finder.jsm", {}).Finder;
+            let Finder = ChromeUtils.import("resource://gre/modules/Finder.jsm", {}).Finder;
             this._finder = new Finder(this.docShell);
           }
           return this._finder;
         ]]></getter>
       </property>
 
       <field name="_fastFind">null</field>
       <property name="fastFind"
@@ -274,21 +274,21 @@
       <field name="mDestroyed">false</field>
 
       <constructor>
         <![CDATA[
           this.addEventListener("scroll", this.browserScroll);
           this.addEventListener("resize", this.browserResize);
 
           if (!("cleanupImMarkup" in window))
-            Components.utils.import("resource:///modules/imContentSink.jsm");
+            ChromeUtils.import("resource:///modules/imContentSink.jsm");
           if (!("smileImMarkup" in window))
-            Components.utils.import("resource:///modules/imSmileys.jsm");
+            ChromeUtils.import("resource:///modules/imSmileys.jsm");
           if (!("getCurrentTheme" in window))
-            Components.utils.import("resource:///modules/imThemes.jsm");
+            ChromeUtils.import("resource:///modules/imThemes.jsm");
 
           this.onContentElementLoad = this._onContentElementLoad.bind(this);
         ]]>
       </constructor>
 
       <destructor>
         <![CDATA[
           this.destroy();
--- a/chat/modules/DNS.jsm
+++ b/chat/modules/DNS.jsm
@@ -1,19 +1,19 @@
 /* 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/. */
 
 // This module is responsible for performing DNS queries using ctypes for
 // loading system DNS libraries on Linux, Mac and Windows.
 
 if (typeof Components !== "undefined") {
-  Components.utils.import("resource://gre/modules/ctypes.jsm");
-  Components.utils.import("resource://gre/modules/Services.jsm");
-  Components.utils.import('resource://gre/modules/PromiseWorker.jsm');
+  ChromeUtils.import("resource://gre/modules/ctypes.jsm");
+  ChromeUtils.import("resource://gre/modules/Services.jsm");
+  ChromeUtils.import('resource://gre/modules/PromiseWorker.jsm');
 }
 
 var LOCATION = "resource:///modules/DNS.jsm";
 
 // These constants are luckily shared, but with different names
 var NS_T_TXT = 16; // DNS_TYPE_TXT
 var NS_T_SRV = 33; // DNS_TYPE_SRV
 
--- a/chat/modules/ToLocaleFormat.jsm
+++ b/chat/modules/ToLocaleFormat.jsm
@@ -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/. */
 
-Components.utils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 this.EXPORTED_SYMBOLS = ["ToLocaleFormat"];
 
 // JS implementation of the deprecated Date.toLocaleFormat.
 // aFormat follows strftime syntax,
 // http://pubs.opengroup.org/onlinepubs/007908799/xsh/strftime.html
 function ToLocaleFormat(aFormat, aDate) {
   function Day(t) {
--- a/chat/modules/hiddenWindow.jsm
+++ b/chat/modules/hiddenWindow.jsm
@@ -1,16 +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/. */
 
 this.EXPORTED_SYMBOLS = ["getHiddenHTMLWindow"];
 
-Components.utils.import("resource://gre/modules/Services.jsm");
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "hiddenWindow", () =>
   Services.appShell.hiddenDOMWindow
 );
 #ifndef XP_MACOSX
 function getHiddenHTMLWindow() { return hiddenWindow; }
 #else
 function getHiddenHTMLWindow() {
--- a/chat/modules/imContentSink.jsm
+++ b/chat/modules/imContentSink.jsm
@@ -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/. */
 
-Components.utils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
 
 this.EXPORTED_SYMBOLS = [
   "cleanupImMarkup", // used to clean up incoming IMs.
                      // This will use the global ruleset of acceptable stuff
                      // except if another (custom one) is provided
   "createDerivedRuleset", // used to create a ruleset that inherits from the
                           // default one
                           // useful if you want to allow or forbid
--- a/chat/modules/imServices.jsm
+++ b/chat/modules/imServices.jsm
@@ -1,16 +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/. */
 
 this.EXPORTED_SYMBOLS = ["Services"];
 
-Components.utils.import("resource://gre/modules/Services.jsm");
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(Services, "accounts",
                                    "@mozilla.org/chat/accounts-service;1",
                                    "imIAccountsService");
 XPCOMUtils.defineLazyServiceGetter(Services, "core",
                                    "@mozilla.org/chat/core-service;1",
                                    "imICoreService");
 XPCOMUtils.defineLazyServiceGetter(Services, "cmd",
--- a/chat/modules/imSmileys.jsm
+++ b/chat/modules/imSmileys.jsm
@@ -1,21 +1,21 @@
 /* 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/. */
 
-Components.utils.import("resource:///modules/imServices.jsm");
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "gTextDecoder", () => {
   return new TextDecoder();
 });
 
-XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
-                                  "resource://gre/modules/NetUtil.jsm");
+ChromeUtils.defineModuleGetter(this, "NetUtil",
+                               "resource://gre/modules/NetUtil.jsm");
 
 this.EXPORTED_SYMBOLS = [
   "smileImMarkup", // used to add smile:// img tags into IM markup.
   "smileTextNode", // used to add smile:// img tags to the content of a textnode
   "smileString", // used to add smile:// img tags into a string without parsing it as HTML. Be sure the string doesn't contain HTML tags.
   "getSmileRealURI", // used to retrive the chrome URI for a smile:// URI
   "getSmileyList" // used to display a list of smileys in the UI
 ];
--- a/chat/modules/imStatusUtils.jsm
+++ b/chat/modules/imStatusUtils.jsm
@@ -1,18 +1,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/. */
 
 this.EXPORTED_SYMBOLS = ["Status"];
 
 var {interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "_", () =>
   l10nHelper("chrome://chat/locale/status.properties")
 );
 
 var imIStatusInfo = Ci.imIStatusInfo;
 var statusAttributes = {};
 statusAttributes[imIStatusInfo.STATUS_UNKNOWN] = "unknown";
--- a/chat/modules/imTextboxUtils.jsm
+++ b/chat/modules/imTextboxUtils.jsm
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 this.EXPORTED_SYMBOLS = [
   "MessageFormat",
   "TextboxSize",
   "TextboxSpellChecker"
 ];
 
-Components.utils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
 var Ci = Components.interfaces;
 
 var MessageFormat = {
   _observedPrefs: [],
 
   getValues: function mf_getValues() {
     this.unregisterObservers();
     let langGroup =
--- a/chat/modules/imThemes.jsm
+++ b/chat/modules/imThemes.jsm
@@ -11,19 +11,19 @@ this.EXPORTED_SYMBOLS = [
   "insertHTMLForMessage",
   "initHTMLDocument",
   "getMessagesForRange",
   "serializeSelection"
 ];
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource://gre/modules/DownloadUtils.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource://gre/modules/DownloadUtils.jsm");
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 var kMessagesStylePrefBranch = "messenger.options.messagesStyle.";
 var kThemePref = "theme";
 var kVariantPref = "variant";
 var kShowHeaderPref = "showHeader";
 var kCombineConsecutivePref = "combineConsecutive";
 var kCombineConsecutiveIntervalPref = "combineConsecutiveInterval";
 
@@ -36,17 +36,17 @@ XPCOMUtils.defineLazyGetter(this, "gPref
   Services.prefs.getBranch(kMessagesStylePrefBranch)
 );
 
 XPCOMUtils.defineLazyGetter(this, "TXTToHTML", function() {
   let cs = Cc["@mozilla.org/txttohtmlconv;1"].getService(Ci.mozITXTToHTMLConv);
   return aTXT => cs.scanTXT(aTXT, cs.kEntities);
 });
 
-XPCOMUtils.defineLazyModuleGetter(this,
+ChromeUtils.defineModuleGetter(this,
   "ToLocaleFormat", "resource:///modules/ToLocaleFormat.jsm");
 
 var gCurrentTheme = null;
 
 function getChromeFile(aURI)
 {
   try {
     let channel = Services.io.newChannel2(aURI, null, null, null,
--- a/chat/modules/imXPCOMUtils.jsm
+++ b/chat/modules/imXPCOMUtils.jsm
@@ -11,18 +11,18 @@ this.EXPORTED_SYMBOLS = [
   "EmptyEnumerator",
   "ClassInfo",
   "l10nHelper",
   "initLogModule"
 ];
 
 var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
 
 var kLogLevelPref = "purple.debug.loglevel";
 
 /**
  * Creates an nsIScriptError instance and logs it.
  *
  * @param aModule
  *        string identifying the module within which the error occurred.
--- a/chat/modules/jsProtoHelper.jsm
+++ b/chat/modules/jsProtoHelper.jsm
@@ -12,18 +12,18 @@ this.EXPORTED_SYMBOLS = [
   "GenericMessagePrototype",
   "GenericProtocolPrototype",
   "Message",
   "TooltipInfo"
 ];
 
 var {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
 
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "_", () =>
   l10nHelper("chrome://chat/locale/conversations.properties")
 );
 
 var GenericAccountPrototype = {
   __proto__: ClassInfo("prplIAccount", "generic account object"),
   get wrappedJSObject() { return this; },
--- a/chat/modules/socket.jsm
+++ b/chat/modules/socket.jsm
@@ -74,20 +74,20 @@
  *   Add a message queue to keep from flooding a server (just an array, just
  *     keep shifting the first element off and calling as setTimeout for the
  *     desired flood time?).
  */
 
 this.EXPORTED_SYMBOLS = ["Socket"];
 
 var {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource:///modules/ArrayBufferUtils.jsm");
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/hiddenWindow.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource:///modules/ArrayBufferUtils.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/hiddenWindow.jsm");
 
 // Network errors see: xpcom/base/nsError.h
 var NS_ERROR_MODULE_NETWORK = 2152398848;
 var NS_ERROR_CONNECTION_REFUSED = NS_ERROR_MODULE_NETWORK + 13;
 var NS_ERROR_NET_TIMEOUT = NS_ERROR_MODULE_NETWORK + 14;
 var NS_ERROR_NET_RESET = NS_ERROR_MODULE_NETWORK + 20;
 var NS_ERROR_UNKNOWN_HOST = NS_ERROR_MODULE_NETWORK + 30;
 var NS_ERROR_UNKNOWN_PROXY_HOST = NS_ERROR_MODULE_NETWORK + 42;
--- a/chat/modules/test/test_ArrayBufferUtils.js
+++ b/chat/modules/test/test_ArrayBufferUtils.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource:///modules/ArrayBufferUtils.jsm");
+ChromeUtils.import("resource:///modules/ArrayBufferUtils.jsm");
 
 function do_check_arraybuffer_eq(a, b) {
   let viewA = new Uint8Array(a);
   let viewB = new Uint8Array(b);
 
   let res = a.byteLength == b.byteLength;
   for (let i = 0; i < viewA.byteLength; ++i)
     res = res && viewA[i] == viewB[i];
--- a/chat/modules/test/test_NormalizedMap.js
+++ b/chat/modules/test/test_NormalizedMap.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource:///modules/NormalizedMap.jsm");
+ChromeUtils.import("resource:///modules/NormalizedMap.jsm");
 
 function test_setter_getter() {
   let m = new NormalizedMap(aStr => aStr.toLowerCase());
   m.set("foo", "bar");
   m.set("BaZ", "blah");
   Assert.equal(m.has("FOO"), true);
   Assert.equal(m.has("BaZ"), true);
   Assert.equal(m.get("FOO"), "bar");
--- a/chat/modules/test/test_filtering.js
+++ b/chat/modules/test/test_filtering.js
@@ -1,13 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource:///modules/imServices.jsm");
-Components.utils.import("resource:///modules/imContentSink.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imContentSink.jsm");
 
 var kModePref = "messenger.options.filterMode";
 var kStrictMode = 0, kStandardMode = 1, kPermissiveMode = 2;
 
 function run_test() {
   let defaultMode = Services.prefs.getIntPref(kModePref);
 
   add_test(test_strictMode);
--- a/chat/protocols/facebook/facebook.js
+++ b/chat/protocols/facebook/facebook.js
@@ -1,16 +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/. */
 
 var {interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "_", () =>
   l10nHelper("chrome://chat/locale/facebook.properties")
 );
 
 function FacebookAccount(aProtoInstance, aImAccount) {
   this._init(aProtoInstance, aImAccount);
 }
--- a/chat/protocols/gtalk/gtalk.js
+++ b/chat/protocols/gtalk/gtalk.js
@@ -1,19 +1,19 @@
 /* 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/. */
 
 var Cu = Components.utils;
 
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/jsProtoHelper.jsm");
-Cu.import("resource:///modules/xmpp.jsm");
-Cu.import("resource:///modules/xmpp-session.jsm");
-Cu.import("resource:///modules/xmpp-xml.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource:///modules/xmpp.jsm");
+ChromeUtils.import("resource:///modules/xmpp-session.jsm");
+ChromeUtils.import("resource:///modules/xmpp-xml.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "_", () =>
   l10nHelper("chrome://chat/locale/xmpp.properties")
 );
 
 // PlainFullBindAuth is an authentication mechanism that works like
 // the standard PLAIN mechanism but adds a client-uses-full-bind-result
 // attribute to the auth stanza to tell the Google Talk servers that we
@@ -64,17 +64,17 @@ GTalkAccount.prototype = {
     this._connection =
       new XMPPSession("talk.google.com", 443,
                       "require_tls", this._jid,
                       this.imAccount.password, this);
   }
 };
 
 function GTalkProtocol() {
-  Cu.import("resource:///modules/xmpp-commands.jsm", this);
+  ChromeUtils.import("resource:///modules/xmpp-commands.jsm", this);
   this.registerCommands();
 }
 GTalkProtocol.prototype = {
   __proto__: GenericProtocolPrototype,
   get normalizedName() { return "gtalk"; },
   get name() { return _("gtalk.protocolName"); },
   get iconBaseURI() { return "chrome://prpl-gtalk/skin/"; },
   get usernameEmptyText() { return _("gtalk.usernameHint"); },
--- a/chat/protocols/irc/irc.js
+++ b/chat/protocols/irc/irc.js
@@ -1,26 +1,26 @@
 /* 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/. */
 
 var {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
 
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/ircUtils.jsm");
-Cu.import("resource:///modules/ircHandlers.jsm");
-Cu.import("resource:///modules/jsProtoHelper.jsm");
-Cu.import("resource:///modules/NormalizedMap.jsm");
-Cu.import("resource:///modules/socket.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/ircUtils.jsm");
+ChromeUtils.import("resource:///modules/ircHandlers.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource:///modules/NormalizedMap.jsm");
+ChromeUtils.import("resource:///modules/socket.jsm");
 
-XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
+ChromeUtils.defineModuleGetter(this, "PluralForm",
   "resource://gre/modules/PluralForm.jsm");
 
-XPCOMUtils.defineLazyModuleGetter(this, "DownloadUtils",
+ChromeUtils.defineModuleGetter(this, "DownloadUtils",
   "resource://gre/modules/DownloadUtils.jsm");
 
 /*
  * Parses a raw IRC message into an object (see section 2.3 of RFC 2812). This
  * returns an object with the following fields:
  *   rawMessage The initial message string received without any processing.
  *   command    A string that is the command or response code.
  *   params     An array of strings for the parameters. The last parameter is
@@ -1941,34 +1941,34 @@ ircAccount.prototype = {
     clearTimeout(this._isOnTimer);
     clearTimeout(this._quitTimer);
   }
 };
 
 function ircProtocol() {
   // ircCommands.jsm exports one variable: commands. Import this directly into
   // the protocol object.
-  Cu.import("resource:///modules/ircCommands.jsm", this);
+  ChromeUtils.import("resource:///modules/ircCommands.jsm", this);
   this.registerCommands();
 
   // Register the standard handlers.
   let tempScope = {};
-  Cu.import("resource:///modules/ircBase.jsm", tempScope);
-  Cu.import("resource:///modules/ircISUPPORT.jsm", tempScope);
-  Cu.import("resource:///modules/ircCAP.jsm", tempScope);
-  Cu.import("resource:///modules/ircCTCP.jsm", tempScope);
-  Cu.import("resource:///modules/ircDCC.jsm", tempScope);
-  Cu.import("resource:///modules/ircServices.jsm", tempScope);
+  ChromeUtils.import("resource:///modules/ircBase.jsm", tempScope);
+  ChromeUtils.import("resource:///modules/ircISUPPORT.jsm", tempScope);
+  ChromeUtils.import("resource:///modules/ircCAP.jsm", tempScope);
+  ChromeUtils.import("resource:///modules/ircCTCP.jsm", tempScope);
+  ChromeUtils.import("resource:///modules/ircDCC.jsm", tempScope);
+  ChromeUtils.import("resource:///modules/ircServices.jsm", tempScope);
 
   // Extra features.
-  Cu.import("resource:///modules/ircMultiPrefix.jsm", tempScope);
-  Cu.import("resource:///modules/ircNonStandard.jsm", tempScope);
-  Cu.import("resource:///modules/ircSASL.jsm", tempScope);
-  Cu.import("resource:///modules/ircServerTime.jsm", tempScope);
-  Cu.import("resource:///modules/ircWatchMonitor.jsm", tempScope);
+  ChromeUtils.import("resource:///modules/ircMultiPrefix.jsm", tempScope);
+  ChromeUtils.import("resource:///modules/ircNonStandard.jsm", tempScope);
+  ChromeUtils.import("resource:///modules/ircSASL.jsm", tempScope);
+  ChromeUtils.import("resource:///modules/ircServerTime.jsm", tempScope);
+  ChromeUtils.import("resource:///modules/ircWatchMonitor.jsm", tempScope);
 
   // Register default IRC handlers (IRC base, CTCP).
   ircHandlers.registerHandler(tempScope.ircBase);
   ircHandlers.registerHandler(tempScope.ircISUPPORT);
   ircHandlers.registerHandler(tempScope.ircCAP);
   ircHandlers.registerHandler(tempScope.ircCTCP);
   ircHandlers.registerHandler(tempScope.ircServices);
   // Register default ISUPPORT handler (ISUPPORT base).
--- a/chat/protocols/irc/ircBase.jsm
+++ b/chat/protocols/irc/ircBase.jsm
@@ -16,21 +16,21 @@
  *     http://tools.ietf.org/html/rfc2813
  *   RFC 1459: Internet Relay Chat Protocol
  *     http://tools.ietf.org/html/rfc1459
  */
 this.EXPORTED_SYMBOLS = ["ircBase"];
 
 var {interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/ircHandlers.jsm");
-Cu.import("resource:///modules/ircUtils.jsm");
-Cu.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/ircHandlers.jsm");
+ChromeUtils.import("resource:///modules/ircUtils.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
 
 function privmsg(aAccount, aMessage, aIsNotification) {
   let params = {incoming: true, tags: aMessage.tags};
   if (aIsNotification)
     params.notification = true;
   aAccount.getConversation(aAccount.isMUCName(aMessage.params[0]) ?
                              aMessage.params[0] : aMessage.origin)
           .writeMessage(aMessage.origin, aMessage.params[1], params);
--- a/chat/protocols/irc/ircCAP.jsm
+++ b/chat/protocols/irc/ircCAP.jsm
@@ -16,18 +16,18 @@
  * Note that this doesn't include any implementation as these RFCs do not even
  * include example parameters.
  */
 
 this.EXPORTED_SYMBOLS = ["ircCAP"];
 
 var Cu = Components.utils;
 
-Cu.import("resource:///modules/ircHandlers.jsm");
-Cu.import("resource:///modules/ircUtils.jsm");
+ChromeUtils.import("resource:///modules/ircHandlers.jsm");
+ChromeUtils.import("resource:///modules/ircUtils.jsm");
 
 /*
  * Parses a CAP message of the form:
  *   CAP <subcommand> [<parameters>]
  * The cap field is added to the message and it has the following fields:
  *   subcommand
  *   parameters A list of capabilities.
  */
--- a/chat/protocols/irc/ircCTCP.jsm
+++ b/chat/protocols/irc/ircCTCP.jsm
@@ -7,20 +7,20 @@
  *   REVISED AND UPDATED CTCP SPECIFICATION
  *     http://www.alien.net.au/irc/ctcp.txt
  */
 
 this.EXPORTED_SYMBOLS = ["ircCTCP", "ctcpBase"];
 
 var Cu = Components.utils;
 
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/ircHandlers.jsm");
-Cu.import("resource:///modules/ircUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/ircHandlers.jsm");
+ChromeUtils.import("resource:///modules/ircUtils.jsm");
 
 // Split into a CTCP message which is a single command and a single parameter:
 //   <command> " " <parameter>
 // The high level dequote is to unescape \001 in the message content.
 function CTCPMessage(aMessage, aRawCTCPMessage) {
   let message = Object.assign({}, aMessage);
   message.ctcp = {};
   message.ctcp.rawMessage = aRawCTCPMessage;
--- a/chat/protocols/irc/ircCommands.jsm
+++ b/chat/protocols/irc/ircCommands.jsm
@@ -3,20 +3,19 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // This is to be exported directly onto the IRC prplIProtocol object, directly
 // implementing the commands field before we register them.
 this.EXPORTED_SYMBOLS = ["commands"];
 
 var {interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/ircUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Task",
-  "resource://gre/modules/Task.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/ircUtils.jsm");
+ChromeUtils.defineModuleGetter(this, "Task", "resource://gre/modules/Task.jsm");
 
 // Shortcut to get the JavaScript conversation object.
 function getConv(aConv) { return aConv.wrappedJSObject; }
 
 // Shortcut to get the JavaScript account object.
 function getAccount(aConv) { return getConv(aConv)._account; }
 
 // Trim leading and trailing spaces and split a string by any type of space.
--- a/chat/protocols/irc/ircDCC.jsm
+++ b/chat/protocols/irc/ircDCC.jsm
@@ -8,19 +8,19 @@
  *   A description of the DCC protocol
  *     http://www.irchelp.org/irchelp/rfc/dccspec.html
  */
 
 this.EXPORTED_SYMBOLS = ["ctcpDCC"/*, "dccBase"*/];
 
 var Cu = Components.utils;
 
-Cu.import("resource:///modules/ircHandlers.jsm");
-Cu.import("resource:///modules/ircUtils.jsm");
-Cu.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource:///modules/ircHandlers.jsm");
+ChromeUtils.import("resource:///modules/ircUtils.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
 
 // Parse a CTCP message into a DCC message. A DCC message is a CTCP message of
 // the form:
 //   DCC <type> <argument> <address> <port> [<size>]
 function DCCMessage(aMessage, aAccount) {
   let message = aMessage;
   let params = message.ctcp.param.split(" ");
   if (params.length < 4) {
--- a/chat/protocols/irc/ircHandlers.jsm
+++ b/chat/protocols/irc/ircHandlers.jsm
@@ -1,17 +1,17 @@
 /* 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/. */
 
 this.EXPORTED_SYMBOLS = ["ircHandlers"];
 
 var Cu = Components.utils;
 
-Cu.import("resource:///modules/ircUtils.jsm");
+ChromeUtils.import("resource:///modules/ircUtils.jsm");
 
 var ircHandlers = {
   /*
    * Object to hold the IRC handlers, each handler is an object that implements:
    *   name        The display name of the handler.
    *   priority    The priority of the handler (0 is default, positive is
    *               higher priority)
    *   isEnabled   A function where 'this' is bound to the account object. This
--- a/chat/protocols/irc/ircISUPPORT.jsm
+++ b/chat/protocols/irc/ircISUPPORT.jsm
@@ -11,18 +11,18 @@
  *     http://tools.ietf.org/html/draft-brocklesby-irc-isupport-03
  *     http://tools.ietf.org/html/draft-hardy-irc-isupport-00
  */
 
 this.EXPORTED_SYMBOLS = ["ircISUPPORT", "isupportBase"];
 
 var Cu = Components.utils;
 
-Cu.import("resource:///modules/ircHandlers.jsm");
-Cu.import("resource:///modules/ircUtils.jsm");
+ChromeUtils.import("resource:///modules/ircHandlers.jsm");
+ChromeUtils.import("resource:///modules/ircUtils.jsm");
 
 /*
  * Parses an ircMessage into an ISUPPORT message for each token of the form:
  *   <parameter>=<value> or -<value>
  * The isupport field is added to the message and it has the following fields:
  *   parameter  What is being configured by this ISUPPORT token.
  *   useDefault Whether this parameter should be reset to the default value, as
  *              defined by the RFC.
--- a/chat/protocols/irc/ircMultiPrefix.jsm
+++ b/chat/protocols/irc/ircMultiPrefix.jsm
@@ -12,17 +12,17 @@
  * foo knows that it has mode +h, but bar does not know foo has +h set.
  *
  *   http://wiki.inspircd.org/Modules/2.1/namesx
  *   http://ircv3.atheme.org/extensions/multi-prefix-3.1
  */
 
 this.EXPORTED_SYMBOLS = ["isupportNAMESX", "capMultiPrefix"];
 
-Components.utils.import("resource:///modules/ircHandlers.jsm");
+ChromeUtils.import("resource:///modules/ircHandlers.jsm");
 
 var isupportNAMESX = {
   name: "ISUPPORT NAMESX",
   // Slightly above default ISUPPORT priority.
   priority: ircHandlers.DEFAULT_PRIORITY + 10,
   isEnabled: () => true,
 
   commands: {
--- a/chat/protocols/irc/ircNonStandard.jsm
+++ b/chat/protocols/irc/ircNonStandard.jsm
@@ -11,18 +11,18 @@
  * Resources for these commands include:
  *  https://github.com/atheme/charybdis/blob/master/include/numeric.h
  *  http://hg.unrealircd.com/hg/unreal/raw-file/tip/include/numeric.h
  */
 this.EXPORTED_SYMBOLS = ["ircNonStandard"];
 
 var {interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource:///modules/ircHandlers.jsm");
-Cu.import("resource:///modules/ircUtils.jsm");
+ChromeUtils.import("resource:///modules/ircHandlers.jsm");
+ChromeUtils.import("resource:///modules/ircUtils.jsm");
 
 var ircNonStandard = {
   name: "Non-Standard IRC Extensions",
   priority: ircHandlers.DEFAULT_PRIORITY + 1,
   isEnabled: () => true,
 
   commands: {
     "NOTICE": function(aMessage) {
--- a/chat/protocols/irc/ircSASL.jsm
+++ b/chat/protocols/irc/ircSASL.jsm
@@ -7,18 +7,18 @@
  *   https://raw.github.com/atheme/atheme/master/doc/SASL
  *   https://github.com/ircv3/ircv3-specifications/blob/master/extensions/sasl-3.1
  */
 
 this.EXPORTED_SYMBOLS = ["ircSASL", "capSASL"];
 
 var Cu = Components.utils;
 
-Cu.import("resource:///modules/ircHandlers.jsm");
-Cu.import("resource:///modules/ircUtils.jsm");
+ChromeUtils.import("resource:///modules/ircHandlers.jsm");
+ChromeUtils.import("resource:///modules/ircUtils.jsm");
 
 var ircSASL = {
   name: "SASL AUTHENTICATE",
   priority: ircHandlers.DEFAULT_PRIORITY,
   isEnabled: () => true,
 
   commands: {
     "AUTHENTICATE": function(aMessage) {
--- a/chat/protocols/irc/ircServerTime.jsm
+++ b/chat/protocols/irc/ircServerTime.jsm
@@ -6,17 +6,17 @@
  * This implements server-time for IRC.
  *   http://ircv3.net/specs/extensions/server-time-3.2.html
  */
 
 this.EXPORTED_SYMBOLS = ["capServerTime", "tagServerTime"];
 
 const Cu = Components.utils;
 
-Cu.import("resource:///modules/ircHandlers.jsm");
+ChromeUtils.import("resource:///modules/ircHandlers.jsm");
 
 function handleServerTimeTag(aMsg) {
   if (aMsg.tagValue) {
     // Normalize leap seconds to the next second before it.
     const time = aMsg.tagValue.replace(/60.\d{3}(?=Z$)/, "59.999");
     aMsg.message.time = Math.floor(Date.parse(time) / 1000);
     aMsg.message.delayed = true;
   }
--- a/chat/protocols/irc/ircServices.jsm
+++ b/chat/protocols/irc/ircServices.jsm
@@ -15,19 +15,19 @@
  * Anope
  *  http://www.anope.org/docgen/1.8/
  */
 
 this.EXPORTED_SYMBOLS = ["ircServices", "servicesBase"];
 
 var Cu = Components.utils;
 
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/ircHandlers.jsm");
-Cu.import("resource:///modules/ircUtils.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/ircHandlers.jsm");
+ChromeUtils.import("resource:///modules/ircUtils.jsm");
 
 /*
  * If a service is found, an extra field (serviceName) is added with the
  * "generic" service name (e.g. a bot which performs NickServ like functionality
  * will be mapped to NickServ).
  */
 function ServiceMessage(aAccount, aMessage) {
   // This should be a property of the account or configurable somehow, it maps
--- a/chat/protocols/irc/ircUtils.jsm
+++ b/chat/protocols/irc/ircUtils.jsm
@@ -2,17 +2,17 @@
  * 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/. */
 
 this.EXPORTED_SYMBOLS = ["_", "_conv", "ctcpFormatToText", "ctcpFormatToHTML",
                           "conversationErrorMessage", "kListRefreshInterval"];
 
 var {classes: Cc, interfaces: Ci} = Components;
 
-Components.utils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "_", () =>
   l10nHelper("chrome://chat/locale/irc.properties")
 );
 
 XPCOMUtils.defineLazyGetter(this, "_conv", () =>
   l10nHelper("chrome://chat/locale/conversations.properties")
 );
--- a/chat/protocols/irc/ircWatchMonitor.jsm
+++ b/chat/protocols/irc/ircWatchMonitor.jsm
@@ -12,19 +12,19 @@
  *     http://www.stack.nl/~jilles/cgi-bin/hgwebdir.cgi/irc-documentation-jilles/raw-file/tip/reference/draft-meglio-irc-watch-00.txt
  */
 
 this.EXPORTED_SYMBOLS = ["ircWATCH", "isupportWATCH", "ircMONITOR",
                           "isupportMONITOR"];
 
 var {interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/ircHandlers.jsm");
-Cu.import("resource:///modules/ircUtils.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/ircHandlers.jsm");
+ChromeUtils.import("resource:///modules/ircUtils.jsm");
 
 function setStatus(aAccount, aNick, aStatus) {
   if (!aAccount.watchEnabled && !aAccount.monitorEnabled)
     return false;
 
   if (aStatus == "AWAY") {
     // We need to request the away message.
     aAccount.requestCurrentWhois(aNick);
--- a/chat/protocols/irc/test/test_ctcpColoring.js
+++ b/chat/protocols/irc/test/test_ctcpColoring.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource:///modules/ircUtils.jsm");
+ChromeUtils.import("resource:///modules/ircUtils.jsm");
 
 var input = [
   // From http://www.mirc.com/colors.html
   "\x035,12colored text and background\x03",
   "\x035colored text\x03",
   "\x033colored text \x035,2more colored text and background\x03",
   "\x033,5colored text and background \x038other colored text but same background\x03",
   "\x033,5colored text and background \x038,7other colored text and different background\x03",
--- a/chat/protocols/irc/test/test_ctcpDequote.js
+++ b/chat/protocols/irc/test/test_ctcpDequote.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 var ircCTCP = {};
 Services.scriptloader.loadSubScript("resource:///modules/ircCTCP.jsm", ircCTCP);
 
 var input = [
   "ACTION",
   "ACTION test",
   "ACTION \x5Ctest",
   "ACTION te\x5Cst",
--- a/chat/protocols/irc/test/test_ctcpFormatting.js
+++ b/chat/protocols/irc/test/test_ctcpFormatting.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource:///modules/ircUtils.jsm");
+ChromeUtils.import("resource:///modules/ircUtils.jsm");
 
 //TODO add a test for special JS characters (|, etc...)
 
 var input = [
   "The quick brown fox \x02jumps\x02 over the lazy dog.",
   "The quick brown fox \x02jumps\x0F over the lazy dog.",
   "The quick brown \x16fox jumps\x16 over the lazy dog.",
   "The quick brown \x16fox jumps\x0F over the lazy dog.",
--- a/chat/protocols/irc/test/test_ctcpQuote.js
+++ b/chat/protocols/irc/test/test_ctcpQuote.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 var irc = {};
 Services.scriptloader.loadSubScript("resource:///components/irc.js", irc);
 
 var input = [
   undefined,
   "test",
   "\\test",
   "te\\st",
--- a/chat/protocols/irc/test/test_ircCAP.js
+++ b/chat/protocols/irc/test/test_ircCAP.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 var cap = {};
 Services.scriptloader.loadSubScript("resource:///modules/ircCAP.jsm", cap);
 
 var testData = [
   // A normal LS from the server.
   [
     ["*", "LS", "multi-prefix sasl userhost-in-names"],
     [{
--- a/chat/protocols/irc/test/test_ircCommands.js
+++ b/chat/protocols/irc/test/test_ircCommands.js
@@ -1,13 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource:///modules/imServices.jsm");
-Components.utils.import("resource:///modules/ircCommands.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/ircCommands.jsm");
 
 var irc = {};
 Services.scriptloader.loadSubScript("resource:///components/irc.js", irc);
 
 // Ensure the commands have been initialized.
 Services.conversations.initConversations();
 
 var fakeProto = {
--- a/chat/protocols/irc/test/test_ircMessage.js
+++ b/chat/protocols/irc/test/test_ircMessage.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 var irc = {};
 Services.scriptloader.loadSubScript("resource:///components/irc.js", irc);
 
 var testData = [
   // First off, let's test the messages from RFC 2812.
   "PASS secretpasswordhere",
   "NICK Wiz",
   ":WiZ!jto@tolsun.oulu.fi NICK Kilroy",
--- a/chat/protocols/irc/test/test_ircNonStandard.js
+++ b/chat/protocols/irc/test/test_ircNonStandard.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 var irc = {};
 Services.scriptloader.loadSubScript("resource:///components/irc.js", irc);
-Components.utils.import("resource:///modules/ircNonStandard.jsm");
+ChromeUtils.import("resource:///modules/ircNonStandard.jsm");
 
 // The function that is under test here.
 var NOTICE = ircNonStandard.commands["NOTICE"];
 
 function FakeConversation() {}
 FakeConversation.prototype = {
   writeMessage: function(aSender, aTarget, aOpts) {}
 };
--- a/chat/protocols/irc/test/test_ircServerTime.js
+++ b/chat/protocols/irc/test/test_ircServerTime.js
@@ -1,13 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource:///modules/ircServerTime.jsm");
-Components.utils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource:///modules/ircServerTime.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var irc = {};
 Services.scriptloader.loadSubScript("resource:///components/irc.js", irc);
 
 function getTags(aRawMsg) {
   const {tags} = irc.ircMessage(aRawMsg, "doesnt@matter");
 
   return tags;
--- a/chat/protocols/irc/test/test_sendBufferedCommand.js
+++ b/chat/protocols/irc/test/test_sendBufferedCommand.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/. */
 
-Components.utils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
 var irc = {};
 Services.scriptloader.loadSubScript("resource:///components/irc.js", irc);
 
 function FakeAccount() {
   this._commandBuffers = new Map();
   this.callbacks = [];
 }
 FakeAccount.prototype = {
--- a/chat/protocols/irc/test/test_setMode.js
+++ b/chat/protocols/irc/test/test_setMode.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
 var irc = {};
 Services.scriptloader.loadSubScript("resource:///components/irc.js", irc);
 Services.conversations.initConversations();
 
 
 function FakeAccount() {
   this.normalizeNick = irc.ircAccount.prototype.normalizeNick.bind(this);
 }
--- a/chat/protocols/irc/test/test_splitLongMessages.js
+++ b/chat/protocols/irc/test/test_splitLongMessages.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 var irc = {};
 Services.scriptloader.loadSubScript("resource:///components/irc.js", irc);
 
 var messages = {
   // Exactly 51 characters.
   "This is a test.": ["This is a test."],
   // Too long.
   "This is a message that is too long.":
--- a/chat/protocols/irc/test/test_tryNewNick.js
+++ b/chat/protocols/irc/test/test_tryNewNick.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 var irc = {};
 Services.scriptloader.loadSubScript("resource:///components/irc.js", irc);
 
 var fakeProto = {
   id: "fake-proto",
   options: {alternateNicks: ""},
   _getOptionDefault: function(aOption) { return this.options[aOption]; }
 };
--- a/chat/protocols/jsTest/jsTestProtocol.js
+++ b/chat/protocols/jsTest/jsTestProtocol.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/. */
 
-Components.utils.import("resource:///modules/imXPCOMUtils.jsm");
-Components.utils.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
 
 function Conversation(aAccount)
 {
   this._init(aAccount);
 }
 Conversation.prototype = {
   __proto__: GenericConvIMPrototype,
   _disconnected: false,
--- a/chat/protocols/matrix/matrix-sdk.jsm
+++ b/chat/protocols/matrix/matrix-sdk.jsm
@@ -1,20 +1,20 @@
 /* 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/. */
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource://gre/modules/Console.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/Timer.jsm");
+ChromeUtils.import("resource://gre/modules/Console.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Timer.jsm");
 Cu.importGlobalProperties(["XMLHttpRequest"]);
 
-const { Loader, Require, Module } = Cu.import("resource://devtools/shared/base-loader.js", {});
+const { Loader, Require, Module } = ChromeUtils.import("resource://devtools/shared/base-loader.js", {});
 
 this.EXPORTED_SYMBOLS = ["MatrixSDK"];
 
 // Set-up loading so require works properly in CommonJS modules.
 let matrixPath = "resource:///modules/matrix/";
 let loader = Loader({
   paths: {
       "": matrixPath,
--- a/chat/protocols/matrix/matrix.js
+++ b/chat/protocols/matrix/matrix.js
@@ -1,24 +1,22 @@
 /* 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/. */
 
 var {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
 
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "_", () =>
   l10nHelper("chrome://chat/locale/matrix.properties")
 );
 
-XPCOMUtils.defineLazyModuleGetter(this, "MatrixSDK",
-                                  "resource:///modules/matrix-sdk.jsm"
-);
+ChromeUtils.defineModuleGetter(this, "MatrixSDK", "resource:///modules/matrix-sdk.jsm");
 
 function MatrixParticipant(aRoomMember) {
   // FIXME: Should probably use aRoomMember.name, but it's not unique id?
   this._name = aRoomMember.userId;
   this._roomMember = aRoomMember;
 }
 MatrixParticipant.prototype = {
   __proto__: GenericConvChatBuddyPrototype,
--- a/chat/protocols/odnoklassniki/odnoklassniki.js
+++ b/chat/protocols/odnoklassniki/odnoklassniki.js
@@ -1,18 +1,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/. */
 
 var {interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/jsProtoHelper.jsm");
-Cu.import("resource:///modules/xmpp.jsm");
-Cu.import("resource:///modules/xmpp-session.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource:///modules/xmpp.jsm");
+ChromeUtils.import("resource:///modules/xmpp-session.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "_", () =>
   l10nHelper("chrome://chat/locale/xmpp.properties")
 );
 
 function OdnoklassnikiAccount(aProtoInstance, aImAccount) {
   this._init(aProtoInstance, aImAccount);
 }
--- a/chat/protocols/skype/skype.js
+++ b/chat/protocols/skype/skype.js
@@ -1,20 +1,20 @@
 /* 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/. */
 
 var {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
 
-Cu.import("resource://gre/modules/Http.jsm");
-Cu.import("resource:///modules/ArrayBufferUtils.jsm");
-Cu.import("resource:///modules/BigInteger.jsm");
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource://gre/modules/Http.jsm");
+ChromeUtils.import("resource:///modules/ArrayBufferUtils.jsm");
+ChromeUtils.import("resource:///modules/BigInteger.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
 
 // Constants used by the login process. This emulates a captured session using
 // official means.
 var kLockAndKeyAppId = "msmsgs@msnmsgr.com";
 var kLockAndKeySecret = "Q1P7W2E4J9R8U3S5";
 var kClientId = "578134";
 var kClientInfo = "os=Windows; osVer=8.1; proc=Win32; lcid=en-us; " +
   "deviceType=1; country=n/a; clientName=swx-skype.com; clientVer=908/1.0.0.20";
--- a/chat/protocols/skype/test/test_MagicSha256.js
+++ b/chat/protocols/skype/test/test_MagicSha256.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 var skype = {};
 Services.scriptloader.loadSubScript("resource:///components/skype.js", skype);
 
 var data = {
   "1416264993": "3a33ac47fe2ec1a33d569f4be5c69ddc",
   "1416387358": "eca9716e1eedcbe93320ba794cea3388",
   "1416392361": "2ed6fc80c3303caa137ae3fd4fcc7d80"
 };
--- a/chat/protocols/skype/test/test_contactUrlToName.js
+++ b/chat/protocols/skype/test/test_contactUrlToName.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 var skype = {};
 Services.scriptloader.loadSubScript("resource:///components/skype.js", skype);
 
 var data = {
   "https://bay-client-s.gateway.messenger.live.com/v1/users/ME/contacts/8:clokep":
     "clokep",
   "https://bay-client-s.gateway.messenger.live.com/v1/users/8:clokep/presenceDocs/messagingService":
     "clokep"
--- a/chat/protocols/twitter/twitter.js
+++ b/chat/protocols/twitter/twitter.js
@@ -1,19 +1,19 @@
 /* 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/. */
 
 var {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
 
-Cu.import("resource://gre/modules/Http.jsm");
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/jsProtoHelper.jsm");
-Cu.import("resource:///modules/twitter-text.jsm");
+ChromeUtils.import("resource://gre/modules/Http.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource:///modules/twitter-text.jsm");
 
 var NS_PREFBRANCH_PREFCHANGE_TOPIC_ID = "nsPref:changed";
 var kMaxMessageLength = 140;
 
 XPCOMUtils.defineLazyGetter(this, "_", () =>
   l10nHelper("chrome://chat/locale/twitter.properties")
 );
 XPCOMUtils.defineLazyGetter(this, "_lang", () =>
--- a/chat/protocols/xmpp/test/test_dnsSrv.js
+++ b/chat/protocols/xmpp/test/test_dnsSrv.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var dns = {};
 Services.scriptloader.loadSubScript("resource:///modules/DNS.jsm", dns);
 
 var xmpp = {};
 Services.scriptloader.loadSubScript("resource:///components/xmpp.js", xmpp);
 
 var xmppSession = {};
--- a/chat/protocols/xmpp/test/test_parseJidAndNormalization.js
+++ b/chat/protocols/xmpp/test/test_parseJidAndNormalization.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var xmpp = {};
 Services.scriptloader.loadSubScript("resource:///components/xmpp.js", xmpp);
 
 var TEST_DATA = {
   "abdelrhman@instantbird": {
     node: "abdelrhman",
     domain: "instantbird",
--- a/chat/protocols/xmpp/test/test_saslPrep.js
+++ b/chat/protocols/xmpp/test/test_saslPrep.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var xmppAuth = {};
 Services.scriptloader.loadSubScript("resource:///modules/xmpp-authmechs.jsm",
                                     xmppAuth);
 
 // RFC 4013 3.Examples
 var TEST_DATA = [
   {
--- a/chat/protocols/xmpp/test/test_xmppParser.js
+++ b/chat/protocols/xmpp/test/test_xmppParser.js
@@ -1,13 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-Cu.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var xmppXml = {};
 Services.scriptloader.loadSubScript("resource:///modules/xmpp-xml.jsm", xmppXml);
 
 var TEST_DATA = [
   {
     input: '<message xmlns="jabber:client" from="juliet@capulet.example/balcony" \
 to="romeo@montague.example/garden" type="chat">\
--- a/chat/protocols/xmpp/test/test_xmppXml.js
+++ b/chat/protocols/xmpp/test/test_xmppXml.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-Components.utils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var xmppXml = {};
 Services.scriptloader.loadSubScript("resource:///modules/xmpp-xml.jsm", xmppXml);
 
 var TEST_DATA = [
   {
     input: {
       name: "message",
--- a/chat/protocols/xmpp/xmpp-authmechs.jsm
+++ b/chat/protocols/xmpp/xmpp-authmechs.jsm
@@ -9,18 +9,18 @@
 // detail of the XMPP implementation, but exporting it is valuable so that
 // add-ons can add support for more auth mechanisms easily by adding them
 // in XMPPAuthMechanisms without having to modify XMPPSession.
 
 this.EXPORTED_SYMBOLS = ["XMPPAuthMechanisms"];
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource://services-crypto/utils.js");
-Cu.import("resource:///modules/xmpp-xml.jsm");
+ChromeUtils.import("resource://services-crypto/utils.js");
+ChromeUtils.import("resource:///modules/xmpp-xml.jsm");
 
 // Handle PLAIN authorization mechanism.
 function* PlainAuth(aUsername, aPassword, aDomain) {
   let data = "\0"+ aUsername + "\0" + aPassword;
 
   // btoa for Unicode, see https://developer.mozilla.org/en-US/docs/DOM/window.btoa
   let base64Data = btoa(unescape(encodeURIComponent(data)));
 
--- a/chat/protocols/xmpp/xmpp-commands.jsm
+++ b/chat/protocols/xmpp/xmpp-commands.jsm
@@ -1,17 +1,17 @@
 /* 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/. */
 
 this.EXPORTED_SYMBOLS = ["commands"];
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "_", () =>
   l10nHelper("chrome://chat/locale/xmpp.properties")
 );
 
 // Get conversation object.
 function getConv(aConv) {
   return aConv.wrappedJSObject;
--- a/chat/protocols/xmpp/xmpp-session.jsm
+++ b/chat/protocols/xmpp/xmpp-session.jsm
@@ -1,22 +1,22 @@
 /* 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/. */
 
 this.EXPORTED_SYMBOLS = ["XMPPSession", "XMPPDefaultResource"];
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource:///modules/DNS.jsm");
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/socket.jsm");
-Cu.import("resource:///modules/xmpp-xml.jsm");
-Cu.import("resource:///modules/xmpp-authmechs.jsm");
+ChromeUtils.import("resource:///modules/DNS.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/socket.jsm");
+ChromeUtils.import("resource:///modules/xmpp-xml.jsm");
+ChromeUtils.import("resource:///modules/xmpp-authmechs.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "_", () =>
   l10nHelper("chrome://chat/locale/xmpp.properties")
 );
 
 // Workaround because a lazy getter can't be exported.
 XPCOMUtils.defineLazyGetter(this, "_defaultResource", () =>
   l10nHelper("chrome://branding/locale/brand.properties")("brandShortName")
--- a/chat/protocols/xmpp/xmpp.js
+++ b/chat/protocols/xmpp/xmpp.js
@@ -1,30 +1,30 @@
 /* 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/. */
 
 var Cu = Components.utils;
 
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/jsProtoHelper.jsm");
-Cu.import("resource:///modules/xmpp.jsm");
-Cu.import("resource:///modules/xmpp-session.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource:///modules/xmpp.jsm");
+ChromeUtils.import("resource:///modules/xmpp-session.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "_", () =>
   l10nHelper("chrome://chat/locale/xmpp.properties")
 );
 
 function XMPPAccount(aProtoInstance, aImAccount) {
   this._init(aProtoInstance, aImAccount);
 }
 XMPPAccount.prototype = XMPPAccountPrototype;
 
 function XMPPProtocol() {
-  Cu.import("resource:///modules/xmpp-commands.jsm", this);
+  ChromeUtils.import("resource:///modules/xmpp-commands.jsm", this);
   this.registerCommands();
 }
 XMPPProtocol.prototype = {
   __proto__: GenericProtocolPrototype,
   get normalizedName() { return "jabber"; },
   get name() { return "XMPP"; },
   get iconBaseURI() { return "chrome://prpl-jabber/skin/"; },
   getAccount: function(aImAccount) { return new XMPPAccount(this, aImAccount); },
--- a/chat/protocols/xmpp/xmpp.jsm
+++ b/chat/protocols/xmpp/xmpp.jsm
@@ -6,30 +6,30 @@ this.EXPORTED_SYMBOLS = [
   "XMPPConversationPrototype",
   "XMPPMUCConversationPrototype",
   "XMPPAccountBuddyPrototype",
   "XMPPAccountPrototype"
 ];
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/imStatusUtils.jsm");
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/jsProtoHelper.jsm");
-Cu.import("resource:///modules/NormalizedMap.jsm");
-Cu.import("resource:///modules/socket.jsm");
-Cu.import("resource:///modules/xmpp-xml.jsm");
-Cu.import("resource:///modules/xmpp-session.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imStatusUtils.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource:///modules/NormalizedMap.jsm");
+ChromeUtils.import("resource:///modules/socket.jsm");
+ChromeUtils.import("resource:///modules/xmpp-xml.jsm");
+ChromeUtils.import("resource:///modules/xmpp-session.jsm");
 
-XPCOMUtils.defineLazyModuleGetter(this, "DownloadUtils",
+ChromeUtils.defineModuleGetter(this, "DownloadUtils",
   "resource://gre/modules/DownloadUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
+ChromeUtils.defineModuleGetter(this, "FileUtils",
   "resource://gre/modules/FileUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
+ChromeUtils.defineModuleGetter(this, "NetUtil",
   "resource://gre/modules/NetUtil.jsm");
 XPCOMUtils.defineLazyServiceGetter(this, "imgTools",
                                    "@mozilla.org/image/tools;1",
                                    "imgITools");
 XPCOMUtils.defineLazyServiceGetter(this, "UuidGenerator",
                                    "@mozilla.org/uuid-generator;1",
                                    "nsIUUIDGenerator");
 
--- a/chat/protocols/yahoo/yahoo.js
+++ b/chat/protocols/yahoo/yahoo.js
@@ -1,16 +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/. */
 
 var {interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "_", () =>
   l10nHelper("chrome://chat/locale/yahoo.properties")
 );
 
 function YahooAccount(aProtoInstance, aImAccount)
 {
   this._init(aProtoInstance, aImAccount);
--- a/im/components/contentHandler.js
+++ b/im/components/contentHandler.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/. */
 
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 var Ci = Components.interfaces;
 var Cc = Components.classes;
 var Cr = Components.results;
 
 // defined in nsIContentHandler.idl.
 var NS_ERROR_WONT_HANDLE_CONTENT = 0x805d0001;
 
--- a/im/components/ibCommandLineHandler.js
+++ b/im/components/ibCommandLineHandler.js
@@ -1,16 +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/. */
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/ibCore.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/ibCore.jsm");
 
 function ibCommandLineHandler() { }
 
 ibCommandLineHandler.prototype = {
   handle: function clh_handle(cmdLine) {
     if (cmdLine.handleFlag("preferences", false)) {
       Core.showPreferences();
       cmdLine.preventDefault = true;
--- a/im/components/ibConvStatsService.js
+++ b/im/components/ibConvStatsService.js
@@ -1,17 +1,17 @@
 /* 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/. */
 
 var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource://gre/modules/Task.jsm")
-Cu.import("resource://gre/modules/osfile.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource://gre/modules/Task.jsm")
+ChromeUtils.import("resource://gre/modules/osfile.jsm");
 
 var kNotificationsToObserve =
   ["contact-added", "contact-removed","contact-status-changed",
    "contact-display-name-changed", "contact-no-longer-dummy",
    "contact-preferred-buddy-changed", "contact-moved",
    "account-connected", "account-disconnected", "new-conversation",
    "new-text", "conversation-closed", "prpl-quit"];
 
--- a/im/components/ibDockBadge.js
+++ b/im/components/ibDockBadge.js
@@ -1,15 +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/. */
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(this, "MacDock",
                                    "@mozilla.org/widget/macdocksupport;1",
                                    "nsIMacDockSupport");
 
 function DockBadge() { }
 DockBadge.prototype = {
   _badgeTimer: null,
--- a/im/components/ibStatusCommandLineHandler.js
+++ b/im/components/ibStatusCommandLineHandler.js
@@ -1,17 +1,17 @@
 /* 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/. */
 
 var {interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/imStatusUtils.jsm");
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imStatusUtils.jsm");
 
 function StatusCLH() { }
 StatusCLH.prototype = {
   classDescription: "Instantbird Status Commandline Handler Component",
   classID:          Components.ID("{9da72063-b727-488d-9b3f-cc12e854ab33}"),
   contractID:       "@instantbird.org/status/clh;1",
   QueryInterface:   XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
 
--- a/im/components/mintrayr/content/mintrayr.js
+++ b/im/components/mintrayr/content/mintrayr.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/. */
 
-Components.utils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
 
 var gMinTrayR = {
   trayService: null,
   _prefs: null,
   get menu() { return document.getElementById("MinTrayR_context"); },
 
   load: function() {
     window.addEventListener("unload",
--- a/im/components/profileMigrator.js
+++ b/im/components/profileMigrator.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/. */
 
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 var Cc = Components.classes;
 var Ci = Components.interfaces;
 
 function InstantbirdProfileMigrator() { }
 
 InstantbirdProfileMigrator.prototype = {
   import: function() {
     var root = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties)
--- a/im/content/account.js
+++ b/im/content/account.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/. */
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-Cu.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var autoJoinPref = "autoJoin";
 
 var account = {
   onload: function account_onload() {
     this.account = window.arguments[0];
     this.proto = this.account.protocol;
     document.getElementById("accountName").value = this.account.name;
--- a/im/content/accountWizard.js
+++ b/im/content/accountWizard.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/. */
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-Cu.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
 
 var PREF_EXTENSIONS_GETMOREPROTOCOLSURL = "extensions.getMoreProtocolsURL";
 
 var accountWizard = {
   onload: function aw_onload() {
     let topProtoList = document.getElementById("topprotolist");
     let bundle = document.getElementById("topProtocolsBundle");
     let topProtocols = bundle.getString("topProtocol.list").split(",");
--- a/im/content/accounts.js
+++ b/im/content/accounts.js
@@ -1,15 +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/. */
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource://gre/modules/DownloadUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource://gre/modules/DownloadUtils.jsm");
 
 // This is the list of notifications that the account manager window observes
 var events = [
   "prpl-quit",
   "account-list-updated",
   "account-added",
   "account-updated",
   "account-removed",
@@ -255,17 +255,17 @@ var gAccountManager = {
              " " + m.sourceName + ":" + m.lineNumber + ")\n" +
              m.errorMessage;
     }).join("\n");
     Cc["@mozilla.org/widget/clipboardhelper;1"]
       .getService(Ci.nsIClipboardHelper).copyString(text);
   },
   showDebugLog: function am_showDebugLog() {
     if (!("Core" in window))
-      Cu.import("resource:///modules/ibCore.jsm");
+      ChromeUtils.import("resource:///modules/ibCore.jsm");
     Core.showDebugLog(this.accountList.selectedItem.account.id);
   },
   updateConnectedLabels: function am_updateConnectedLabels() {
     for (let i = 0; i < gAccountManager.accountList.itemCount; ++i) {
       let item = gAccountManager.accountList.getItemAtIndex(i);
       if (item.account.connected)
         item.refreshConnectedLabel();
     }
@@ -520,17 +520,17 @@ var gAccountManager = {
         label = bundle.getString("accountsManager.notification.crash.label");
         priority = box.PRIORITY_WARNING_MEDIUM;
         break;
 
       /* One or more accounts made the application crash during their connection.
          If none, this function has already returned */
       case as.AUTOLOGIN_ENABLED:
         if (!("PluralForm" in window))
-          Cu.import("resource://gre/modules/PluralForm.jsm");
+          ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
         label = bundle.getString("accountsManager.notification.singleCrash.label");
         label = PluralForm.get(crashCount, label).replace("#1", crashCount);
         priority = box.PRIORITY_WARNING_MEDIUM;
         connectNowButton.callback = this.processCrashedAccountsLogin;
         break;
 
       default:
         label = bundle.getString("accountsManager.notification.other.label");
--- a/im/content/blist.js
+++ b/im/content/blist.js
@@ -1,17 +1,17 @@
 /* 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/. */
 
 var Cu = Components.utils;
 
-Cu.import("resource:///modules/imStatusUtils.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
+ChromeUtils.import("resource:///modules/imStatusUtils.jsm");
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
 
 var events = ["buddy-authorization-request",
                 "buddy-authorization-request-canceled",
                 "contact-availability-changed",
                 "contact-added",
                 "contact-tag-added",
                 "contact-tag-removed",
                 "showing-ui-conversation",
@@ -48,17 +48,17 @@ function buddyListContextMenu(aXulMenu) 
   [ "context-edit-buddy-separator",
     "context-alias",
     "context-delete",
     "context-tags"
   ].forEach(function (aId) {
     document.getElementById(aId).hidden = hide;
   });
   if (!hide) {
-    Components.utils.import("resource:///modules/ibTagMenu.jsm");
+    ChromeUtils.import("resource:///modules/ibTagMenu.jsm");
     this.tagMenu = new TagMenu(this, window, "context-tags",
                                this.toggleTag, this.addTag,
                                this.onBuddy ? this.target.contact : this.target);
   }
 
   document.getElementById("context-hide-tag").hidden = !this.onGroup;
 
   document.getElementById("context-visible-tags").hidden =
@@ -462,17 +462,17 @@ var buddyList = {
       if (elt.hasAttribute("usingDefault")) {
         if ("_statusTypeBeforeEditing" in this &&
             this._statusTypeBeforeEditing == "offline")
           elt.setAttribute("value", Services.core.globalUserStatus.statusText);
         else
           elt.removeAttribute("value");
       }
       if (!("TextboxSpellChecker" in window))
-        Components.utils.import("resource:///modules/imTextboxUtils.jsm");
+        ChromeUtils.import("resource:///modules/imTextboxUtils.jsm");
       TextboxSpellChecker.registerTextbox(elt);
       // force binding attachment by forcing layout
       elt.getBoundingClientRect();
       elt.select();
     }
 
     this.statusMessageRefreshTimer();
   },
@@ -853,17 +853,17 @@ var buddyList = {
     buddyList.convBox.listedConvs = {};
     buddyList.convBox._updateListConvCount = function() {
       let count = Object.keys(this.listedConvs).length;
       this.parentNode.setAttribute("listedConvCount", count);
     }.bind(buddyList.convBox);
     let convs = Services.conversations.getUIConversations();
     if (convs.length != 0) {
       if (!("Conversations" in window))
-        Components.utils.import("resource:///modules/imWindows.jsm");
+        ChromeUtils.import("resource:///modules/imWindows.jsm");
       convs.sort((a, b) =>
         a.title.toLowerCase().localeCompare(b.title.toLowerCase()));
       for (let conv of convs) {
         if (!Conversations.isUIConversationDisplayed(conv)) {
           let convElt = document.createElement("conv");
           buddyList.convBox.appendChild(convElt);
           convElt.build(conv);
         }
--- a/im/content/buddy.xml
+++ b/im/content/buddy.xml
@@ -141,17 +141,17 @@
        ]]>
       </body>
      </method>
 
      <method name="openConversation">
       <body>
        <![CDATA[
          if (!("Conversations" in window))
-           Components.utils.import("resource:///modules/imWindows.jsm");
+           ChromeUtils.import("resource:///modules/imWindows.jsm");
          Conversations.focusConversation(this.buddy.createConversation());
        ]]>
       </body>
      </method>
 
      <method name="_DragOk">
       <parameter name="aEvent"/>
       <body>
--- a/im/content/contact.xml
+++ b/im/content/contact.xml
@@ -361,17 +361,17 @@
        ]]>
       </body>
      </method>
 
      <method name="openConversation">
       <body>
        <![CDATA[
          if (!("Conversations" in window))
-           Components.utils.import("resource:///modules/imWindows.jsm");
+           ChromeUtils.import("resource:///modules/imWindows.jsm");
          Conversations.focusConversation(this.contact.createConversation());
        ]]>
       </body>
      </method>
 
      <method name="keyPress">
       <parameter name="aEvent"/>
       <body>this._keyPress(aEvent);</body>
--- a/im/content/conv.xml
+++ b/im/content/conv.xml
@@ -134,27 +134,27 @@
       ]]>
       </body>
      </method>
 
      <method name="openConversation">
       <body>
        <![CDATA[
          if (!("Conversations" in window))
-           Components.utils.import("resource:///modules/imWindows.jsm");
+           ChromeUtils.import("resource:///modules/imWindows.jsm");
          Conversations.focusConversation(this.conv.target);
        ]]>
       </body>
      </method>
 
      <method name="closeConversation">
       <body>
        <![CDATA[
          if (!("Conversations" in window))
-           Components.utils.import("resource:///modules/imWindows.jsm");
+           ChromeUtils.import("resource:///modules/imWindows.jsm");
          Conversations.forgetHiddenConversation(this.conv);
          this.conv.close();
        ]]>
       </body>
      </method>
 
      <method name="keyPress">
       <parameter name="aEvent"/>
--- a/im/content/conversation.xml
+++ b/im/content/conversation.xml
@@ -481,17 +481,17 @@
       </method>
 
       <method name="initTextboxFormat">
         <body>
         <![CDATA[
           let textbox = this.editor;
 
           if (!("MessageFormat" in window))
-            Components.utils.import("resource:///modules/imTextboxUtils.jsm");
+            ChromeUtils.import("resource:///modules/imTextboxUtils.jsm");
           MessageFormat.registerTextbox(textbox);
 
           // Init the textbox size
           this.calculateTextboxDefaultHeight();
           textbox.parentNode.height = textbox.defaultHeight +
                                       this._TEXTBOX_VERTICAL_OVERHEAD;
           textbox.inputField.style.overflowY = "hidden";
 
@@ -1591,17 +1591,17 @@
               let id = "contextAddContact";
               menu.setAttribute("id", id)
               menu.setAttribute("label", bundle.GetStringFromName(id + ".label"));
               menu.setAttribute("accesskey",
                                 bundle.GetStringFromName(id + ".accesskey"));
               let conv = this._conv;
               let addContact = aTag => conv.account.addBuddy(aTag, conv.name);
               menu.actionOnShowing = function() {
-                Components.utils.import("resource:///modules/ibTagMenu.jsm");
+                ChromeUtils.import("resource:///modules/ibTagMenu.jsm");
                 menu.tagMenu =
                   new TagMenu(menu, window, id, addContact, addContact);
               };
               items.push(menu);
             }
 
             let showLogsItem = createMenuItem("contextShowLogs", () => conv.showLogs());
             // Start disabled, then enable if we have logs.
@@ -1847,17 +1847,17 @@
           if (this.tab) {
             this.tab.setAttribute("label", this._conv.title);
             this.tab.setAttribute("tooltip", "imTooltip");
           }
 
           this.findbar.browser = this.browser;
 
           if (!("Status" in window))
-            Components.utils.import("resource:///modules/imStatusUtils.jsm");
+            ChromeUtils.import("resource:///modules/imStatusUtils.jsm");
           this.updateConvStatus();
           this.initTextboxFormat();
         ]]>
         </body>
       </method>
 
       <!-- nsIObserver implementation -->
       <method name="observe">
@@ -1868,17 +1868,17 @@
         <![CDATA[
           if (aTopic == "conversation-loaded") {
             if (aSubject != this.browser)
               return;
 
             this.browser.progressBar = this.getElt("browserProgress");
 
             if (!("Interruptions" in window))
-              Components.utils.import("resource:///modules/ibInterruptions.jsm");
+              ChromeUtils.import("resource:///modules/ibInterruptions.jsm");
 
             // Display all queued messages. Use a timeout so that message text
             // modifiers can be added with observers for this notification.
             if (!this.loaded)
               setTimeout(this._showFirstMessages.bind(this), 0);
 
             Services.obs.removeObserver(this, "conversation-loaded");
             return;
@@ -2091,17 +2091,17 @@
               .addEventListener("click", this.startEditTopic.bind(this));
           // Cancel any ongoing edit if the binding changes.
           this.editing = false;
 
           if (navigator.platform.includes("Mac")) {
             if ("draghandle" in this)
               return;
             if (!("WindowDraggingElement" in window))
-              Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm");
+              ChromeUtils.import("resource://gre/modules/WindowDraggingUtils.jsm");
             this.draghandle = new WindowDraggingElement(this, window);
           }
         ]]>
       </constructor>
 
       <property name="topic">
         <getter>
         <![CDATA[
--- a/im/content/debug/fake/fake.js
+++ b/im/content/debug/fake/fake.js
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; 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/. */
 
 
-Components.utils.import("resource:///modules/imXPCOMUtils.jsm");
-Components.utils.import("resource:///modules/jsProtoHelper.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm");
 
 var away = Ci.imIStatusInfo.STATUS_AWAY;
 var idle = Ci.imIStatusInfo.STATUS_IDLE;
 var mobile = Ci.imIStatusInfo.STATUS_MOBILE;
 
 var flo_img_url = 'data:image/jpeg;base64,' +
   '/9j/4AAQSkZJRgABAQAAAQABAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBF' +
   'RyB2NjIpLCBxdWFsaXR5ID0gOTUK/9sAQwACAQEBAQECAQEBAgICAgIEAwICAgIFBAQDBAYFBgYGBQYG' +
--- a/im/content/debugLogPanel.xml
+++ b/im/content/debugLogPanel.xml
@@ -65,17 +65,17 @@
       <!-- This method populates the list of accounts and ensures the specified
            account is selected. Since the _inited flag is set here before returning,
            no debug log will be shown. -->
       <method name="initAccountList">
         <parameter name="aAccountId"/>
         <body>
         <![CDATA[
           if (!("Services" in window))
-            Components.utils.import("resource:///modules/imServices.jsm");
+            ChromeUtils.import("resource:///modules/imServices.jsm");
           let accounts = Services.accounts.getAccounts();
           while (accounts.hasMoreElements()) {
             let acc = accounts.getNext();
             var proto = acc.protocol;
             var item = this.accountList.appendItem(acc.name, acc.id, proto.name);
             item.setAttribute("image", proto.iconBaseURI + "icon.png");
             item.setAttribute("class", "menuitem-iconic");
             let accId = acc.id;
--- a/im/content/extensions-discover.js
+++ b/im/content/extensions-discover.js
@@ -1,15 +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/. */
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var defaultOpen = window.open;
 window.open = function(aUrl) {
   let uri = Services.io.newURI(aUrl);
 
   // http and https are the only schemes that are exposed even
   // though we don't handle them internally.
   if (!uri.schemeIs("http") && !uri.schemeIs("https"))
--- a/im/content/extensions.js
+++ b/im/content/extensions.js
@@ -1,17 +1,17 @@
 /* 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/. */
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/AddonManager.jsm");
-Cu.import("resource://gre/modules/PluralForm.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
+ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
 
 var addonsRegister = {
   onload: function () {
     Services.obs.addObserver(addonsRegister, "addon-install-disabled");
     Services.obs.addObserver(addonsRegister, "addon-install-blocked");
     Services.obs.addObserver(addonsRegister, "addon-install-failed");
     Services.obs.addObserver(addonsRegister, "addon-install-complete");
 
--- a/im/content/instantbird.js
+++ b/im/content/instantbird.js
@@ -1,22 +1,20 @@
 /* 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/. */
 
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
-                                  "resource://gre/modules/AppConstants.jsm");
+ChromeUtils.defineModuleGetter(this, "AppConstants",
+                               "resource://gre/modules/AppConstants.jsm");
 
 var TAB_DROP_TYPE = "application/x-moz-tabbrowser-tab";
 
 var convWindow = {
   load: function mo_load() {
-    Components.utils.import("resource:///modules/imWindows.jsm");
+    ChromeUtils.import("resource:///modules/imWindows.jsm");
     Conversations.registerWindow(window);
 
     if ("arguments" in window) {
       while (window.arguments[0] &&
              window.arguments[0] instanceof XULElement) {
         // swap the given tab with the default dummy conversation tab
         // and then close the original tab in the other window.
         let tab = window.arguments.shift();
--- a/im/content/joinchat.js
+++ b/im/content/joinchat.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/. */
 
-Components.utils.import("resource:///modules/imWindows.jsm");
+ChromeUtils.import("resource:///modules/imWindows.jsm");
 
 var autoJoinPref = "autoJoin";
 
 var joinChat = {
   onload: function jc_onload() {
     var accountList = document.getElementById("accountlist");
     for (let acc of getIter(Services.accounts.getAccounts())) {
       if (!acc.connected || !acc.canJoinChat)
--- a/im/content/menus.js
+++ b/im/content/menus.js
@@ -2,19 +2,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/. */
 
 var addBuddyWindow = "chrome://instantbird/content/addbuddy.xul";
 var joinChatWindow = "chrome://instantbird/content/joinchat.xul";
 var aboutWindow = "chrome://instantbird/content/aboutDialog.xul";
 
 if (!("Services" in window))
-  Components.utils.import("resource:///modules/imServices.jsm");
+  ChromeUtils.import("resource:///modules/imServices.jsm");
 if (!("Core" in window))
-  Components.utils.import("resource:///modules/ibCore.jsm");
+  ChromeUtils.import("resource:///modules/ibCore.jsm");
 
 var menus = {
   supportsCommand: aCmd =>
     aCmd == "cmd_addbuddy" || aCmd == "cmd_joinchat" || aCmd == "cmd_newtab",
   isCommandEnabled: function(aCmd) {
     let enumerator = Services.accounts.getAccounts();
     while (enumerator.hasMoreElements()) {
       let acc = enumerator.getNext();
@@ -26,17 +26,17 @@ var menus = {
   },
   doCommand: function(aCmd) {
     if (aCmd == "cmd_joinchat")
       this.joinChat();
     else if (aCmd == "cmd_addbuddy")
       this.addBuddy();
     else if (aCmd == "cmd_newtab") {
       if (!("Conversations" in window))
-        Components.utils.import("resource:///modules/imWindows.jsm");
+        ChromeUtils.import("resource:///modules/imWindows.jsm");
       Conversations.showNewTab();
     }
   },
   onEvent: function(aEventName) {},
 
   about: function menu_about() {
     Core.showWindow("Messenger:About", aboutWindow, "About",
                     "chrome,resizable=no,minimizable=no,centerscreen");
@@ -50,17 +50,17 @@ var menus = {
     Core.showPreferences();
   },
 
   addons: function menu_addons() {
     Core.showAddons();
   },
 
   errors: function debug_errors() {
-    let { require } = Components.utils.import("resource://devtools/shared/Loader.jsm", {});
+    let { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
     let { HUDService } = require("devtools/client/webconsole/hudservice");
     HUDService.openBrowserConsoleOrFocus();
   },
 
   updates: function menu_updates() {
     Core.showUpdates();
   },
 
@@ -143,17 +143,17 @@ var menus = {
   },
 
   joinChat: function menu_joinChat() {
     this.openDialog("Messenger:JoinChat", joinChatWindow);
   },
 
   checkCurrentStatusType: function menu_checkCurrentStatusType(aItems) {
     if (!("Status" in window))
-      Components.utils.import("resource:///modules/imStatusUtils.jsm");
+      ChromeUtils.import("resource:///modules/imStatusUtils.jsm");
     let status = Status.toAttribute(Services.core.globalUserStatus.statusType);
     if (status == "away")
       status = "unavailable";
 
     aItems.forEach(function (aId) {
       let elt = document.getElementById(aId);
       if (elt.getAttribute("status") == status)
         elt.setAttribute("checked", "true");
--- a/im/content/newtab.xml
+++ b/im/content/newtab.xml
@@ -492,17 +492,17 @@
         <![CDATA[
           this.target = aTarget;
           this.setAttribute("displayName", aTarget.displayName);
           let source = aTarget.source;
           this.setAttribute("source", source);
           // Could be an existing conversation or a contact.
           if (source != "chat") {
             if (!("Status" in window))
-              Components.utils.import("resource:///modules/imStatusUtils.jsm");
+              ChromeUtils.import("resource:///modules/imStatusUtils.jsm");
             this.setAttribute("status", Status.toAttribute(aTarget.statusType));
           }
           else
             this.removeAttribute("status");
           // Could be a new chat or an existing chat conversation.
           if (aTarget.isChat)
             this.setAttribute("chat", true);
           else
--- a/im/content/nsContextMenu.js
+++ b/im/content/nsContextMenu.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/. */
 
-Components.utils.import("resource:///modules/ibTagMenu.jsm");
+ChromeUtils.import("resource:///modules/ibTagMenu.jsm");
 
 var gContextMenu = null;
 
 function nsContextMenu(aXulMenu, aBrowser) {
   this.target            = null;
   this.browser           = null;
   this.conv              = null;
   this.menu              = null;
--- a/im/content/preferences/advanced.js
+++ b/im/content/preferences/advanced.js
@@ -1,19 +1,19 @@
 # -*- indent-tabs-mode: nil; js-indent-level: 4 -*-
 # 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/.
 
 // Load DownloadUtils module for convertByteUnits
-Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
-Components.utils.import("resource://gre/modules/ctypes.jsm");
-Components.utils.import("resource://gre/modules/Services.jsm");
-Components.utils.import("resource://gre/modules/LoadContextInfo.jsm");
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+ChromeUtils.import("resource://gre/modules/DownloadUtils.jsm");
+ChromeUtils.import("resource://gre/modules/ctypes.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/LoadContextInfo.jsm");
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 var gAdvancedPane = {
   _inited: false,
 
   /**
    * Brings the appropriate tab to the front and initializes various bits of UI.
    */
   init: function ()
--- a/im/content/preferences/main.js
+++ b/im/content/preferences/main.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/. */
 
 if (!("Core" in window))
-  Components.utils.import("resource:///modules/ibCore.jsm");
+  ChromeUtils.import("resource:///modules/ibCore.jsm");
 
 var gMainPane = {
   _pane: null,
 
   /**
    * Initialization of this.
    */
   init: function ()
--- a/im/content/preferences/messagestyle.js
+++ b/im/content/preferences/messagestyle.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/. */
 
 var jsProtoHelper = {};
-Components.utils.import("resource:///modules/jsProtoHelper.jsm", jsProtoHelper);
+ChromeUtils.import("resource:///modules/jsProtoHelper.jsm", jsProtoHelper);
 
 function Conversation(aName) {
   this._name = aName;
   this._observers = [];
   let now = new Date();
   this._date = new Date(now.getFullYear(), now.getMonth(), now.getDate(),
                         10, 42, 22) * 1000;
 }
--- a/im/content/preferences/privacy.js
+++ b/im/content/preferences/privacy.js
@@ -1,14 +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/. */
 
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "LoginHelper", "resource://gre/modules/LoginHelper.jsm");
+ChromeUtils.defineModuleGetter(this, "LoginHelper", "resource://gre/modules/LoginHelper.jsm");
 
 var gPrivacyPane = {
   init: function ()
   {
     this.updateDisabledState();
     this._initMasterPasswordUI();
   },
 
--- a/im/content/preferences/smileys.js
+++ b/im/content/preferences/smileys.js
@@ -1,16 +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/. */
 
 var smileysPreview = {
   _loaded: false,
   load: function() {
-    Components.utils.import("resource:///modules/imSmileys.jsm");
+    ChromeUtils.import("resource:///modules/imSmileys.jsm");
 
     gThemePane.buildThemeList("emoticons");
     let themeName = document.getElementById("emoticons-themename");
     // force the setter to execute again now that the menuitem exists
     themeName.value = themeName.value;
     this._loaded = true;
     this.displayCurrentTheme();
   },
--- a/im/content/preferences/themes.js
+++ b/im/content/preferences/themes.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/. */
 
-Components.utils.import("resource://gre/modules/AddonManager.jsm");
+ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
 
 var PREF_EXTENSIONS_GETMOREMESSAGESTYLESURL = "extensions.getMoreMessageStylesURL";
 var PREF_EXTENSIONS_GETMOREEMOTICONSURL     = "extensions.getMoreEmoticonsURL";
 
 var gThemePane = {
   init: function (){
     AddonManager.getAllAddons(function(aAddons) {
       gThemePane.extensionList = aAddons;
--- a/im/content/tabbrowser.xml
+++ b/im/content/tabbrowser.xml
@@ -549,17 +549,17 @@
             Services.prefs.getBoolPref("messenger.conversations.alwaysClose") &&
             Services.prefs.getBoolPref(pref);
 
           if (shouldPrompt) {
             //default to true: if it were false, we wouldn't get this far
             var warnOnClose = { value:true };
             var bundle = this.mStringBundle;
             if (!("PluralForm" in window))
-              Components.utils.import("resource://gre/modules/PluralForm.jsm");
+              ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
             var promptMessage = PluralForm.get(unreadConvsCount, bundle.getString("tabs.closeWarningMessage"))
                                           .replace("#1", unreadConvsCount);
             var closeButton = PluralForm.get(unreadConvsCount, bundle.getString("tabs.closeButton"));
             // focus the window before prompting.
             // this will raise any minimized window, which will
             // make it obvious which window the prompt is for and will
             // solve the problem of windows "obscuring" the prompt.
             // see bug #350299 for more details
@@ -1714,17 +1714,17 @@
 
           pb2.addObserver("browser.tabs.closeButtons",
                           this._prefObserver);
 
           window.addEventListener("resize", this);
 #ifdef XP_MACOSX
 
           if (!("WindowDraggingElement" in window))
-            Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm");
+            ChromeUtils.import("resource://gre/modules/WindowDraggingUtils.jsm");
           let draghandle = new WindowDraggingElement(this.arrowScrollbox, window);
           draghandle.mouseDownCheck =
             aEvent => aEvent.originalTarget.localName != "tab";
 #endif
         ]]>
       </constructor>
 
       <destructor>
--- a/im/content/utilities.js
+++ b/im/content/utilities.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/. */
 
 var Cc = Components.classes;
 var Ci = Components.interfaces;
-Components.utils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
 
 function* getIter(aEnumerator)
 {
   while (aEnumerator.hasMoreElements())
     yield aEnumerator.getNext();
 }
--- a/im/content/viewlog.js
+++ b/im/content/viewlog.js
@@ -1,15 +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/. */
 
 var Cu = Components.utils;
 
-Cu.import("resource://gre/modules/Services.jsm");
+ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 // viewZoomOverlay.js and macgestures.js use this.
 function getBrowser() {
   let deck = document.getElementById("browserDeck");
   let id = (parseInt(deck.selectedIndex, 10) ? "conv" : "text") + "-browser";
   let browser = document.getElementById(id);
   browser.selectedBrowser = browser; // for macgestures.js
   return browser;
@@ -170,17 +170,17 @@ var logWindow = {
 
     let elt = doc.getElementsByTagName("pre")[0].firstChild;
     if (!elt) {
       // Text log file is empty.
       document.getElementById("browserDeck").selectedIndex = 2;
       return;
     }
     if (!("smileTextNode" in window))
-      Cu.import("resource:///modules/imSmileys.jsm");
+      ChromeUtils.import("resource:///modules/imSmileys.jsm");
     smileTextNode(elt);
   }
 };
 
 function chatLogTreeGroupItem(aTitle, aLogItems) {
   this._title = aTitle;
   this._children = aLogItems;
   for (let child of this._children)
--- a/im/modules/ibCore.jsm
+++ b/im/modules/ibCore.jsm
@@ -1,20 +1,20 @@
 /* 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/. */
 
 this.EXPORTED_SYMBOLS = ["Core"];
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/imWindows.jsm");
-Cu.import("resource:///modules/ibNotifications.jsm");
-Cu.import("resource:///modules/ibSounds.jsm");
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imWindows.jsm");
+ChromeUtils.import("resource:///modules/ibNotifications.jsm");
+ChromeUtils.import("resource:///modules/ibSounds.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
 
 var Core = {
   _events: [
     "account-disconnected",
     "browser-request",
     "handle-xul-text-link",
     "quit-application-requested",
     "quit-application-granted"
@@ -81,17 +81,17 @@ var Core = {
     Notifications.init();
     Sounds.init();
 #ifdef XP_WIN
     // For windows seven, initialize the jump list module.
     const WINTASKBAR_CONTRACTID = "@mozilla.org/windows-taskbar;1";
     if (WINTASKBAR_CONTRACTID in Cc &&
         Cc[WINTASKBAR_CONTRACTID].getService(Ci.nsIWinTaskbar).available) {
       let temp = {};
-      Cu.import("resource:///modules/ibWinJumpList.jsm", temp);
+      ChromeUtils.import("resource:///modules/ibWinJumpList.jsm", temp);
       temp.WinJumpList.init();
     }
 #endif
 
     this._events.forEach(function (aTopic) {
       Services.obs.addObserver(Core, aTopic);
     });
 
@@ -331,17 +331,17 @@ var Core = {
     let bundle =
       Services.strings.createBundle("chrome://instantbird/locale/quitDialog.properties");
     let promptTitle    = bundle.GetStringFromName("dialogTitle");
     let promptMessage  = bundle.GetStringFromName("message");
     let promptCheckbox = bundle.GetStringFromName("checkbox");
     let action         = aQuitType == "restart" ? "restart" : "quit";
     let button         = bundle.GetStringFromName(action + "Button");
 
-    Components.utils.import("resource://gre/modules/PluralForm.jsm");
+    ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
     promptMessage = PluralForm.get(unreadConvsCount, promptMessage)
                               .replace("#1", unreadConvsCount);
 
     let prompts = Services.prompt;
     let flags = prompts.BUTTON_TITLE_IS_STRING * prompts.BUTTON_POS_0 +
                 prompts.BUTTON_TITLE_CANCEL * prompts.BUTTON_POS_1 +
                 prompts.BUTTON_POS_1_DEFAULT;
     let checkbox = {value: false};
--- a/im/modules/ibNotifications.jsm
+++ b/im/modules/ibNotifications.jsm
@@ -1,18 +1,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/. */
 
 this.EXPORTED_SYMBOLS = ["Notifications"];
 
-Components.utils.import("resource:///modules/imServices.jsm");
-Components.utils.import("resource:///modules/imWindows.jsm");
-Components.utils.import("resource:///modules/hiddenWindow.jsm");
-Components.utils.import("resource:///modules/ibInterruptions.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imWindows.jsm");
+ChromeUtils.import("resource:///modules/hiddenWindow.jsm");
+ChromeUtils.import("resource:///modules/ibInterruptions.jsm");
 
 var Notifications = {
   get ellipsis () {
     let ellipsis = "[\u2026]";
 
     try {
       ellipsis =
         Services.prefs.getComplexValue("intl.ellipsis",
--- a/im/modules/ibSounds.jsm
+++ b/im/modules/ibSounds.jsm
@@ -1,17 +1,17 @@
 /* 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/. */
 
 this.EXPORTED_SYMBOLS = ["Sounds"];
 
-Components.utils.import("resource:///modules/hiddenWindow.jsm");
-Components.utils.import("resource:///modules/imServices.jsm");
-Components.utils.import("resource:///modules/ibInterruptions.jsm");
+ChromeUtils.import("resource:///modules/hiddenWindow.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/ibInterruptions.jsm");
 
 var Sounds = {
   soundEvents: ["contact-signed-on", "contact-signed-off", "new-text"],
   soundFiles: {
     incoming: "chrome://instantbird-sounds/skin/receive.wav",
     outgoing: "chrome://instantbird-sounds/skin/send.wav",
     login: "chrome://instantbird-sounds/skin/login.wav",
     logout: "chrome://instantbird-sounds/skin/logout.wav",
--- a/im/modules/ibTagMenu.jsm
+++ b/im/modules/ibTagMenu.jsm
@@ -1,17 +1,17 @@
 /* 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/. */
 
 this.EXPORTED_SYMBOLS = ["TagMenu"];
 
 var Cu = Components.utils;
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/imXPCOMUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imXPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "_", () =>
   l10nHelper("chrome://instantbird/locale/instantbird.properties")
 );
 
 // aOnTag and aOnAddTag will be called with aParent as the this value.
 // If a contact binding is given in aTarget, the menu checkmarks the existing
 // tags on this contact.
--- a/im/modules/ibWinJumpList.jsm
+++ b/im/modules/ibWinJumpList.jsm
@@ -1,18 +1,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/. */
 
 this.EXPORTED_SYMBOLS = ["WinJumpList"];
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
-Cu.import("resource:///modules/imServices.jsm");
-Cu.import("resource:///modules/imStatusUtils.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/imStatusUtils.jsm");
 
 var WinJumpList = {
   winJumpListBuilder: null,
 
   /*
     Jumplist entries can be of the following 'type' (required attribute):
       type: "shortcut"        // nsIJumpListShortcut
         label: <string>,      //  label shown in the jumplist
--- a/im/modules/imWindows.jsm
+++ b/im/modules/imWindows.jsm
@@ -1,17 +1,17 @@
 /* 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/. */
 
 var CONVERSATION_WINDOW_URI = "chrome://instantbird/content/instantbird.xul";
 this.EXPORTED_SYMBOLS = ["Conversations"];
 
-Components.utils.import("resource:///modules/imServices.jsm");
-Components.utils.import("resource:///modules/ibInterruptions.jsm");
+ChromeUtils.import("resource:///modules/imServices.jsm");
+ChromeUtils.import("resource:///modules/ibInterruptions.jsm");
 
 var Conversations = {
   _unreadCount: 0,
   get unreadCount() { return this._unreadCount; },
   set unreadCount(val) {
     if (val == this._unreadCount)
       return val;
     Services.obs.notifyObservers(null, "unread-im-count-changed", val);