dom/workers/test/test_workersDisabled.html

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.

     1 <!--
     2   Any copyright is dedicated to the Public Domain.
     3   http://creativecommons.org/publicdomain/zero/1.0/
     4 -->
     5 <!DOCTYPE HTML>
     6 <html>
     7   <head>
     8     <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js">
     9     </script>
    10     <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    11   </head>
    12   <body>
    13     <script type="text/javascript">
    14       SimpleTest.waitForExplicitFinish();
    16       const enabledPref = "dom.workers.enabled";
    18       is(SpecialPowers.getBoolPref(enabledPref), true,
    19          "Workers should be enabled.");
    21       SpecialPowers.pushPrefEnv({"set": [[enabledPref, false]]}, test1);
    23       function test1() {
    24         ok(!("Worker" in window), "Worker constructor should not be available.");
    26         var exception;
    27         try {
    28           var worker = new Worker("workersDisabled_worker.js");
    29         }
    30         catch(e) {
    31           exception = e;
    32         }
    34         ok(exception, "Shouldn't be able to make a worker.");
    36         SpecialPowers.pushPrefEnv({"set": [[enabledPref, true]]}, test2);
    37       }
    39       function test2() {
    40         ok(("Worker" in window), "Worker constructor should be available.");
    42         const message = "Hi";
    44         var worker = new Worker("workersDisabled_worker.js");
    45         worker.onmessage = function(event) {
    46           is(event.data, message, "Good message.");
    47           SimpleTest.finish();
    48         }
    49         worker.postMessage(message);
    50       }
    51     </script>
    52   </body>
    53 </html>

mercurial