Bug 1300927 - Terminate all workers at the end of the test to work around bug 1340941. r=janv
authorBevis Tseng <btseng@mozilla.com>
Sat, 18 Feb 2017 01:40:30 +0800
changeset 372873 3f4226570a86d2ae7345245ecae8a722e56d3da0
parent 372872 dbf5e2d598506b33da4f66445622b7cf89b650b2
child 372874 1ce3e577832893559a1873ec568a82fb31ff2093
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjanv
bugs1300927, 1340941
milestone54.0a1
Bug 1300927 - Terminate all workers at the end of the test to work around bug 1340941. r=janv
dom/indexedDB/test/test_filehandle_workers.html
--- a/dom/indexedDB/test/test_filehandle_workers.html
+++ b/dom/indexedDB/test/test_filehandle_workers.html
@@ -46,54 +46,52 @@
       onmessage = function(event) {
         throw("Shouldn't be called!");
       }
     }
 
     let url =
       URL.createObjectURL(new Blob(["(", dummyWorkerScript.toSource(), ")()"]));
 
-    let worker = new Worker(url);
+    let worker1 = new Worker(url);
     try {
-      worker.postMessage(mutableFile);
+      worker1.postMessage(mutableFile);
       ok(false, "Should have thrown!");
     }
     catch (e) {
       ok(e instanceof DOMException, "Got exception.");
       is(e.name, "DataCloneError", "Good error.");
       is(e.code, DOMException.DATA_CLONE_ERR, "Good error code.")
     }
-    worker.terminate();
 
     mutableFile.onerror = errorHandler;
 
     let fileHandle = mutableFile.open("readwrite");
 
     request = fileHandle.write(testBuffer);
     request.onsuccess = grabEventAndContinueHandler;
     event = yield undefined;
 
     request = mutableFile.getFile();
     request.onsuccess = grabEventAndContinueHandler;
     event = yield undefined;
 
     let file = event.target.result;
 
-    worker = new Worker(url);
+    let worker2 = new Worker(url);
     URL.revokeObjectURL(url);
     try {
-      worker.postMessage(file);
+      worker2.postMessage(file);
       ok(false, "Should have thrown!");
     }
     catch (e) {
       ok(e instanceof DOMException, "Got exception.");
       is(e.name, "DataCloneError", "Good error.");
       is(e.code, DOMException.DATA_CLONE_ERR, "Good error code.")
     }
-    worker.terminate();
 
     let objectStore =
       db.transaction("Foo", "readwrite").objectStore("Foo");
 
     request = objectStore.add(mutableFile, 42);
     request.onsuccess = grabEventAndContinueHandler;
     event = yield undefined;
 
@@ -121,24 +119,28 @@
         request.onerror = function(event) {
           postMessage("error");
         }
       }
     }
 
     url = URL.createObjectURL(new Blob(["(", workerScript.toSource(), ")()"]));
 
-    worker = new Worker(url);
+    let worker3 = new Worker(url);
     URL.revokeObjectURL(url);
-    worker.postMessage(name);
-    worker.onmessage = grabEventAndContinueHandler;
+    worker3.postMessage(name);
+    worker3.onmessage = grabEventAndContinueHandler;
     event = yield undefined;
 
     is(event.data, "success", "Good response.");
-    worker.terminate();
+
+    todo(false, "Terminate all workers at the end of the test to work around bug 1340941.");
+    worker1.terminate();
+    worker2.terminate();
+    worker3.terminate();
 
     finishTest();
   }
   </script>
   <script type="text/javascript;version=1.7" src="file.js"></script>
   <script type="text/javascript;version=1.7" src="helpers.js"></script>
 
 </head>