michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: /* Bug 646070 */ michael@0: michael@0: let DEVTOOLS_CHROME_ENABLED = "devtools.chrome.enabled"; michael@0: michael@0: function test() michael@0: { michael@0: waitForExplicitFinish(); michael@0: michael@0: Services.prefs.setBoolPref(DEVTOOLS_CHROME_ENABLED, true); michael@0: michael@0: gBrowser.selectedTab = gBrowser.addTab(); michael@0: gBrowser.selectedBrowser.addEventListener("load", function onLoad() { michael@0: gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); michael@0: michael@0: ok(window.Scratchpad, "Scratchpad variable exists"); michael@0: michael@0: openScratchpad(runTests); michael@0: }, true); michael@0: michael@0: content.location = "data:text/html,Scratchpad test for bug 646070 - chrome context preference"; michael@0: } michael@0: michael@0: function runTests() michael@0: { michael@0: let sp = gScratchpadWindow.Scratchpad; michael@0: ok(sp, "Scratchpad object exists in new window"); michael@0: michael@0: let environmentMenu = gScratchpadWindow.document. michael@0: getElementById("sp-environment-menu"); michael@0: ok(environmentMenu, "Environment menu element exists"); michael@0: ok(!environmentMenu.hasAttribute("hidden"), michael@0: "Environment menu is visible"); michael@0: michael@0: let errorConsoleCommand = gScratchpadWindow.document. michael@0: getElementById("sp-cmd-errorConsole"); michael@0: ok(errorConsoleCommand, "Error console command element exists"); michael@0: ok(!errorConsoleCommand.hasAttribute("disabled"), michael@0: "Error console command is enabled"); michael@0: michael@0: let chromeContextCommand = gScratchpadWindow.document. michael@0: getElementById("sp-cmd-browserContext"); michael@0: ok(chromeContextCommand, "Chrome context command element exists"); michael@0: ok(!chromeContextCommand.hasAttribute("disabled"), michael@0: "Chrome context command is disabled"); michael@0: michael@0: Services.prefs.clearUserPref(DEVTOOLS_CHROME_ENABLED); michael@0: michael@0: finish(); michael@0: }