Bug 1173451 - RemoteAddonsChild init should be optional. r=mconley

This commit is contained in:
Gabor Krizsanits 2015-07-07 10:56:26 +02:00
parent 33c7024ee2
commit 5a9279d81b
3 changed files with 16 additions and 3 deletions

View File

@ -83,6 +83,10 @@ let NotificationTracker = {
},
findPaths: function(prefix) {
if (!this._paths) {
return [];
}
let tracked = this._paths;
for (let component of prefix) {
tracked = setDefault(tracked, component, {});
@ -524,7 +528,12 @@ let RemoteAddonsChild = {
},
init: function(global) {
if (!this._ready) {
if (!Services.cpmm.initialProcessData.remoteAddonsParentInitted){
return null;
}
this.makeReady();
this._ready = true;
}

View File

@ -960,6 +960,8 @@ let RemoteAddonsParent = {
let mm = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);
mm.addMessageListener("Addons:RegisterGlobal", this);
Services.ppmm.initialProcessData.remoteAddonsParentInitted = true;
this.globalToBrowser = new WeakMap();
this.browserToGlobal = new WeakMap();
},

View File

@ -490,9 +490,11 @@ addMessageListener("Browser:Thumbnail:CheckState", function (aMessage) {
// The AddonsChild needs to be rooted so that it stays alive as long as
// the tab.
let AddonsChild = RemoteAddonsChild.init(this);
addEventListener("unload", () => {
RemoteAddonsChild.uninit(AddonsChild);
});
if (AddonsChild) {
addEventListener("unload", () => {
RemoteAddonsChild.uninit(AddonsChild);
});
}
addMessageListener("NetworkPrioritizer:AdjustPriority", (msg) => {
let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);