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.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 Cu.import("resource://gre/modules/jsdebugger.jsm");
michael@0 5 addDebuggerToGlobal(this);
michael@0 6
michael@0 7 const COLOR_URI = "resource://gre/modules/devtools/css-color.js";
michael@0 8
michael@0 9 /**
michael@0 10 * Ensure that sandboxes created via the Dev Tools loader respect the
michael@0 11 * invisibleToDebugger flag.
michael@0 12 */
michael@0 13 function run_test() {
michael@0 14 visible_loader();
michael@0 15 invisible_loader();
michael@0 16 }
michael@0 17
michael@0 18 function visible_loader() {
michael@0 19 let loader = new DevToolsLoader();
michael@0 20 loader.invisibleToDebugger = false;
michael@0 21 loader.require("devtools/css-color");
michael@0 22
michael@0 23 let dbg = new Debugger();
michael@0 24 let sandbox = loader._provider.loader.sandboxes[COLOR_URI];
michael@0 25
michael@0 26 try {
michael@0 27 dbg.addDebuggee(sandbox);
michael@0 28 do_check_true(true);
michael@0 29 } catch(e) {
michael@0 30 do_throw("debugger could not add visible value");
michael@0 31 }
michael@0 32 }
michael@0 33
michael@0 34 function invisible_loader() {
michael@0 35 let loader = new DevToolsLoader();
michael@0 36 loader.invisibleToDebugger = true;
michael@0 37 loader.require("devtools/css-color");
michael@0 38
michael@0 39 let dbg = new Debugger();
michael@0 40 let sandbox = loader._provider.loader.sandboxes[COLOR_URI];
michael@0 41
michael@0 42 try {
michael@0 43 dbg.addDebuggee(sandbox);
michael@0 44 do_throw("debugger added invisible value");
michael@0 45 } catch(e) {
michael@0 46 do_check_true(true);
michael@0 47 }
michael@0 48 }

mercurial