toolkit/components/osfile/tests/mochi/worker_handler.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 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/ */
     4 function worker_handler(worker) {
     5   worker.onerror = function(error) {
     6     error.preventDefault();
     7     ok(false, "Worker error " + error.message);
     8   }
     9   worker.onmessage = function(msg) {
    10     ok(true, "MAIN: onmessage " + JSON.stringify(msg.data));
    11     switch (msg.data.kind) {
    12     case "is":
    13       SimpleTest.ok(msg.data.outcome, msg.data.description +
    14          "( "+ msg.data.a + " ==? " + msg.data.b + ")" );
    15       return;
    16     case "isnot":
    17       SimpleTest.ok(msg.data.outcome, msg.data.description +
    18       "( "+ msg.data.a + " !=? " + msg.data.b + ")" );
    19          return;
    20     case "ok":
    21       SimpleTest.ok(msg.data.condition, msg.data.description);
    22       return;
    23     case "info":
    24       SimpleTest.info(msg.data.description);
    25       return;
    26     case "finish":
    27       SimpleTest.finish();
    28       return;
    29     default:
    30       SimpleTest.ok(false, "test_osfile.xul: wrong message " + JSON.stringify(msg.data));
    31       return;
    32     }
    33   };
    34 }

mercurial