diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/filesystem/tests/test_worker_basic.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/filesystem/tests/test_worker_basic.html')
-rw-r--r-- | dom/filesystem/tests/test_worker_basic.html | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/dom/filesystem/tests/test_worker_basic.html b/dom/filesystem/tests/test_worker_basic.html new file mode 100644 index 000000000..fd36faeeb --- /dev/null +++ b/dom/filesystem/tests/test_worker_basic.html @@ -0,0 +1,72 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test for Directory API in workers</title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="text/javascript" src="filesystem_commons.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> + +<body> +<script type="application/javascript;version=1.7"> + +var fileList; + +function create_fileList() { + fileList = document.createElement('input'); + fileList.setAttribute('type', 'file'); + document.body.appendChild(fileList); + + var url = SimpleTest.getTestFileURL("script_fileList.js"); + var script = SpecialPowers.loadChromeScript(url); + + function onOpened(message) { + SpecialPowers.wrap(fileList).mozSetDirectory(message.dir); + script.destroy(); + next(); + } + + script.addMessageListener("dir.opened", onOpened); + script.sendAsyncMessage("dir.open", { path: 'ProfD' }); +} + +function test_worker() { + fileList.getFilesAndDirectories().then(function(array) { + var worker = new Worker('worker_basic.js'); + worker.onmessage = function(e) { + if (e.data.type == 'finish') { + next(); + return; + } + + if (e.data.type == 'test') { + ok(e.data.test, e.data.message); + } + } + + worker.postMessage(array[0]); + }); +} + +var tests = [ + function() { setup_tests(next); }, + + create_fileList, + test_worker, +]; + +function next() { + if (!tests.length) { + SimpleTest.finish(); + return; + } + + var test = tests.shift(); + test(); +} + +SimpleTest.waitForExplicitFinish(); +next(); +</script> +</body> +</html> |