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