Bug 1063852 - Use webidl sequence for the receipts property. r=marco,bholley
--- a/dom/apps/Webapps.js
+++ b/dom/apps/Webapps.js
@@ -408,17 +408,17 @@ WebappsApplication.prototype = {
this.__DOM_IMPL__.setEventHandler("ondownloadapplied", aCallback);
},
get ondownloadapplied() {
return this.__DOM_IMPL__.getEventHandler("ondownloadapplied");
},
get receipts() {
- return this._proxy.receipts;
+ return this._proxy.receipts || [];
},
get downloadError() {
// Only return DOMError when we have an error.
if (!this._proxy.downloadError) {
return null;
}
return new this._window.DOMError(this._proxy.downloadError);
@@ -634,38 +634,41 @@ WebappsApplication.prototype = {
aConnection.subAppManifestURL);
connections.push(connection);
});
req.resolve(connections);
break;
case "Webapps:AddReceipt:Return:OK":
this.removeMessageListeners(["Webapps:AddReceipt:Return:OK",
"Webapps:AddReceipt:Return:KO"]);
+ this.__DOM_IMPL__._clearCachedReceiptsValue();
this._proxy.receipts = msg.receipts;
Services.DOMRequest.fireSuccess(req, null);
break;
case "Webapps:AddReceipt:Return:KO":
this.removeMessageListeners(["Webapps:AddReceipt:Return:OK",
"Webapps:AddReceipt:Return:KO"]);
Services.DOMRequest.fireError(req, msg.error);
break;
case "Webapps:RemoveReceipt:Return:OK":
this.removeMessageListeners(["Webapps:RemoveReceipt:Return:OK",
"Webapps:RemoveReceipt:Return:KO"]);
+ this.__DOM_IMPL__._clearCachedReceiptsValue();
this._proxy.receipts = msg.receipts;
Services.DOMRequest.fireSuccess(req, null);
break;
case "Webapps:RemoveReceipt:Return:KO":
this.removeMessageListeners(["Webapps:RemoveReceipt:Return:OK",
"Webapps:RemoveReceipt:Return:KO"]);
Services.DOMRequest.fireError(req, msg.error);
break;
case "Webapps:ReplaceReceipt:Return:OK":
this.removeMessageListeners(["Webapps:ReplaceReceipt:Return:OK",
"Webapps:ReplaceReceipt:Return:KO"]);
+ this.__DOM_IMPL__._clearCachedReceiptsValue();
this._proxy.receipts = msg.receipts;
Services.DOMRequest.fireSuccess(req, null);
break;
case "Webapps:ReplaceReceipt:Return:KO":
this.removeMessageListeners(["Webapps:ReplaceReceipt:Return:OK",
"Webapps:ReplaceReceipt:Return:KO"]);
Services.DOMRequest.fireError(req, msg.error);
break;
--- a/dom/webidl/Apps.webidl
+++ b/dom/webidl/Apps.webidl
@@ -28,19 +28,18 @@ interface DOMApplication : EventTarget {
readonly attribute any manifest;
readonly attribute any updateManifest;
readonly attribute DOMString manifestURL;
readonly attribute DOMString origin;
readonly attribute DOMString installOrigin;
readonly attribute DOMTimeStamp installTime;
readonly attribute boolean removable;
- // That's actually a [Cached, Pure] sequence<DOMString>.
- // Will update once bug 963382 is fixed.
- readonly attribute any receipts;
+ [Cached, Pure]
+ readonly attribute sequence<DOMString> receipts;
readonly attribute double progress;
readonly attribute DOMString installState;
readonly attribute DOMTimeStamp lastUpdateCheck;
readonly attribute DOMTimeStamp updateTime;