зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1051114 - 400 MozInterAppMessagePort registered on frame message manager r=bent
This commit is contained in:
Родитель
1efd46b659
Коммит
47ceb8da49
|
@ -804,6 +804,13 @@ this.InterAppCommService = {
|
|||
if (pair.publisher.target === aTarget ||
|
||||
pair.subscriber.target === aTarget) {
|
||||
messagePortIDs.push(messagePortID);
|
||||
// Send a shutdown message to the part of the pair that is still alive.
|
||||
let actor = pair.publisher.target === aTarget ? pair.subscriber
|
||||
: pair.publisher;
|
||||
actor.target.sendAsyncMessage("InterAppMessagePort:Shutdown",
|
||||
{ manifestURL: actor.manifestURL,
|
||||
pageURL: actor.pageURL,
|
||||
messagePortID: messagePortID });
|
||||
}
|
||||
}
|
||||
messagePortIDs.forEach(function(aMessagePortID) {
|
||||
|
|
|
@ -30,7 +30,8 @@ XPCOMUtils.defineLazyServiceGetter(this, "appsService",
|
|||
"@mozilla.org/AppsService;1",
|
||||
"nsIAppsService");
|
||||
|
||||
const kMessages = ["InterAppMessagePort:OnMessage"];
|
||||
const kMessages = ["InterAppMessagePort:OnMessage",
|
||||
"InterAppMessagePort:Shutdown"];
|
||||
|
||||
function InterAppMessagePort() {
|
||||
if (DEBUG) debug("InterAppMessagePort()");
|
||||
|
@ -149,6 +150,8 @@ InterAppMessagePort.prototype = {
|
|||
cpmm.sendAsyncMessage("InterAppMessagePort:Unregister",
|
||||
{ messagePortID: this._messagePortID,
|
||||
manifestURL: this._manifestURL });
|
||||
|
||||
this.removeMessageListeners(kMessages);
|
||||
},
|
||||
|
||||
get onmessage() {
|
||||
|
@ -193,7 +196,8 @@ InterAppMessagePort.prototype = {
|
|||
if (message.manifestURL != this._manifestURL ||
|
||||
message.pageURL != this._pageURL ||
|
||||
message.messagePortID != this._messagePortID) {
|
||||
if (DEBUG) debug("The message doesn't belong to this page. Returning.");
|
||||
if (DEBUG) debug("The message doesn't belong to this page. Returning. " +
|
||||
uneval(message));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -213,6 +217,9 @@ InterAppMessagePort.prototype = {
|
|||
this._dispatchMessage(message.message);
|
||||
break;
|
||||
|
||||
case "InterAppMessagePort:Shutdown":
|
||||
this.close();
|
||||
break;
|
||||
default:
|
||||
if (DEBUG) debug("Error! Shouldn't fall into this case.");
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче