Bug 1359357 - Test for IPCBlob and workers, r=smaug
☠☠ backed out by 56db34f604cf ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Fri, 19 May 2017 07:57:25 +0200
changeset 359254 a20220d687d40361480f161c378cb389220f1ef7
parent 359253 9f71fb3f4d1e6469cdf99aa0a63e1e696d510f31
child 359255 37b33385378f97d52b38dfb140ca2be2ec9115f3
push id31850
push userryanvm@gmail.com
push dateFri, 19 May 2017 15:47:16 +0000
treeherdermozilla-central@c800b6dfca67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1359357
milestone55.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 1359357 - Test for IPCBlob and workers, r=smaug
dom/file/ipc/tests/mochitest.ini
dom/file/ipc/tests/test_ipcBlob_workers.html
--- a/dom/file/ipc/tests/mochitest.ini
+++ b/dom/file/ipc/tests/mochitest.ini
@@ -1,5 +1,6 @@
 [DEFAULT]
 support-files =
   script_file.js
 
 [test_ipcBlob_fileReaderSync.html]
+[test_ipcBlob_workers.html]
new file mode 100644
--- /dev/null
+++ b/dom/file/ipc/tests/test_ipcBlob_workers.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test IPCBlob and Workers</title>
+  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script type="text/javascript">
+
+function workerScript() {
+  let bc = new BroadcastChannel('foo');
+  bc.onmessage = (event) => {
+
+    let reader = new FileReader();
+    reader.readAsText(event.data);
+    reader.onloadend = () => {
+      let status = reader.result == 'hello world';
+      bc.onmessage = null;
+      postMessage(status);
+    }
+  }
+
+  postMessage("start");
+}
+
+let workerUrl = URL.createObjectURL(new Blob(["(", workerScript.toSource(), ")()"]));
+let worker = new Worker(workerUrl);
+worker.onmessage = event => {
+  if (event.data == "start") {
+    let bc = new BroadcastChannel('foo');
+    bc.postMessage(new Blob(['hello world']));
+  } else {
+    ok(event.data, "All is done!");
+    SimpleTest.finish();
+  }
+};
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+</pre>
+</body>
+</html>