Bug 1159632 - TEST-UNEXPECTED-FAIL | toolkit/components/jsdownloads/test/unit/test_DownloadImport.js. r=paolo
☠☠ backed out by 5a28a5474ba6 ☠ ☠
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Mon, 25 May 2015 21:16:22 +0300
changeset 247571 ee2d0bbca72c61e6355ca65d8f715357d9d76703
parent 247570 c5f6b5160c029c794e9dffe8e1833fa42a2b4501
child 247572 2f9f8ea4b9c3d42db7ddee336942ea1d42b4383f
push id28870
push usercbook@mozilla.com
push dateMon, 08 Jun 2015 09:58:36 +0000
treeherdermozilla-central@4700d1cdf489 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaolo
bugs1159632
milestone41.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 1159632 - TEST-UNEXPECTED-FAIL | toolkit/components/jsdownloads/test/unit/test_DownloadImport.js. r=paolo The failure occured when browser.helperApps.deleteTempFileOnExit was set to true.
toolkit/components/jsdownloads/test/unit/head.js
--- a/toolkit/components/jsdownloads/test/unit/head.js
+++ b/toolkit/components/jsdownloads/test/unit/head.js
@@ -132,18 +132,25 @@ function getTempFile(aLeafName)
   let leafName = base + "-" + gFileCounter + ext;
   gFileCounter++;
 
   // Get a file reference under the temporary directory for this test file.
   let file = FileUtils.getFile("TmpD", [leafName]);
   do_check_false(file.exists());
 
   do_register_cleanup(function () {
-    if (file.exists()) {
+    try {
       file.remove(false);
+    } catch (ex if (ex instanceof Components.Exception &&
+                    (ex.result == Cr.NS_ERROR_FILE_ACCESS_DENIED ||
+                     ex.result == Cr.NS_ERROR_FILE_TARGET_DOES_NOT_EXIST))) {
+        // On Windows, we may get an access denied error if the file existed before,
+        // and was recently deleted.
+        // Don't bother checking file.exists() as that may also cause an access
+        // denied error.
     }
   });
 
   return file;
 }
 
 /**
  * Waits for pending events to be processed.