dom/workers/test/WorkerTest_subworker.js

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 onmessage = function(event) {
     6   let chromeURL = event.data.replace("test_chromeWorkerJSM.xul",
     7                                      "WorkerTest_badworker.js");
     9   let mochitestURL = event.data.replace("test_chromeWorkerJSM.xul",
    10                                         "WorkerTest_badworker.js")
    11                                .replace("chrome://mochitests/content/chrome",
    12                                         "http://mochi.test:8888/tests");
    14   // We should be able to XHR to anything we want, including a chrome URL.
    15   let xhr = new XMLHttpRequest();
    16   xhr.open("GET", mochitestURL, false);
    17   xhr.send();
    19   if (!xhr.responseText) {
    20     throw "Can't load script file via XHR!";
    21   }
    23   // We shouldn't be able to make a ChromeWorker to a non-chrome URL.
    24   let worker = new ChromeWorker(mochitestURL);
    25   worker.onmessage = function(event) {
    26     throw event.data;
    27   };
    28   worker.onerror = function(event) {
    29     event.preventDefault();
    31     // And we shouldn't be able to make a regular Worker to a non-chrome URL.
    32     worker = new Worker(mochitestURL);
    33     worker.onmessage = function(event) {
    34       throw event.data;
    35     };
    36     worker.onerror = function(event) {
    37       event.preventDefault();
    38       postMessage("Done");
    39     };
    40     worker.postMessage("Hi");
    41   };
    42   worker.postMessage("Hi");
    43 };

mercurial