Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!-- |
michael@0 | 2 | Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 4 | --> |
michael@0 | 5 | <!DOCTYPE HTML> |
michael@0 | 6 | <html> |
michael@0 | 7 | <head> |
michael@0 | 8 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"> |
michael@0 | 9 | </script> |
michael@0 | 10 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 11 | </head> |
michael@0 | 12 | <body> |
michael@0 | 13 | <script type="text/javascript"> |
michael@0 | 14 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 15 | |
michael@0 | 16 | const enabledPref = "dom.workers.enabled"; |
michael@0 | 17 | |
michael@0 | 18 | is(SpecialPowers.getBoolPref(enabledPref), true, |
michael@0 | 19 | "Workers should be enabled."); |
michael@0 | 20 | |
michael@0 | 21 | SpecialPowers.pushPrefEnv({"set": [[enabledPref, false]]}, test1); |
michael@0 | 22 | |
michael@0 | 23 | function test1() { |
michael@0 | 24 | ok(!("Worker" in window), "Worker constructor should not be available."); |
michael@0 | 25 | |
michael@0 | 26 | var exception; |
michael@0 | 27 | try { |
michael@0 | 28 | var worker = new Worker("workersDisabled_worker.js"); |
michael@0 | 29 | } |
michael@0 | 30 | catch(e) { |
michael@0 | 31 | exception = e; |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | ok(exception, "Shouldn't be able to make a worker."); |
michael@0 | 35 | |
michael@0 | 36 | SpecialPowers.pushPrefEnv({"set": [[enabledPref, true]]}, test2); |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | function test2() { |
michael@0 | 40 | ok(("Worker" in window), "Worker constructor should be available."); |
michael@0 | 41 | |
michael@0 | 42 | const message = "Hi"; |
michael@0 | 43 | |
michael@0 | 44 | var worker = new Worker("workersDisabled_worker.js"); |
michael@0 | 45 | worker.onmessage = function(event) { |
michael@0 | 46 | is(event.data, message, "Good message."); |
michael@0 | 47 | SimpleTest.finish(); |
michael@0 | 48 | } |
michael@0 | 49 | worker.postMessage(message); |
michael@0 | 50 | } |
michael@0 | 51 | </script> |
michael@0 | 52 | </body> |
michael@0 | 53 | </html> |
michael@0 | 54 |