зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1150660 - Fix sendAsyncMessage() uses to not trigger warnings in dom/apps r=fabrice
This commit is contained in:
Родитель
1755e88a07
Коммит
61ad988f3a
|
@ -1274,6 +1274,12 @@ this.DOMApplicationRegistry = {
|
|||
}, this);
|
||||
},
|
||||
|
||||
formatMessage: function(aData) {
|
||||
let msg = aData;
|
||||
delete msg["mm"];
|
||||
return msg;
|
||||
},
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
// nsIPrefBranch throws if pref does not exist, faster to simply write
|
||||
// the pref instead of first checking if it is false.
|
||||
|
@ -1474,8 +1480,8 @@ this.DOMApplicationRegistry = {
|
|||
if (!(aMsgName in this.children)) {
|
||||
return;
|
||||
}
|
||||
this.children[aMsgName].forEach(function(mmRef) {
|
||||
mmRef.mm.sendAsyncMessage(aMsgName, aContent);
|
||||
this.children[aMsgName].forEach((mmRef) => {
|
||||
mmRef.mm.sendAsyncMessage(aMsgName, this.formatMessage(aContent));
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -1566,14 +1572,14 @@ this.DOMApplicationRegistry = {
|
|||
|
||||
doExport: function(aMsg, aMm) {
|
||||
|
||||
function sendError(aError) {
|
||||
let sendError = (aError) => {
|
||||
aMm.sendAsyncMessage("Webapps:Export:Return",
|
||||
{ requestID: aMsg.requestID,
|
||||
oid: aMsg.oid,
|
||||
error: aError,
|
||||
success: false
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
let app = this.getAppByManifestURL(aMsg.manifestURL);
|
||||
if (!app) {
|
||||
|
@ -1595,14 +1601,14 @@ this.DOMApplicationRegistry = {
|
|||
},
|
||||
|
||||
doImport: function(aMsg, aMm) {
|
||||
function sendError(aError) {
|
||||
let sendError = (aError) => {
|
||||
aMm.sendAsyncMessage("Webapps:Import:Return",
|
||||
{ requestID: aMsg.requestID,
|
||||
oid: aMsg.oid,
|
||||
error: aError,
|
||||
success: false
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (!aMsg.blob || !aMsg.blob instanceof Ci.nsIDOMBlob) {
|
||||
sendError("NoBlobFound");
|
||||
|
@ -1624,14 +1630,14 @@ this.DOMApplicationRegistry = {
|
|||
},
|
||||
|
||||
doExtractManifest: function(aMsg, aMm) {
|
||||
function sendError() {
|
||||
let sendError = (aError) => {
|
||||
aMm.sendAsyncMessage("Webapps:ExtractManifest:Return",
|
||||
{ requestID: aMsg.requestID,
|
||||
oid: aMsg.oid,
|
||||
error: aError,
|
||||
success: false
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (!aMsg.blob || !aMsg.blob instanceof Ci.nsIDOMBlob) {
|
||||
sendError("NoBlobFound");
|
||||
|
@ -1663,12 +1669,12 @@ this.DOMApplicationRegistry = {
|
|||
aData.manifestURL,
|
||||
aData.startPoint,
|
||||
aData.timestamp,
|
||||
function onsuccess() {
|
||||
aMm.sendAsyncMessage("Webapps:Launch:Return:OK", aData);
|
||||
() => {
|
||||
aMm.sendAsyncMessage("Webapps:Launch:Return:OK", this.formatMessage(aData));
|
||||
},
|
||||
function onfailure(reason) {
|
||||
(reason) => {
|
||||
aData.error = reason;
|
||||
aMm.sendAsyncMessage("Webapps:Launch:Return:KO", aData);
|
||||
aMm.sendAsyncMessage("Webapps:Launch:Return:KO", this.formatMessage(aData));
|
||||
}
|
||||
);
|
||||
},
|
||||
|
@ -2123,11 +2129,11 @@ this.DOMApplicationRegistry = {
|
|||
checkForUpdate: function(aData, aMm) {
|
||||
debug("checkForUpdate for " + aData.manifestURL);
|
||||
|
||||
function sendError(aError) {
|
||||
let sendError = (aError) => {
|
||||
debug("checkForUpdate error " + aError);
|
||||
aData.error = aError;
|
||||
aMm.sendAsyncMessage("Webapps:CheckForUpdate:Return:KO", aData);
|
||||
}
|
||||
aMm.sendAsyncMessage("Webapps:CheckForUpdate:Return:KO", this.formatMessage(aData));
|
||||
};
|
||||
|
||||
let id = this._appIdForManifestURL(aData.manifestURL);
|
||||
let app = this.webapps[id];
|
||||
|
@ -2529,13 +2535,13 @@ this.DOMApplicationRegistry = {
|
|||
doInstall: function doInstall(aData, aMm) {
|
||||
let app = aData.app;
|
||||
|
||||
let sendError = function sendError(aError) {
|
||||
let sendError = (aError) => {
|
||||
aData.error = aError;
|
||||
aMm.sendAsyncMessage("Webapps:Install:Return:KO", aData);
|
||||
aMm.sendAsyncMessage("Webapps:Install:Return:KO", this.formatMessage(aData));
|
||||
Cu.reportError("Error installing app from: " + app.installOrigin +
|
||||
": " + aError);
|
||||
this.popContentAction(aData.oid);
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
if (app.receipts.length > 0) {
|
||||
for (let receipt of app.receipts) {
|
||||
|
@ -2684,13 +2690,13 @@ this.DOMApplicationRegistry = {
|
|||
doInstallPackage: function doInstallPackage(aData, aMm) {
|
||||
let app = aData.app;
|
||||
|
||||
let sendError = function sendError(aError) {
|
||||
let sendError = (aError) => {
|
||||
aData.error = aError;
|
||||
aMm.sendAsyncMessage("Webapps:Install:Return:KO", aData);
|
||||
aMm.sendAsyncMessage("Webapps:Install:Return:KO", this.formatMessage(aData));
|
||||
Cu.reportError("Error installing packaged app from: " +
|
||||
app.installOrigin + ": " + aError);
|
||||
this.popContentAction(aData.oid);
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
if (app.receipts.length > 0) {
|
||||
for (let receipt of app.receipts) {
|
||||
|
@ -2843,7 +2849,7 @@ this.DOMApplicationRegistry = {
|
|||
} catch(e) {
|
||||
}
|
||||
}
|
||||
aData.mm.sendAsyncMessage("Webapps:Install:Return:KO", aData);
|
||||
aData.mm.sendAsyncMessage("Webapps:Install:Return:KO", this.formatMessage(aData));
|
||||
},
|
||||
|
||||
// This function is called after we called the onsuccess callback on the
|
||||
|
@ -4171,7 +4177,7 @@ this.DOMApplicationRegistry = {
|
|||
}
|
||||
|
||||
if ((aMm = aMm.get())) {
|
||||
aMm.sendAsyncMessage(response, aData);
|
||||
aMm.sendAsyncMessage(response, this.formatMessage(aData));
|
||||
}
|
||||
}),
|
||||
|
||||
|
@ -4264,7 +4270,7 @@ this.DOMApplicationRegistry = {
|
|||
|
||||
if (aData.appId == Ci.nsIScriptSecurityManager.NO_APP_ID ||
|
||||
aData.appId == Ci.nsIScriptSecurityManager.UNKNOWN_APP_ID) {
|
||||
aMm.sendAsyncMessage("Webapps:GetSelf:Return:OK", aData);
|
||||
aMm.sendAsyncMessage("Webapps:GetSelf:Return:OK", this.formatMessage(aData));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4282,14 +4288,14 @@ this.DOMApplicationRegistry = {
|
|||
}
|
||||
|
||||
if (!aData.apps.length) {
|
||||
aMm.sendAsyncMessage("Webapps:GetSelf:Return:OK", aData);
|
||||
aMm.sendAsyncMessage("Webapps:GetSelf:Return:OK", this.formatMessage(aData));
|
||||
return;
|
||||
}
|
||||
|
||||
this._readManifests(tmp).then((aResult) => {
|
||||
for (let i = 0; i < aResult.length; i++)
|
||||
aData.apps[i].manifest = aResult[i].manifest;
|
||||
aMm.sendAsyncMessage("Webapps:GetSelf:Return:OK", aData);
|
||||
aMm.sendAsyncMessage("Webapps:GetSelf:Return:OK", this.formatMessage(aData));
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -4311,7 +4317,7 @@ this.DOMApplicationRegistry = {
|
|||
aData.app.manifest = aResult[i].manifest;
|
||||
break;
|
||||
}
|
||||
aMm.sendAsyncMessage("Webapps:CheckInstalled:Return:OK", aData);
|
||||
aMm.sendAsyncMessage("Webapps:CheckInstalled:Return:OK", this.formatMessage(aData));
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -4330,7 +4336,7 @@ this.DOMApplicationRegistry = {
|
|||
this._readManifests(tmp).then((aResult) => {
|
||||
for (let i = 0; i < aResult.length; i++)
|
||||
aData.apps[i].manifest = aResult[i].manifest;
|
||||
aMm.sendAsyncMessage("Webapps:GetInstalled:Return:OK", aData);
|
||||
aMm.sendAsyncMessage("Webapps:GetInstalled:Return:OK", this.formatMessage(aData));
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -4348,16 +4354,16 @@ this.DOMApplicationRegistry = {
|
|||
this._readManifests(tmp).then((aResult) => {
|
||||
for (let i = 0; i < aResult.length; i++)
|
||||
aData.apps[i].manifest = aResult[i].manifest;
|
||||
aMm.sendAsyncMessage("Webapps:GetNotInstalled:Return:OK", aData);
|
||||
aMm.sendAsyncMessage("Webapps:GetNotInstalled:Return:OK", this.formatMessage(aData));
|
||||
});
|
||||
},
|
||||
|
||||
getIcon: function(aData, aMm) {
|
||||
function sendError(aError) {
|
||||
let sendError = (aError) => {
|
||||
debug("getIcon error: " + aError);
|
||||
aData.error = aError;
|
||||
aMm.sendAsyncMessage("Webapps:GetIcon:Return", aData);
|
||||
}
|
||||
aMm.sendAsyncMessage("Webapps:GetIcon:Return", this.formatMessage(aData));
|
||||
};
|
||||
|
||||
let app = this.getAppByManifestURL(aData.manifestURL);
|
||||
if (!app) {
|
||||
|
@ -4513,14 +4519,14 @@ this.DOMApplicationRegistry = {
|
|||
|
||||
if (!receipt) {
|
||||
aData.error = "INVALID_PARAMETERS";
|
||||
aMm.sendAsyncMessage("Webapps:AddReceipt:Return:KO", aData);
|
||||
aMm.sendAsyncMessage("Webapps:AddReceipt:Return:KO", this.formatMessage(aData));
|
||||
return;
|
||||
}
|
||||
|
||||
let error = this.isReceipt(receipt);
|
||||
if (error) {
|
||||
aData.error = error;
|
||||
aMm.sendAsyncMessage("Webapps:AddReceipt:Return:KO", aData);
|
||||
aMm.sendAsyncMessage("Webapps:AddReceipt:Return:KO", this.formatMessage(aData));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4531,14 +4537,14 @@ this.DOMApplicationRegistry = {
|
|||
app.receipts = [];
|
||||
} else if (app.receipts.length > 500) {
|
||||
aData.error = "TOO_MANY_RECEIPTS";
|
||||
aMm.sendAsyncMessage("Webapps:AddReceipt:Return:KO", aData);
|
||||
aMm.sendAsyncMessage("Webapps:AddReceipt:Return:KO", this.formatMessage(aData));
|
||||
return;
|
||||
}
|
||||
|
||||
let index = app.receipts.indexOf(receipt);
|
||||
if (index >= 0) {
|
||||
aData.error = "RECEIPT_ALREADY_EXISTS";
|
||||
aMm.sendAsyncMessage("Webapps:AddReceipt:Return:KO", aData);
|
||||
aMm.sendAsyncMessage("Webapps:AddReceipt:Return:KO", this.formatMessage(aData));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4546,7 +4552,7 @@ this.DOMApplicationRegistry = {
|
|||
|
||||
this._saveApps().then(() => {
|
||||
aData.receipts = app.receipts;
|
||||
aMm.sendAsyncMessage("Webapps:AddReceipt:Return:OK", aData);
|
||||
aMm.sendAsyncMessage("Webapps:AddReceipt:Return:OK", this.formatMessage(aData));
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -4557,7 +4563,7 @@ this.DOMApplicationRegistry = {
|
|||
|
||||
if (!receipt) {
|
||||
aData.error = "INVALID_PARAMETERS";
|
||||
aMm.sendAsyncMessage("Webapps:RemoveReceipt:Return:KO", aData);
|
||||
aMm.sendAsyncMessage("Webapps:RemoveReceipt:Return:KO", this.formatMessage(aData));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4566,14 +4572,14 @@ this.DOMApplicationRegistry = {
|
|||
|
||||
if (!app.receipts) {
|
||||
aData.error = "NO_SUCH_RECEIPT";
|
||||
aMm.sendAsyncMessage("Webapps:RemoveReceipt:Return:KO", aData);
|
||||
aMm.sendAsyncMessage("Webapps:RemoveReceipt:Return:KO", this.formatMessage(aData));
|
||||
return;
|
||||
}
|
||||
|
||||
let index = app.receipts.indexOf(receipt);
|
||||
if (index == -1) {
|
||||
aData.error = "NO_SUCH_RECEIPT";
|
||||
aMm.sendAsyncMessage("Webapps:RemoveReceipt:Return:KO", aData);
|
||||
aMm.sendAsyncMessage("Webapps:RemoveReceipt:Return:KO", this.formatMessage(aData));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4581,7 +4587,7 @@ this.DOMApplicationRegistry = {
|
|||
|
||||
this._saveApps().then(() => {
|
||||
aData.receipts = app.receipts;
|
||||
aMm.sendAsyncMessage("Webapps:RemoveReceipt:Return:OK", aData);
|
||||
aMm.sendAsyncMessage("Webapps:RemoveReceipt:Return:OK", this.formatMessage(aData));
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -4593,14 +4599,14 @@ this.DOMApplicationRegistry = {
|
|||
|
||||
if (!oldReceipt || !newReceipt) {
|
||||
aData.error = "INVALID_PARAMETERS";
|
||||
aMm.sendAsyncMessage("Webapps:ReplaceReceipt:Return:KO", aData);
|
||||
aMm.sendAsyncMessage("Webapps:ReplaceReceipt:Return:KO", this.formatMessage(aData));
|
||||
return;
|
||||
}
|
||||
|
||||
let error = this.isReceipt(newReceipt);
|
||||
if (error) {
|
||||
aData.error = error;
|
||||
aMm.sendAsyncMessage("Webapps:ReplaceReceipt:Return:KO", aData);
|
||||
aMm.sendAsyncMessage("Webapps:ReplaceReceipt:Return:KO", this.formatMessage(aData));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4609,14 +4615,14 @@ this.DOMApplicationRegistry = {
|
|||
|
||||
if (!app.receipts) {
|
||||
aData.error = "NO_SUCH_RECEIPT";
|
||||
aMm.sendAsyncMessage("Webapps:RemoveReceipt:Return:KO", aData);
|
||||
aMm.sendAsyncMessage("Webapps:RemoveReceipt:Return:KO", this.formatMessage(aData));
|
||||
return;
|
||||
}
|
||||
|
||||
let oldIndex = app.receipts.indexOf(oldReceipt);
|
||||
if (oldIndex == -1) {
|
||||
aData.error = "NO_SUCH_RECEIPT";
|
||||
aMm.sendAsyncMessage("Webapps:ReplaceReceipt:Return:KO", aData);
|
||||
aMm.sendAsyncMessage("Webapps:ReplaceReceipt:Return:KO", this.formatMessage(aData));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4624,7 +4630,7 @@ this.DOMApplicationRegistry = {
|
|||
|
||||
this._saveApps().then(() => {
|
||||
aData.receipts = app.receipts;
|
||||
aMm.sendAsyncMessage("Webapps:ReplaceReceipt:Return:OK", aData);
|
||||
aMm.sendAsyncMessage("Webapps:ReplaceReceipt:Return:OK", this.formatMessage(aData));
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче