Bug 1211401 - Use global message manager as parent of <iframe mozbrowser> MM (r=smaug,ahal)

This commit is contained in:
Bill McCloskey 2015-11-23 16:25:15 -08:00
parent b6740878e7
commit a4a149fd8d
3 changed files with 4 additions and 23 deletions

View File

@ -2583,6 +2583,8 @@ nsFrameLoader::EnsureMessageManager()
if (!parentManager) {
chromeWindow->GetMessageManager(getter_AddRefs(parentManager));
}
} else {
parentManager = do_GetService("@mozilla.org/globalmessagemanager;1");
}
mMessageManager = new nsFrameMessageManager(nullptr,

View File

@ -83,13 +83,7 @@ container.addEventListener('mozbrowsershowmodalprompt', function (e) {
});
if (outOfProcess) {
let specialpowers = {};
let loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserver.jsm", specialpowers);
let specialPowersObserver = new specialpowers.SpecialPowersObserver();
let mm = container.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader.messageManager;
specialPowersObserver.init(mm);
//Workaround for bug 848411, once that bug is fixed, the following line can be removed
function contentScript() {

View File

@ -33,7 +33,6 @@ loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserverAPI.js
/* XPCOM gunk */
this.SpecialPowersObserver = function SpecialPowersObserver() {
this._isFrameScriptLoaded = false;
this._mmIsGlobal = true;
this._messageManager = Cc["@mozilla.org/globalmessagemanager;1"].
getService(Ci.nsIMessageBroadcaster);
}
@ -101,19 +100,14 @@ SpecialPowersObserver.prototype._loadFrameScript = function()
SpecialPowersObserver.prototype._sendAsyncMessage = function(msgname, msg)
{
if (this._mmIsGlobal) {
this._messageManager.broadcastAsyncMessage(msgname, msg);
}
else {
this._messageManager.sendAsyncMessage(msgname, msg);
}
this._messageManager.broadcastAsyncMessage(msgname, msg);
};
SpecialPowersObserver.prototype._receiveMessage = function(aMessage) {
return this._receiveMessageAPI(aMessage);
};
SpecialPowersObserver.prototype.init = function(messageManager)
SpecialPowersObserver.prototype.init = function()
{
var obs = Services.obs;
obs.addObserver(this, "chrome-document-global-created", false);
@ -133,11 +127,6 @@ SpecialPowersObserver.prototype.init = function(messageManager)
obs.addObserver(this, "http-on-modify-request", false);
if (messageManager) {
this._messageManager = messageManager;
this._mmIsGlobal = false;
}
this._loadFrameScript();
};
@ -178,10 +167,6 @@ SpecialPowersObserver.prototype.uninit = function()
this._messageManager.removeDelayedFrameScript(CHILD_SCRIPT);
this._isFrameScriptLoaded = false;
}
this._mmIsGlobal = true;
this._messageManager = Cc["@mozilla.org/globalmessagemanager;1"].
getService(Ci.nsIMessageBroadcaster);
};
SpecialPowersObserver.prototype._addProcessCrashObservers = function() {