Backed out changeset 74176e6545b1 (bug 1245644) for m-oth test failures
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Fri, 18 Mar 2016 08:08:01 +0100
changeset 289349 0e729ba9f2bf518876ce87959ae4a95827f68935
parent 289348 cdcccf027c37873120a30baff31e501df33f61f0
child 289350 9405a0d75bf1528a670fc6dcb00dfb3eb500ea37
push id73798
push usercbook@mozilla.com
push dateFri, 18 Mar 2016 15:10:54 +0000
treeherdermozilla-inbound@5096e12520cd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1245644
milestone48.0a1
backs out74176e6545b138d1c84d4d6a2eb6a04c414d9f68
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 74176e6545b1 (bug 1245644) for m-oth test failures
toolkit/components/extensions/ext-downloads.js
toolkit/components/extensions/schemas/downloads.json
toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_misc.html
--- a/toolkit/components/extensions/ext-downloads.js
+++ b/toolkit/components/extensions/ext-downloads.js
@@ -469,33 +469,16 @@ extensions.registerSchemaAPI("downloads"
             download.tryToKeepPartialData = true;
             download.start();
 
             const item = DownloadMap.newFromDownload(download, extension);
             return item.id;
           });
       },
 
-      removeFile(id) {
-        return DownloadMap.lazyInit().then(() => {
-          let item;
-          try {
-            item = DownloadMap.fromId(id);
-          } catch (err) {
-            return Promise.reject({message: `Invalid download id ${id}`});
-          }
-          if (item.state !== "complete") {
-            return Promise.reject({message: `Cannot remove incomplete download id ${id}`});
-          }
-          return OS.File.remove(item.filename, {ignoreAbsent: false}).catch((err) => {
-            return Promise.reject({message: `Could not remove download id ${item.id} because the file doesn't exist`});
-          });
-        });
-      },
-
       search(query) {
         return queryHelper(query)
           .then(items => items.map(item => item.serialize()));
       },
 
       pause(id) {
         return DownloadMap.lazyInit().then(() => {
           let item = DownloadMap.fromId(id);
--- a/toolkit/components/extensions/schemas/downloads.json
+++ b/toolkit/components/extensions/schemas/downloads.json
@@ -605,18 +605,18 @@
                 "type": "array"
               }
             ]
           }
         ]
       },
       {
         "name": "removeFile",
-        "async": "callback",
         "type": "function",
+        "unsupported": true,
         "parameters": [
           {
             "name": "downloadId",
             "type": "integer"
           },
           {
             "name": "callback",
             "type": "function",
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_misc.html
+++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_misc.html
@@ -499,135 +499,16 @@ add_task(function* test_erase() {
   msg = yield runInExtension("erase", {});
   is(msg.status, "success", "erase everything succeeded");
 
   msg = yield runInExtension("search", {});
   is(msg.status, "success", "search succeded");
   is(msg.result.length, 0, "search found 0 downloads");
 });
 
-add_task(function* test_file_removal() {
-  let msg = yield runInExtension("download", {url: TXT_URL});
-  is(msg.status, "success", "download() succeeded");
-  const id = msg.result;
-
-  msg = yield runInExtension("waitForEvents", [
-    {type: "onCreated", data: {id, url: TXT_URL}},
-    {
-      type: "onChanged",
-      data: {
-        id,
-        state: {
-          previous: "in_progress",
-          current: "complete",
-        },
-      },
-    },
-  ]);
-
-  is(msg.status, "success", "got onCreated and onChanged events");
-
-  msg = yield runInExtension("removeFile", id);
-  is(msg.status, "success", "removeFile() succeeded");
-
-  msg = yield runInExtension("removeFile", id);
-  is(msg.status, "error", "removeFile() fails since the file was already removed.");
-  ok(/file doesn't exist/.test(msg.errmsg), "removeFile() failed on removed file.");
-
-  msg = yield runInExtension("removeFile", 1000);
-  ok(/Invalid download id/.test(msg.errmsg), "removeFile() failed due to non-existent id");
-});
-
-add_task(function* test_removal_of_incomplete_download() {
-  let msg = yield runInExtension("download", {url: INTERRUPTIBLE_URL});
-  is(msg.status, "success", "download() succeeded");
-  const id = msg.result;
-
-  let progressPromise = waitForProgress(INTERRUPTIBLE_URL, INT_PARTIAL_LEN);
-
-  msg = yield runInExtension("waitForEvents", [
-    {type: "onCreated", data: {id}},
-  ]);
-  is(msg.status, "success", "got created and changed events");
-
-  yield progressPromise;
-  info(`download reached ${INT_PARTIAL_LEN} bytes`);
-
-  msg = yield runInExtension("pause", id);
-  is(msg.status, "success", "pause() succeeded");
-
-  msg = yield runInExtension("waitForEvents", [
-    {
-      type: "onChanged",
-      data: {
-        id,
-        state: {
-          previous: "in_progress",
-          current: "interrupted",
-        },
-        paused: {
-          previous: false,
-          current: true,
-        },
-        canResume: {
-          previous: false,
-          current: true,
-        },
-      },
-    }]);
-  is(msg.status, "success", "got onChanged event corresponding to pause");
-
-  msg = yield runInExtension("removeFile", id);
-  is(msg.status, "error", "removeFile() on paused download failed");
-
-  ok(/Cannot remove incomplete download/.test(msg.errmsg), "removeFile() failed due to download being incomplete");
-
-  msg = yield runInExtension("resume", id);
-  is(msg.status, "success", "resume() succeeded");
-
-  msg = yield runInExtension("waitForEvents", [
-    {
-      type: "onChanged",
-      data: {
-        id,
-        state: {
-          previous: "interrupted",
-          current: "in_progress",
-        },
-        paused: {
-          previous: true,
-          current: false,
-        },
-        canResume: {
-          previous: true,
-          current: false,
-        },
-        error: {
-          previous: "USER_CANCELED",
-          current: null,
-        },
-      },
-    },
-    {
-      type: "onChanged",
-      data: {
-        id,
-        state: {
-          previous: "in_progress",
-          current: "complete",
-        },
-      },
-    },
-  ]);
-  is(msg.status, "success", "got onChanged events for resume and complete");
-
-  msg = yield runInExtension("removeFile", id);
-  is(msg.status, "success", "removeFile() succeeded following completion of resumed download.");
-});
-
 add_task(function* cleanup() {
   yield extension.unload();
 });
 
 </script>
 
 </body>
 </html>