mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-27 07:34:20 +00:00
Bug 951895 - Hook up SpecialPowers messagemanager correctly for B2G, r=ahal
This commit is contained in:
parent
23a675daa4
commit
53f340cae0
@ -55,9 +55,10 @@ if (outOfProcess) {
|
||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
|
||||
loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserver.js", specialpowers);
|
||||
let specialPowersObserver = new specialpowers.SpecialPowersObserver();
|
||||
specialPowersObserver.init();
|
||||
|
||||
let mm = container.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader.messageManager;
|
||||
specialPowersObserver.init(mm);
|
||||
|
||||
mm.addMessageListener("SPPrefService", specialPowersObserver);
|
||||
mm.addMessageListener("SPProcessCrashService", specialPowersObserver);
|
||||
mm.addMessageListener("SPPingService", specialPowersObserver);
|
||||
|
@ -28,6 +28,7 @@ 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);
|
||||
}
|
||||
@ -81,18 +82,28 @@ SpecialPowersObserver.prototype = new SpecialPowersObserverAPI();
|
||||
|
||||
SpecialPowersObserver.prototype._sendAsyncMessage = function(msgname, msg)
|
||||
{
|
||||
this._messageManager.broadcastAsyncMessage(msgname, msg);
|
||||
if (this._mmIsGlobal) {
|
||||
this._messageManager.broadcastAsyncMessage(msgname, msg);
|
||||
}
|
||||
else {
|
||||
this._messageManager.sendAsyncMessage(msgname, msg);
|
||||
}
|
||||
};
|
||||
|
||||
SpecialPowersObserver.prototype._receiveMessage = function(aMessage) {
|
||||
return this._receiveMessageAPI(aMessage);
|
||||
};
|
||||
|
||||
SpecialPowersObserver.prototype.init = function()
|
||||
SpecialPowersObserver.prototype.init = function(messageManager)
|
||||
{
|
||||
var obs = Services.obs;
|
||||
obs.addObserver(this, "xpcom-shutdown", false);
|
||||
obs.addObserver(this, "chrome-document-global-created", false);
|
||||
|
||||
if (messageManager) {
|
||||
this._messageManager = messageManager;
|
||||
this._mmIsGlobal = false;
|
||||
}
|
||||
};
|
||||
|
||||
SpecialPowersObserver.prototype.uninit = function()
|
||||
|
Loading…
x
Reference in New Issue
Block a user