Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 | } |