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 * Tests that iframes can be added as debuggees.
6 */
8 const TAB_URL = EXAMPLE_URL + "doc_iframes.html";
10 function test() {
11 let gTab, gDebuggee, gPanel, gDebugger;
12 let gIframe, gEditor, gSources, gFrames;
14 initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
15 gTab = aTab;
16 gDebuggee = aDebuggee;
17 gPanel = aPanel;
18 gDebugger = gPanel.panelWin;
19 gIframe = gDebuggee.frames[0];
20 gEditor = gDebugger.DebuggerView.editor;
21 gSources = gDebugger.DebuggerView.Sources;
22 gFrames = gDebugger.DebuggerView.StackFrames;
24 waitForSourceShown(gPanel, "inline-debugger-statement.html")
25 .then(checkIframeSource)
26 .then(checkIframePause)
27 .then(() => resumeDebuggerThenCloseAndFinish(gPanel))
28 .then(null, aError => {
29 ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
30 });
31 });
33 function checkIframeSource() {
34 is(gDebugger.gThreadClient.paused, false,
35 "Should be running after starting the test.");
37 ok(isCaretPos(gPanel, 1),
38 "The source editor caret position was incorrect.");
39 is(gFrames.itemCount, 0,
40 "Should have only no frames.");
42 is(gSources.itemCount, 1,
43 "Found the expected number of entries in the sources widget.");
44 is(gEditor.getText().indexOf("debugger"), 348,
45 "The correct source was loaded initially.");
46 is(gSources.selectedValue, EXAMPLE_URL + "doc_inline-debugger-statement.html",
47 "The currently selected source value is incorrect (0).");
48 is(gSources.selectedValue, gSources.values[0],
49 "The currently selected source value is incorrect (1).");
50 }
52 function checkIframePause() {
53 // Spin the event loop before causing the debuggee to pause, to allow
54 // this function to return first.
55 executeSoon(() => gIframe.runDebuggerStatement());
57 return waitForCaretAndScopes(gPanel, 16).then(() => {
58 is(gDebugger.gThreadClient.paused, true,
59 "Should be paused after an interrupt request.");
61 ok(isCaretPos(gPanel, 16),
62 "The source editor caret position was incorrect.");
63 is(gFrames.itemCount, 1,
64 "Should have only one frame.");
65 });
66 }
67 }