dom/workers/test/test_workersDisabled.xul

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <!--
michael@0 3 Any copyright is dedicated to the Public Domain.
michael@0 4 http://creativecommons.org/publicdomain/zero/1.0/
michael@0 5 -->
michael@0 6 <window title="DOM Worker Threads Test"
michael@0 7 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 8 onload="test();">
michael@0 9 <script type="application/javascript"
michael@0 10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
michael@0 11 <script type="application/javascript" src="dom_worker_helper.js"/>
michael@0 12
michael@0 13 <script type="application/javascript">
michael@0 14 <![CDATA[
michael@0 15 function test()
michael@0 16 {
michael@0 17 const enabledPref = "dom.workers.enabled";
michael@0 18 const message = "Hi";
michael@0 19
michael@0 20 var prefs = Components.classes["@mozilla.org/preferences-service;1"]
michael@0 21 .getService(Components.interfaces.nsIPrefBranch);
michael@0 22 is(prefs.getBoolPref(enabledPref), true, "Workers should be enabled.");
michael@0 23
michael@0 24 prefs.setBoolPref(enabledPref, false);
michael@0 25
michael@0 26 ok("Worker" in window, "Worker constructor should be available.");
michael@0 27 ok("ChromeWorker" in window,
michael@0 28 "ChromeWorker constructor should be available.");
michael@0 29
michael@0 30 var worker = new ChromeWorker("workersDisabled_worker.js");
michael@0 31 worker.onmessage = function(event) {
michael@0 32 is(event.data, message, "Good message.");
michael@0 33 prefs.clearUserPref(enabledPref);
michael@0 34 finish();
michael@0 35 }
michael@0 36 worker.postMessage(message);
michael@0 37
michael@0 38 waitForWorkerFinish();
michael@0 39 }
michael@0 40 ]]>
michael@0 41 </script>
michael@0 42
michael@0 43 <body xmlns="http://www.w3.org/1999/xhtml">
michael@0 44 <p id="display"></p>
michael@0 45 <div id="content" style="display:none;"></div>
michael@0 46 <pre id="test"></pre>
michael@0 47 </body>
michael@0 48 <label id="test-result"/>
michael@0 49 </window>

mercurial