4 <title>Test for Directory API in workers
</title>
5 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
6 <script type=
"text/javascript" src=
"filesystem_commons.js"></script>
7 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
11 <script type=
"application/javascript">
15 function create_fileList() {
16 fileList = document.createElement(
"input");
17 fileList.setAttribute(
"type",
"file");
18 document.body.appendChild(fileList);
20 var url = SimpleTest.getTestFileURL(
"script_fileList.js");
21 var script = SpecialPowers.loadChromeScript(url);
23 function onOpened(message) {
24 SpecialPowers.wrap(fileList).mozSetDirectory(message.dir);
29 script.addMessageListener(
"dir.opened", onOpened);
30 script.sendAsyncMessage(
"dir.open", { path:
"test" });
33 function test_worker() {
34 SpecialPowers.wrap(fileList).getFilesAndDirectories().then(function(array) {
35 array = SpecialPowers.unwrap(array);
36 var worker = new Worker(
"worker_basic.js");
37 worker.onmessage = function(e) {
38 if (e.data.type ==
"finish") {
43 if (e.data.type ==
"test") {
44 ok(e.data.test, e.data.message);
48 worker.postMessage(array[
0]);
53 function() { setup_tests(next); },
65 var test = tests.shift();
69 SimpleTest.waitForExplicitFinish();