Bug 1095506 - Clean up and rename kSerializableDownloadProperties. r=paolo
authorSteven MacLeod <smacleod@mozilla.com>
Mon, 10 Nov 2014 20:58:20 -0500
changeset 215749 8ff0a6cb3104707381f6a95f9aeb123c2349c42f
parent 215748 3a1256f12738b7b8df6aa3af8eb290e33465c5a3
child 215750 becaa9efc9b7db3d3a2ed4b627c4499756879d63
push id9969
push usersmacleod@mozilla.com
push dateFri, 14 Nov 2014 15:17:01 +0000
treeherderfx-team@8ff0a6cb3104 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaolo
bugs1095506
milestone36.0a1
Bug 1095506 - Clean up and rename kSerializableDownloadProperties. r=paolo
toolkit/components/jsdownloads/src/DownloadCore.jsm
--- a/toolkit/components/jsdownloads/src/DownloadCore.jsm
+++ b/toolkit/components/jsdownloads/src/DownloadCore.jsm
@@ -924,18 +924,18 @@ this.Download.prototype = {
       serializable.errorObj = this.error.toSerializable();
     }
 
     if (this.startTime) {
       serializable.startTime = this.startTime.toJSON();
     }
 
     // These are serialized unless they are false, null, or empty strings.
-    for (let property of kSerializableDownloadProperties) {
-      if (property != "startTime" && this[property]) {
+    for (let property of kPlainSerializableDownloadProperties) {
+      if (this[property]) {
         serializable[property] = this[property];
       }
     }
 
     serializeUnknownProperties(this, serializable);
 
     return serializable;
   },
@@ -958,17 +958,17 @@ this.Download.prototype = {
     return this.stopped + "," + this.totalBytes + "," + this.hasPartialData +
            "," + this.contentType;
   },
 };
 
 /**
  * Defines which properties of the Download object are serializable.
  */
-const kSerializableDownloadProperties = [
+const kPlainSerializableDownloadProperties = [
   "succeeded",
   "canceled",
   "totalBytes",
   "hasPartialData",
   "tryToKeepPartialData",
   "launcherPath",
   "launchWhenSucceeded",
   "contentType",
@@ -1027,24 +1027,24 @@ Download.fromSerializable = function (aS
   // Instead of just replacing 'error' we use a new 'errorObj' so that previous
   // versions will keep it as an unknown property.
   if ("errorObj" in aSerializable) {
     download.error = DownloadError.fromSerializable(aSerializable.errorObj);
   } else if ("error" in aSerializable) {
     download.error = aSerializable.error;
   }
 
-  for (let property of kSerializableDownloadProperties) {
+  for (let property of kPlainSerializableDownloadProperties) {
     if (property in aSerializable) {
       download[property] = aSerializable[property];
     }
   }
 
   deserializeUnknownProperties(download, aSerializable, property =>
-    kSerializableDownloadProperties.indexOf(property) == -1 &&
+    kPlainSerializableDownloadProperties.indexOf(property) == -1 &&
     property != "startTime" &&
     property != "source" &&
     property != "target" &&
     property != "error" &&
     property != "saver");
 
   return download;
 };