Bug 795152 - Switch to Services.jsm: What's left: chat. r=florian
This commit is contained in:
Родитель
1e94b8152e
Коммит
da5f8b9d00
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
]]>
|
||||
</handler>
|
||||
|
|
Загрузка…
Ссылка в новой задаче