Bug 1039586 - Ensure no add-on shim code gets executed when browser.tabs.remote.autostart is false. r=billm,jimm.

--HG--
extra : rebase_source : 9e7b62c32e01698992757cca5b6283ed2aa95f27
extra : histedit_source : 404875166004053aca7ccaa805bc616f8910f143
This commit is contained in:
Mike Conley 2014-07-16 14:13:33 -04:00
parent 6f4d9ae935
commit cfa76f90f4
2 changed files with 21 additions and 5 deletions

View File

@ -89,7 +89,6 @@ let NotificationTracker = {
enumerate(this._paths[component1] || {}, [component1]);
}
};
NotificationTracker.init();
// This code registers an nsIContentPolicy in the child process. When
// it runs, it notifies the parent that it needs to run its own
@ -148,7 +147,6 @@ let ContentPolicyChild = {
return this.QueryInterface(iid);
},
};
ContentPolicyChild.init();
// This code registers observers in the child whenever an add-on in
// the parent asks for notifications on the given topic.
@ -176,7 +174,6 @@ let ObserverChild = {
});
}
};
ObserverChild.init();
// There is one of these objects per browser tab in the child. When an
// add-on in the parent listens for an event, this child object
@ -251,7 +248,20 @@ SandboxChild.prototype = {
};
let RemoteAddonsChild = {
_ready: false,
makeReady: function() {
NotificationTracker.init();
ContentPolicyChild.init();
ObserverChild.init();
},
init: function(global) {
if (!this._ready) {
this.makeReady();
this._ready = true;
}
global.sendAsyncMessage("Addons:RegisterGlobal", {}, {global: global});
let sandboxChild = new SandboxChild(global);

View File

@ -353,8 +353,14 @@ addEventListener("TextZoomChange", function (aEvent) {
}
}, false);
// This needs to be rooted so that it stays alive as long as the tab.
let AddonsChild = RemoteAddonsChild.init(this);
// The AddonsChild needs to be rooted so that it stays alive as long as
// the tab.
let AddonsChild;
if (Services.prefs.getBoolPref("browser.tabs.remote.autostart")) {
// Currently, the addon shims are only supported when autostarting
// with remote tabs.
AddonsChild = RemoteAddonsChild.init(this);
}
addMessageListener("NetworkPrioritizer:AdjustPriority", (msg) => {
let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);