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/xhr/tests/test_worker_xhr_parameters.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/xhr/tests/test_worker_xhr_parameters.html')
-rw-r--r-- | dom/xhr/tests/test_worker_xhr_parameters.html | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/dom/xhr/tests/test_worker_xhr_parameters.html b/dom/xhr/tests/test_worker_xhr_parameters.html new file mode 100644 index 000000000..ae880aabb --- /dev/null +++ b/dom/xhr/tests/test_worker_xhr_parameters.html @@ -0,0 +1,64 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <title>Test for XMLHttpRequest with system privileges</title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<p id="display"> +</p> +<div id="content" style="display: none"> + +</div> +<pre id="test"> +<script class="testbody" type="application/javascript;version=1.8"> + +function message(event) { + if (event.data.test == 'ok') + ok(event.data.a, event.data.event); + else if(event.data.test == 'is') + is(event.data.a, event.data.b, event.data.event); + else if(event.data.test == 'finish') { + run(); + } +}; + +function test1() { + var worker = new Worker("test_worker_xhr_parameters.js"); + worker.onmessage = message; + + // Run the tests once without API privileges... + worker.postMessage(false); +} + +function test2() { + // ...and once with privileges. + SpecialPowers.pushPermissions([{type: "systemXHR", allow: true, context: document}], + function () { + var worker = new Worker("test_worker_xhr_parameters.js"); + worker.onmessage = message; + worker.postMessage(true); + } + ); +} + +var tests = [ test1, test2 ]; +function run() { + if (!tests.length) { + SimpleTest.finish(); + return; + } + + var func = tests.shift(); + func(); +} + +SimpleTest.waitForExplicitFinish(); +run(); + +</script> +</pre> +</body> +</html> |