Bug 1095506 - Clean up and rename kSerializableDownloadProperties. r=paolo
☠☠ backed out by 6808270d3dae ☠ ☠
authorSteven MacLeod <smacleod@mozilla.com>
Mon, 10 Nov 2014 20:58:20 -0500
changeset 215084 7bfa96b421ea71013044d238940e3438f2366df6
parent 215083 da9faa259da1105ad9ea691c2bffc33286426b1a
child 215085 6808270d3dae2235eacde38e95e6e01523608201
push id51649
push userryanvm@gmail.com
push dateTue, 11 Nov 2014 21:50:24 +0000
treeherdermozilla-inbound@a926116946f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaolo
bugs1095506
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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",
@@ -1019,24 +1019,24 @@ Download.fromSerializable = function (aS
              : aSerializable.startTime;
     download.startTime = new Date(time);
   }
 
   if ("errorObj" in aSerializable) {
     download.error = DownloadError.fromSerializable(aSerializable.errorObj);
   }
 
-  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;
 };