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.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * Make sure that selecting a stack frame loads the right source in the editor |
michael@0 | 6 | * pane and highlights the proper line. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; |
michael@0 | 10 | |
michael@0 | 11 | let gTab, gDebuggee, gPanel, gDebugger; |
michael@0 | 12 | let gEditor, gSources, gFrames, gClassicFrames; |
michael@0 | 13 | |
michael@0 | 14 | function test() { |
michael@0 | 15 | initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { |
michael@0 | 16 | gTab = aTab; |
michael@0 | 17 | gDebuggee = aDebuggee; |
michael@0 | 18 | gPanel = aPanel; |
michael@0 | 19 | gDebugger = gPanel.panelWin; |
michael@0 | 20 | gEditor = gDebugger.DebuggerView.editor; |
michael@0 | 21 | gSources = gDebugger.DebuggerView.Sources; |
michael@0 | 22 | gFrames = gDebugger.DebuggerView.StackFrames; |
michael@0 | 23 | gClassicFrames = gDebugger.DebuggerView.StackFramesClassicList; |
michael@0 | 24 | |
michael@0 | 25 | waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1).then(performTest); |
michael@0 | 26 | gDebuggee.firstCall(); |
michael@0 | 27 | }); |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | function performTest() { |
michael@0 | 31 | is(gFrames.selectedIndex, 3, |
michael@0 | 32 | "Newest frame should be selected by default."); |
michael@0 | 33 | is(gClassicFrames.selectedIndex, 0, |
michael@0 | 34 | "Newest frame should also be selected in the mirrored view."); |
michael@0 | 35 | is(gSources.selectedIndex, 1, |
michael@0 | 36 | "The second source is selected in the widget."); |
michael@0 | 37 | is(gEditor.getText().search(/firstCall/), -1, |
michael@0 | 38 | "The first source is not displayed."); |
michael@0 | 39 | is(gEditor.getText().search(/debugger/), 172, |
michael@0 | 40 | "The second source is displayed."); |
michael@0 | 41 | |
michael@0 | 42 | waitForSourceAndCaret(gPanel, "-01.js", 1).then(waitForTick).then(() => { |
michael@0 | 43 | is(gFrames.selectedIndex, 0, |
michael@0 | 44 | "Oldest frame should be selected after click."); |
michael@0 | 45 | is(gClassicFrames.selectedIndex, 3, |
michael@0 | 46 | "Oldest frame should also be selected in the mirrored view."); |
michael@0 | 47 | is(gSources.selectedIndex, 0, |
michael@0 | 48 | "The first source is now selected in the widget."); |
michael@0 | 49 | is(gEditor.getText().search(/firstCall/), 118, |
michael@0 | 50 | "The first source is displayed."); |
michael@0 | 51 | is(gEditor.getText().search(/debugger/), -1, |
michael@0 | 52 | "The second source is not displayed."); |
michael@0 | 53 | |
michael@0 | 54 | waitForSourceAndCaret(gPanel, "-02.js", 1).then(waitForTick).then(() => { |
michael@0 | 55 | is(gFrames.selectedIndex, 3, |
michael@0 | 56 | "Newest frame should be selected again after click."); |
michael@0 | 57 | is(gClassicFrames.selectedIndex, 0, |
michael@0 | 58 | "Newest frame should also be selected again in the mirrored view."); |
michael@0 | 59 | is(gSources.selectedIndex, 1, |
michael@0 | 60 | "The second source is selected in the widget."); |
michael@0 | 61 | is(gEditor.getText().search(/firstCall/), -1, |
michael@0 | 62 | "The first source is not displayed."); |
michael@0 | 63 | is(gEditor.getText().search(/debugger/), 172, |
michael@0 | 64 | "The second source is displayed."); |
michael@0 | 65 | |
michael@0 | 66 | resumeDebuggerThenCloseAndFinish(gPanel); |
michael@0 | 67 | }); |
michael@0 | 68 | |
michael@0 | 69 | EventUtils.sendMouseEvent({ type: "mousedown" }, |
michael@0 | 70 | gDebugger.document.querySelector("#classic-stackframe-0"), |
michael@0 | 71 | gDebugger); |
michael@0 | 72 | }); |
michael@0 | 73 | |
michael@0 | 74 | EventUtils.sendMouseEvent({ type: "mousedown" }, |
michael@0 | 75 | gDebugger.document.querySelector("#stackframe-3"), |
michael@0 | 76 | gDebugger); |
michael@0 | 77 | } |
michael@0 | 78 | |
michael@0 | 79 | registerCleanupFunction(function() { |
michael@0 | 80 | gTab = null; |
michael@0 | 81 | gDebuggee = null; |
michael@0 | 82 | gPanel = null; |
michael@0 | 83 | gDebugger = null; |
michael@0 | 84 | gEditor = null; |
michael@0 | 85 | gSources = null; |
michael@0 | 86 | gFrames = null; |
michael@0 | 87 | gClassicFrames = null; |
michael@0 | 88 | }); |