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.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 /**
5 * Bug 731394: Test the debugger source editor default context menu.
6 */
8 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
10 function test() {
11 let gTab, gDebuggee, gPanel, gDebugger;
12 let gEditor, gSources, gContextMenu;
14 initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
15 gTab = aTab;
16 gDebuggee = aDebuggee;
17 gPanel = aPanel;
18 gDebugger = gPanel.panelWin;
19 gEditor = gDebugger.DebuggerView.editor;
20 gSources = gDebugger.DebuggerView.Sources;
21 gContextMenu = gDebugger.document.getElementById("sourceEditorContextMenu");
23 waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1).then(performTest).then(null, info);
24 gDebuggee.firstCall();
25 });
27 function performTest() {
28 is(gDebugger.gThreadClient.state, "paused",
29 "Should only be getting stack frames while paused.");
30 is(gSources.itemCount, 2,
31 "Found the expected number of sources.");
32 is(gEditor.getText().indexOf("debugger"), 172,
33 "The correct source was loaded initially.");
34 is(gSources.selectedValue, gSources.values[1],
35 "The correct source is selected.");
37 is(gEditor.getText().indexOf("\u263a"), 162,
38 "Unicode characters are converted correctly.");
40 ok(gContextMenu,
41 "The source editor's context menupopup is available.");
42 ok(gEditor.getOption("readOnly"),
43 "The source editor is read only.");
45 gEditor.focus();
46 gEditor.setSelection({ line: 1, ch: 0 }, { line: 1, ch: 10 });
48 once(gContextMenu, "popupshown").then(testContextMenu).then(null, info);
49 gContextMenu.openPopup(gEditor.container, "overlap", 0, 0, true, false);
50 }
52 function testContextMenu() {
53 let document = gDebugger.document;
55 ok(document.getElementById("editMenuCommands"),
56 "#editMenuCommands found.");
57 ok(!document.getElementById("editMenuKeys"),
58 "#editMenuKeys not found.");
60 gContextMenu.hidePopup();
61 resumeDebuggerThenCloseAndFinish(gPanel);
62 }
63 }