dom/workers/test/test_bug883784.jsm

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 this.EXPORTED_SYMBOLS = ["Test"];
     3 this.Test = {
     4   start: function(ok, is, finish) {
     5     let worker = new ChromeWorker("jsm_url_worker.js");
     6     worker.onmessage = function(event) {
     8       if (event.data.type == 'finish') {
     9         finish();
    10       } else if (event.data.type == 'status') {
    11         ok(event.data.status, event.data.msg);
    12       } else if (event.data.type == 'url') {
    13         var xhr = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
    14                   .createInstance(Components.interfaces.nsIXMLHttpRequest);
    15         xhr.open('GET', event.data.url, false);
    16         xhr.onreadystatechange = function() {
    17           if (xhr.readyState == 4) {
    18             ok(true, "Blob readable!");
    19           }
    20         }
    21         xhr.send();
    22       }
    23     };
    25     var self = this;
    26     worker.onerror = function(event) {
    27       is(event.target, worker);
    28       ok(false, "Worker had an error: " + event.data);
    29       self.worker.terminate();
    30       finish();
    31     };
    33     worker.postMessage(0);
    34   }
    35 };

mercurial