diff --git a/chat/components/src/imAccounts.js b/chat/components/src/imAccounts.js index a9eb6a61cf..7cbdc79f06 100644 --- a/chat/components/src/imAccounts.js +++ b/chat/components/src/imAccounts.js @@ -21,10 +21,6 @@ const kPrefAccountFirstConnectionState = "firstConnectionState"; const kPrefConvertOldPasswords = "messenger.accounts.convertOldPasswords"; const kPrefAccountPassword = "password"; -XPCOMUtils.defineLazyGetter(this, "LoginManager", function() - Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager) -); - XPCOMUtils.defineLazyGetter(this, "_", function() l10nHelper("chrome://chat/locale/accounts.properties") ); @@ -402,7 +398,7 @@ imAccount.prototype = { let passwordURI = "im://" + this.protocol.id; let logins; try { - logins = LoginManager.findLogins({}, passwordURI, null, passwordURI); + logins = Services.logins.findLogins({}, passwordURI, null, passwordURI); } catch (e) { this._handleMasterPasswordException(e); return ""; @@ -443,20 +439,20 @@ imAccount.prototype = { newLogin.init(passwordURI, null, passwordURI, this.normalizedName, aPassword, "", ""); try { - let logins = LoginManager.findLogins({}, passwordURI, null, passwordURI); + let logins = Services.logins.findLogins({}, passwordURI, null, passwordURI); let saved = false; for each (let login in logins) { if (newLogin.matches(login, true)) { if (aPassword) - LoginManager.modifyLogin(login, newLogin); + Services.logins.modifyLogin(login, newLogin); else - LoginManager.removeLogin(login); + Services.logins.removeLogin(login); saved = true; break; } } if (!saved && aPassword) - LoginManager.addLogin(newLogin); + Services.logins.addLogin(newLogin); } catch (e) { this._handleMasterPasswordException(e); } @@ -524,10 +520,10 @@ imAccount.prototype = { // lots of cases this.name is equivalent. let name = this.prplAccount ? this.normalizedName : this.name; login.init(passwordURI, null, passwordURI, name, "", "", ""); - let logins = LoginManager.findLogins({}, passwordURI, null, passwordURI); + let logins = Services.logins.findLogins({}, passwordURI, null, passwordURI); for each (let l in logins) { if (login.matches(l, true)) { - LoginManager.removeLogin(l); + Services.logins.removeLogin(l); break; } } diff --git a/chat/components/src/imContacts.js b/chat/components/src/imContacts.js index 36cbbb0b10..90ca938285 100644 --- a/chat/components/src/imContacts.js +++ b/chat/components/src/imContacts.js @@ -14,9 +14,7 @@ function getDBConnection() let dbFile = Services.dirsvc.get(NS_APP_USER_PROFILE_50_DIR, Ci.nsIFile); dbFile.append("blist.sqlite"); - let conn = - Cc["@mozilla.org/storage/service;1"].getService(Ci.mozIStorageService) - .openDatabase(dbFile); + let conn = Services.storage.openDatabase(dbFile); if (!conn.connectionReady) throw Cr.NS_ERROR_UNEXPECTED; diff --git a/chat/components/src/smileProtocolHandler.js b/chat/components/src/smileProtocolHandler.js index 084b2f4cbb..dd6f201c20 100644 --- a/chat/components/src/smileProtocolHandler.js +++ b/chat/components/src/smileProtocolHandler.js @@ -4,6 +4,7 @@ const {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"); @@ -27,8 +28,7 @@ smileProtocolHandler.prototype = { }, newChannel: function SPH_newChannel(aURI) { let smile = aURI.spec.replace(kSmileRegexp, ""); - let ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); - let channel = ios.newChannel(getSmileRealURI(smile), null, null); + let channel = Services.io.newChannel(getSmileRealURI(smile), null, null); channel.originalURI = aURI; return channel; }, diff --git a/chat/content/convbrowser.xml b/chat/content/convbrowser.xml index f46c8fb42b..2e14368126 100644 --- a/chat/content/convbrowser.xml +++ b/chat/content/convbrowser.xml @@ -617,13 +617,9 @@ if (aTopic != "nsPref:changed") throw "Bad notification"; - var clipboard = - Components.classes["@mozilla.org/widget/clipboard;1"] - .getService(Components.interfaces.nsIClipboard); - if (this.magicCopyEnabled) { this.contentWindow.controllers.insertControllerAt(0, this); - if (clipboard.supportsSelectionClipboard()) { + if (Services.clipboard.supportsSelectionClipboard()) { this.contentWindow.getSelection() .QueryInterface(Components.interfaces.nsISelectionPrivate) .addSelectionListener(this); @@ -631,7 +627,7 @@ } else { this.contentWindow.controllers.removeController(this); - if (clipboard.supportsSelectionClipboard()) { + if (Services.clipboard.supportsSelectionClipboard()) { this.contentWindow.getSelection() .QueryInterface(Components.interfaces.nsISelectionPrivate) .removeSelectionListener(this); @@ -728,10 +724,7 @@ if (this.magicCopyEnabled) { this.contentWindow.controllers.insertControllerAt(0, this); - var clipboard = - Components.classes["@mozilla.org/widget/clipboard;1"] - .getService(Components.interfaces.nsIClipboard); - if (clipboard.supportsSelectionClipboard()) { + if (Services.clipboard.supportsSelectionClipboard()) { this.contentWindow.getSelection() .QueryInterface(Components.interfaces.nsISelectionPrivate) .addSelectionListener(this); @@ -1023,9 +1016,7 @@ if (magicCopyEnabled) { // We need to remove the selection listener (unix only) // before _contentWindow is changed. - var clipboard = Components.classes["@mozilla.org/widget/clipboard;1"] - .getService(Ci.nsIClipboard); - if (clipboard.supportsSelectionClipboard()) { + if (Services.clipboard.supportsSelectionClipboard()) { aOtherBrowser.contentWindow.getSelection() .QueryInterface(Components.interfaces.nsISelectionPrivate) .removeSelectionListener(aOtherBrowser); @@ -1066,7 +1057,7 @@ this.contentWindow.controllers.insertControllerAt(0, this); // and our selection listener! - if (clipboard.supportsSelectionClipboard()) { + if (Services.clipboard.supportsSelectionClipboard()) { this.contentWindow.getSelection() .QueryInterface(Components.interfaces.nsISelectionPrivate) .addSelectionListener(this); diff --git a/chat/modules/hiddenWindow.jsm b/chat/modules/hiddenWindow.jsm index d0dba5f6ac..da1bc4b459 100644 --- a/chat/modules/hiddenWindow.jsm +++ b/chat/modules/hiddenWindow.jsm @@ -4,12 +4,11 @@ const EXPORTED_SYMBOLS = ["getHiddenHTMLWindow"]; +Components.utils.import("resource://gre/modules/Services.jsm"); Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyGetter(this, "hiddenWindow", function() - Components.classes["@mozilla.org/appshell/appShellService;1"] - .getService(Components.interfaces.nsIAppShellService) - .hiddenDOMWindow + Services.appshell.hiddenDOMWindow ); #ifndef XP_MACOSX function getHiddenHTMLWindow() hiddenWindow diff --git a/mail/components/im/content/imAccountWizard.js b/mail/components/im/content/imAccountWizard.js index 1ce5ea7390..397507ef3c 100644 --- a/mail/components/im/content/imAccountWizard.js +++ b/mail/components/im/content/imAccountWizard.js @@ -474,9 +474,7 @@ var accountWizard = { if (Services.prefs.getPrefType(prefURL) != nsIPrefBranch2.PREF_INVALID) { try { - var getMoreURL = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"] - .getService(Components.interfaces.nsIURLFormatter) - .formatURLPref(prefURL); + var getMoreURL = Services.urlFormatter.formatURLPref(prefURL); getMore.setAttribute("getMoreURL", getMoreURL); showGetMore = getMoreURL != "about:blank"; } diff --git a/mail/components/im/content/imcontact.xml b/mail/components/im/content/imcontact.xml index c575eb4eee..b5f7c29cb5 100644 --- a/mail/components/im/content/imcontact.xml +++ b/mail/components/im/content/imcontact.xml @@ -220,11 +220,7 @@ if (!this.hasAttribute("aliasing")) return; - let win = - Components.classes["@mozilla.org/focus-manager;1"] - .getService(Components.interfaces.nsIFocusManager) - .activeWindow; - if (win == document.defaultView) + if (Services.focus.activeWindow == document.defaultView) finishAliasing(true); ]]>