toolkit/devtools/tests/unit/test_invisible_loader.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 Cu.import("resource://gre/modules/jsdebugger.jsm");
     5 addDebuggerToGlobal(this);
     7 const COLOR_URI = "resource://gre/modules/devtools/css-color.js";
     9 /**
    10  * Ensure that sandboxes created via the Dev Tools loader respect the
    11  * invisibleToDebugger flag.
    12  */
    13 function run_test() {
    14   visible_loader();
    15   invisible_loader();
    16 }
    18 function visible_loader() {
    19   let loader = new DevToolsLoader();
    20   loader.invisibleToDebugger = false;
    21   loader.require("devtools/css-color");
    23   let dbg = new Debugger();
    24   let sandbox = loader._provider.loader.sandboxes[COLOR_URI];
    26   try {
    27     dbg.addDebuggee(sandbox);
    28     do_check_true(true);
    29   } catch(e) {
    30     do_throw("debugger could not add visible value");
    31   }
    32 }
    34 function invisible_loader() {
    35   let loader = new DevToolsLoader();
    36   loader.invisibleToDebugger = true;
    37   loader.require("devtools/css-color");
    39   let dbg = new Debugger();
    40   let sandbox = loader._provider.loader.sandboxes[COLOR_URI];
    42   try {
    43     dbg.addDebuggee(sandbox);
    44     do_throw("debugger added invisible value");
    45   } catch(e) {
    46     do_check_true(true);
    47   }
    48 }

mercurial