Bug 1402688 - Port part of Bug 1358921. Move LoginManagerParent init code to nsSuiteGlue.js. r=IanN
This commit is contained in:
Родитель
b385dbc498
Коммит
7e05c2708b
|
@ -40,6 +40,40 @@ XPCOMUtils.defineLazyGetter(this, "DebuggerServer", () => {
|
|||
return tmp.require("devtools/server/main").DebuggerServer;
|
||||
});
|
||||
|
||||
const global = this;
|
||||
|
||||
const listeners = {
|
||||
mm: {
|
||||
// PLEASE KEEP THIS LIST IN SYNC WITH THE MOBILE LISTENERS IN nsBrowserGlue.js
|
||||
"RemoteLogins:findLogins": ["LoginManagerParent"],
|
||||
"RemoteLogins:findRecipes": ["LoginManagerParent"],
|
||||
"RemoteLogins:onFormSubmit": ["LoginManagerParent"],
|
||||
"RemoteLogins:autoCompleteLogins": ["LoginManagerParent"],
|
||||
"RemoteLogins:removeLogin": ["LoginManagerParent"],
|
||||
"RemoteLogins:insecureLoginFormPresent": ["LoginManagerParent"],
|
||||
// PLEASE KEEP THIS LIST IN SYNC WITH THE MOBILE LISTENERS IN nsBrowserGlue.js
|
||||
},
|
||||
|
||||
receiveMessage(modules, data) {
|
||||
let val;
|
||||
for (let module of modules[data.name]) {
|
||||
try {
|
||||
val = global[module].receiveMessage(data) || val;
|
||||
} catch (e) {
|
||||
Components.utils.reportError(e);
|
||||
}
|
||||
}
|
||||
return val;
|
||||
},
|
||||
|
||||
init() {
|
||||
let receiveMessageMM = this.receiveMessage.bind(this, this.mm);
|
||||
for (let message of Object.keys(this.mm)) {
|
||||
Services.mm.addMessageListener(message, receiveMessageMM);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// We try to backup bookmarks at idle times, to avoid doing that at shutdown.
|
||||
// Number of idle seconds before trying to backup bookmarks. 15 minutes.
|
||||
const BOOKMARKS_BACKUP_IDLE_TIME = 15 * 60;
|
||||
|
@ -194,7 +228,7 @@ SuiteGlue.prototype = {
|
|||
this._promptForMasterPassword();
|
||||
this._checkForNewAddons();
|
||||
Services.search.init();
|
||||
LoginManagerParent.init();
|
||||
listeners.init();
|
||||
Components.classes["@mozilla.org/globalmessagemanager;1"]
|
||||
.getService(Components.interfaces.nsIMessageListenerManager)
|
||||
.loadFrameScript("chrome://navigator/content/content.js", true);
|
||||
|
|
Загрузка…
Ссылка в новой задаче