Backed out changeset 06f41c22f3a6 (bug 1888460) for causing linux xpcshell failures...
[gecko.git] / dom / workers / test / test_bug1317725.html
blob7da3fc26444bad99d5722c20a701bf4acc19493a
1 <!--
2 Any copyright is dedicated to the Public Domain.
3 http://creativecommons.org/publicdomain/zero/1.0/
4 -->
5 <!DOCTYPE HTML>
6 <html>
7 <head>
8 <title>Test for bug 1317725</title>
9 <script src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
11 </head>
12 <body>
14 <input type="file" id="file" />
16 <script class="testbody" type="text/javascript">
18 SimpleTest.waitForExplicitFinish();
20 var url = SimpleTest.getTestFileURL("script_createFile.js");
21 script = SpecialPowers.loadChromeScript(url);
23 function onOpened(message) {
24 var input = document.getElementById('file');
25 SpecialPowers.wrap(input).mozSetFileArray([message.data]);
27 var worker = new Worker("test_bug1317725.js");
28 worker.onerror = function(e) {
29 ok(false, "We should not see any error.");
30 SimpleTest.finish();
33 worker.onmessage = function(e) {
34 ok(e.data, "Everything seems OK on the worker-side.");
35 SimpleTest.finish();
38 is(input.files.length, 1, "We have something");
39 ok(input.files[0] instanceof Blob, "We have one Blob");
40 worker.postMessage(input.files[0]);
43 script.addMessageListener("file.opened", onOpened);
44 script.sendAsyncMessage("file.open");
46 </script>
47 </pre>
48 </body>
49 </html>