Backed out changeset 800df6b80dc0 (bug 1265836)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Thu, 26 May 2016 10:32:41 +0200
changeset 338156 6539a8f181c86d523a458258d687e4cece9e8e2a
parent 338155 4dfbc30310616d36cb3ae4764c618cb563971207
child 338157 a934331fdba4ec842b74a1c4de2deedc34c0f51a
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1265836
milestone49.0a1
backs out800df6b80dc0f1ca053203696e5a9be8722006f3
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
Backed out changeset 800df6b80dc0 (bug 1265836)
browser/components/extensions/ext-history.js
browser/components/extensions/schemas/history.json
browser/components/extensions/test/browser/browser_ext_history.js
toolkit/components/extensions/ExtensionUtils.jsm
toolkit/components/extensions/ext-downloads.js
--- a/browser/components/extensions/ext-history.js
+++ b/browser/components/extensions/ext-history.js
@@ -48,18 +48,18 @@ function convertNavHistoryContainerResul
 extensions.registerSchemaAPI("history", "history", (extension, context) => {
   return {
     history: {
       deleteAll: function() {
         return History.clear();
       },
       deleteRange: function(filter) {
         let newFilter = {
-          beginDate: normalizeTime(filter.startTime),
-          endDate: normalizeTime(filter.endTime),
+          beginDate: new Date(filter.startTime),
+          endDate: new Date(filter.endTime),
         };
         // History.removeVisitsByFilter returns a boolean, but our API should return nothing
         return History.removeVisitsByFilter(newFilter).then(() => undefined);
       },
       deleteUrl: function(details) {
         let url = details.url;
         // History.remove returns a boolean, but our API should return nothing
         return History.remove(url).then(() => undefined);
--- a/browser/components/extensions/schemas/history.json
+++ b/browser/components/extensions/schemas/history.json
@@ -240,22 +240,22 @@
         "description": "Removes all items within the specified date range from the history.  Pages will not be removed from the history unless all visits fall within the range.",
         "async": "callback",
         "parameters": [
           {
             "name": "range",
             "type": "object",
             "properties": {
               "startTime": {
-                "$ref": "HistoryTime",
-                "description": "Items added to history after this date."
+                "type": "number",
+                "description": "Items added to history after this date, represented in milliseconds since the epoch."
               },
               "endTime": {
-                "$ref": "HistoryTime",
-                "description": "Items added to history before this date."
+                "type": "number",
+                "description": "Items added to history before this date, represented in milliseconds since the epoch."
               }
             }
           },
           {
             "name": "callback",
             "type": "function",
             "parameters": []
           }
--- a/browser/components/extensions/test/browser/browser_ext_history.js
+++ b/browser/components/extensions/test/browser/browser_ext_history.js
@@ -66,30 +66,30 @@ add_task(function* test_delete() {
   let testUrl = visits[6].uri.spec;
   ok(yield PlacesTestUtils.isPageInDB(testUrl), "expected url found in history database");
 
   extension.sendMessage("delete-url", testUrl);
   yield extension.awaitMessage("url-deleted");
   is(yield PlacesTestUtils.isPageInDB(testUrl), false, "expected url not found in history database");
 
   let filter = {
-    startTime: PlacesUtils.toDate(visits[1].visitDate),
-    endTime: PlacesUtils.toDate(visits[3].visitDate),
+    startTime: PlacesUtils.toDate(visits[1].visitDate).valueOf(),
+    endTime: PlacesUtils.toDate(visits[3].visitDate).valueOf(),
   };
 
   extension.sendMessage("delete-range", filter);
   yield extension.awaitMessage("range-deleted");
 
   ok(yield PlacesTestUtils.isPageInDB(visits[0].uri), "expected uri found in history database");
   is(yield PlacesTestUtils.visitsInDB(visits[0].uri), 2, "2 visits for uri found in history database");
   ok(yield PlacesTestUtils.isPageInDB(visits[5].uri), "expected uri found in history database");
   is(yield PlacesTestUtils.visitsInDB(visits[5].uri), 1, "1 visit for uri found in history database");
 
-  filter.startTime = PlacesUtils.toDate(visits[0].visitDate);
-  filter.endTime = PlacesUtils.toDate(visits[5].visitDate);
+  filter.startTime = PlacesUtils.toDate(visits[0].visitDate).valueOf();
+  filter.endTime = PlacesUtils.toDate(visits[5].visitDate).valueOf();
 
   extension.sendMessage("delete-range", filter);
   yield extension.awaitMessage("range-deleted");
 
   is(yield PlacesTestUtils.isPageInDB(visits[0].uri), false, "expected uri not found in history database");
   is(yield PlacesTestUtils.visitsInDB(visits[0].uri), 0, "0 visits for uri found in history database");
   is(yield PlacesTestUtils.isPageInDB(visits[5].uri), false, "expected uri not found in history database");
   is(yield PlacesTestUtils.visitsInDB(visits[5].uri), 0, "0 visits for uri found in history database");
--- a/toolkit/components/extensions/ExtensionUtils.jsm
+++ b/toolkit/components/extensions/ExtensionUtils.jsm
@@ -1183,31 +1183,32 @@ class ChildAPIManager {
   hasListener(path, name, listener) {
     let ref = path.concat(name).join(".");
     let set = this.listeners.get(ref) || new Set();
     return set.has(listener);
   }
 }
 
 /**
- * Convert any of several different representations of a date/time to a Date object.
- * Accepts several formats:
+ * Returns a number which represents the number of milliseconds since the epoch
+ * for either a startDate or an endDate. Accepts several formats:
  * a Date object, an ISO8601 string, or a number of milliseconds since the epoch as
  * either a number or a string.
  *
  * @param date: (Date) or (String) or (Number)
  *      The date to convert.
- * @returns (Date)
- *      A Date object
+ * @returns (Number)
+ *      The number of milliseconds since the epoch for the date
  */
 function normalizeTime(date) {
   // Of all the formats we accept the "number of milliseconds since the epoch as a string"
   // is an outlier, everything else can just be passed directly to the Date constructor.
-  return new Date((typeof date == "string" && /^\d+$/.test(date))
+  const result = new Date((typeof date == "string" && /^\d+$/.test(date))
                         ? parseInt(date, 10) : date);
+  return result.valueOf();
 }
 
 this.ExtensionUtils = {
   detectLanguage,
   extend,
   flushJarCache,
   ignoreEvent,
   injectAPI,
--- a/toolkit/components/extensions/ext-downloads.js
+++ b/toolkit/components/extensions/ext-downloads.js
@@ -241,17 +241,17 @@ function downloadQuery(query) {
       }
     }
   }
 
   function normalizeDownloadTime(arg, before) {
     if (arg == null) {
       return before ? Number.MAX_VALUE : 0;
     } else {
-      return normalizeTime(arg).getTime();
+      return normalizeTime(arg);
     }
   }
 
   const startedBefore = normalizeDownloadTime(query.startedBefore, true);
   const startedAfter = normalizeDownloadTime(query.startedAfter, false);
   // const endedBefore = normalizeDownloadTime(query.endedBefore, true);
   // const endedAfter = normalizeDownloadTime(query.endedAfter, false);