Bug 1077168 - Have Webapps.js pass up the outerWindowID of the top window with each message. r=felipe.

--HG--
extra : rebase_source : 814d149f2c8e59c00d6f623895fabbc2430a6954
This commit is contained in:
Mike Conley 2015-02-11 12:03:12 -05:00
Родитель 7baddf9574
Коммит a80a4c4077
1 изменённых файлов: 26 добавлений и 3 удалений

Просмотреть файл

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