diff --git a/dom/apps/Webapps.js b/dom/apps/Webapps.js index 9f801f1c88a9..07eddc9d495a 100644 --- a/dom/apps/Webapps.js +++ b/dom/apps/Webapps.js @@ -180,6 +180,7 @@ WebappsRegistry.prototype = { from: installURL, oid: this._id, + topId: this._topId, requestID: requestID, appId: principal.appId, isBrowser: principal.isInBrowserElement, @@ -208,7 +209,7 @@ WebappsRegistry.prototype = { this.addMessageListeners("Webapps:GetSelf:Return:OK"); cpmm.sendAsyncMessage("Webapps:GetSelf", { origin: this._getOrigin(this._window.location.href), appId: this._window.document.nodePrincipal.appId, - oid: this._id, + oid: this._id, topId: this._topId, requestID: this.getRequestId(request) }); return request; }, @@ -229,7 +230,7 @@ WebappsRegistry.prototype = { this.addMessageListeners("Webapps:CheckInstalled:Return:OK"); cpmm.sendAsyncMessage("Webapps:CheckInstalled", { origin: this._getOrigin(this._window.location.href), manifestURL: manifestURL.spec, - oid: this._id, + oid: this._id, topId: this._topId, requestID: this.getRequestId(request) }); return request; }, @@ -238,7 +239,7 @@ WebappsRegistry.prototype = { let request = this.createRequest(); this.addMessageListeners("Webapps:GetInstalled:Return:OK"); cpmm.sendAsyncMessage("Webapps:GetInstalled", { origin: this._getOrigin(this._window.location.href), - oid: this._id, + oid: this._id, topId: this._topId, requestID: this.getRequestId(request) }); return request; }, @@ -253,6 +254,7 @@ WebappsRegistry.prototype = { .createInstance(Ci.nsISupports); mgmt.wrappedJSObject.init(this._window, this.hasFullMgmtPrivilege); mgmt.wrappedJSObject._windowId = this._id; + mgmt.wrappedJSObject._topId = this._topId; this._mgmt = mgmt.__DOM_IMPL__ ? mgmt.__DOM_IMPL__ : this._window.DOMApplicationsManager._create(this._window, mgmt.wrappedJSObject); @@ -321,6 +323,7 @@ WebappsRegistry.prototype = { path: aPath, dataType: aType, oid: this._id, + topId: this._topId, requestID: this.getPromiseResolverId({ resolve: aResolve, reject: aReject @@ -341,6 +344,12 @@ WebappsRegistry.prototype = { let util = this._window.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIDOMWindowUtils); this._id = util.outerWindowID; + + let topUtil = this._window.top + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindowUtils); + this._topId = topUtil.outerWindowID; + cpmm.sendAsyncMessage("Webapps:RegisterForMessages", { messages: ["Webapps:Install:Return:OK", "Webapps:AdditionalLanguageChange"]}); @@ -548,6 +557,7 @@ WebappsApplication.prototype = { cpmm.sendAsyncMessage("Webapps:CheckForUpdate", { manifestURL: this.manifestURL, oid: this._id, + topId: this._topId, requestID: this.getRequestId(request) }); return request; }, @@ -560,6 +570,7 @@ WebappsApplication.prototype = { manifestURL: this.manifestURL, startPoint: aStartPoint || "", oid: this._id, + topId: this._topId, timestamp: Date.now(), requestID: this.getRequestId(request) }); return request; @@ -574,6 +585,7 @@ WebappsApplication.prototype = { browserChild.messageManager.sendAsyncMessage("Webapps:ClearBrowserData", { manifestURL: this.manifestURL, oid: this._id, + topId: this._topId, requestID: this.getRequestId(request) }); } else { @@ -591,6 +603,7 @@ WebappsApplication.prototype = { rules: aRules, manifestURL: this.manifestURL, outerWindowID: this._id, + topWindowID: this._topId, requestID: this.getPromiseResolverId({ resolve: aResolve, reject: aReject @@ -605,6 +618,7 @@ WebappsApplication.prototype = { cpmm.sendAsyncMessage("Webapps:GetConnections", { manifestURL: this.manifestURL, outerWindowID: this._id, + topWindowID: this._topId, requestID: this.getPromiseResolverId({ resolve: aResolve, reject: aReject @@ -622,6 +636,7 @@ WebappsApplication.prototype = { cpmm.sendAsyncMessage("Webapps:AddReceipt", { manifestURL: this.manifestURL, receipt: receipt, oid: this._id, + topId: this._topId, requestID: this.getRequestId(request) }); return request; @@ -636,6 +651,7 @@ WebappsApplication.prototype = { cpmm.sendAsyncMessage("Webapps:RemoveReceipt", { manifestURL: this.manifestURL, receipt: receipt, oid: this._id, + topId: this._topId, requestID: this.getRequestId(request) }); return request; @@ -651,6 +667,7 @@ WebappsApplication.prototype = { newReceipt: newReceipt, oldReceipt: oldReceipt, oid: this._id, + topId: this._topId, requestID: this.getRequestId(request) }); return request; @@ -662,6 +679,7 @@ WebappsApplication.prototype = { cpmm.sendAsyncMessage("Webapps:Export", { manifestURL: this.manifestURL, oid: this._id, + topId: this._topId, requestID: this.getPromiseResolverId({ resolve: aResolve, reject: aReject @@ -878,6 +896,7 @@ WebappsApplicationMgmt.prototype = { origin: aApp.origin, manifestURL: aApp.manifestURL, oid: this._id, + topId: this._topId, from: this._window.location.href, windowId: this._windowId, requestID: this.getRequestId(request) @@ -901,6 +920,7 @@ WebappsApplicationMgmt.prototype = { return this.createPromise(function(aResolve, aReject) { cpmm.sendAsyncMessage("Webapps:GetIcon", { oid: this._id, + topId: this._topId, manifestURL: aApp.manifestURL, iconID: aIconID, entryPoint: aEntryPoint, @@ -918,6 +938,7 @@ WebappsApplicationMgmt.prototype = { cpmm.sendAsyncMessage("Webapps:GetNotInstalled", { oid: this._id, + topId: this._topId, requestID: this.getRequestId(request) }, null, principal); @@ -930,6 +951,7 @@ WebappsApplicationMgmt.prototype = { cpmm.sendAsyncMessage("Webapps:Import", { blob: aBlob, oid: this._id, + topId: this._topId, requestID: this.getPromiseResolverId({ resolve: aResolve, reject: aReject @@ -943,6 +965,7 @@ WebappsApplicationMgmt.prototype = { cpmm.sendAsyncMessage("Webapps:ExtractManifest", { blob: aBlob, oid: this._id, + topId: this._topId, requestID: this.getPromiseResolverId({ resolve: aResolve, reject: aReject