michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: Cu.import("resource://gre/modules/jsdebugger.jsm"); michael@0: addDebuggerToGlobal(this); michael@0: michael@0: const COLOR_URI = "resource://gre/modules/devtools/css-color.js"; michael@0: michael@0: /** michael@0: * Ensure that sandboxes created via the Dev Tools loader respect the michael@0: * invisibleToDebugger flag. michael@0: */ michael@0: function run_test() { michael@0: visible_loader(); michael@0: invisible_loader(); michael@0: } michael@0: michael@0: function visible_loader() { michael@0: let loader = new DevToolsLoader(); michael@0: loader.invisibleToDebugger = false; michael@0: loader.require("devtools/css-color"); michael@0: michael@0: let dbg = new Debugger(); michael@0: let sandbox = loader._provider.loader.sandboxes[COLOR_URI]; michael@0: michael@0: try { michael@0: dbg.addDebuggee(sandbox); michael@0: do_check_true(true); michael@0: } catch(e) { michael@0: do_throw("debugger could not add visible value"); michael@0: } michael@0: } michael@0: michael@0: function invisible_loader() { michael@0: let loader = new DevToolsLoader(); michael@0: loader.invisibleToDebugger = true; michael@0: loader.require("devtools/css-color"); michael@0: michael@0: let dbg = new Debugger(); michael@0: let sandbox = loader._provider.loader.sandboxes[COLOR_URI]; michael@0: michael@0: try { michael@0: dbg.addDebuggee(sandbox); michael@0: do_throw("debugger added invisible value"); michael@0: } catch(e) { michael@0: do_check_true(true); michael@0: } michael@0: }