browser/devtools/scratchpad/test/browser_scratchpad_chrome_context_pref.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* vim: set ts=2 et sw=2 tw=80: */
michael@0 2 /* Any copyright is dedicated to the Public Domain.
michael@0 3 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 4 /* Bug 646070 */
michael@0 5
michael@0 6 let DEVTOOLS_CHROME_ENABLED = "devtools.chrome.enabled";
michael@0 7
michael@0 8 function test()
michael@0 9 {
michael@0 10 waitForExplicitFinish();
michael@0 11
michael@0 12 Services.prefs.setBoolPref(DEVTOOLS_CHROME_ENABLED, true);
michael@0 13
michael@0 14 gBrowser.selectedTab = gBrowser.addTab();
michael@0 15 gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
michael@0 16 gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
michael@0 17
michael@0 18 ok(window.Scratchpad, "Scratchpad variable exists");
michael@0 19
michael@0 20 openScratchpad(runTests);
michael@0 21 }, true);
michael@0 22
michael@0 23 content.location = "data:text/html,Scratchpad test for bug 646070 - chrome context preference";
michael@0 24 }
michael@0 25
michael@0 26 function runTests()
michael@0 27 {
michael@0 28 let sp = gScratchpadWindow.Scratchpad;
michael@0 29 ok(sp, "Scratchpad object exists in new window");
michael@0 30
michael@0 31 let environmentMenu = gScratchpadWindow.document.
michael@0 32 getElementById("sp-environment-menu");
michael@0 33 ok(environmentMenu, "Environment menu element exists");
michael@0 34 ok(!environmentMenu.hasAttribute("hidden"),
michael@0 35 "Environment menu is visible");
michael@0 36
michael@0 37 let errorConsoleCommand = gScratchpadWindow.document.
michael@0 38 getElementById("sp-cmd-errorConsole");
michael@0 39 ok(errorConsoleCommand, "Error console command element exists");
michael@0 40 ok(!errorConsoleCommand.hasAttribute("disabled"),
michael@0 41 "Error console command is enabled");
michael@0 42
michael@0 43 let chromeContextCommand = gScratchpadWindow.document.
michael@0 44 getElementById("sp-cmd-browserContext");
michael@0 45 ok(chromeContextCommand, "Chrome context command element exists");
michael@0 46 ok(!chromeContextCommand.hasAttribute("disabled"),
michael@0 47 "Chrome context command is disabled");
michael@0 48
michael@0 49 Services.prefs.clearUserPref(DEVTOOLS_CHROME_ENABLED);
michael@0 50
michael@0 51 finish();
michael@0 52 }

mercurial