Bug 1063852 - Use webidl sequence for the receipts property. r=marco,bholley
authorFabrice Desré <fabrice@mozilla.com>
Fri, 05 Sep 2014 16:55:30 -0700
changeset 204302 2ebb9767d726b888170779e7b375eb07f99e8139
parent 204301 6bcc89dd3519860a5886fd02315128ebbd669527
child 204303 082148b5e2d4f37cd716a3d08470838cb3d18bc6
push id10492
push userfdesre@mozilla.com
push dateTue, 09 Sep 2014 16:57:28 +0000
treeherderb2g-inbound@2ebb9767d726 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarco, bholley
bugs1063852
milestone35.0a1
Bug 1063852 - Use webidl sequence for the receipts property. r=marco,bholley
dom/apps/Webapps.js
dom/webidl/Apps.webidl
--- 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;