|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Make sure that changing the tab location URL works. |
|
6 */ |
|
7 |
|
8 const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; |
|
9 |
|
10 let gTab, gDebuggee, gPanel, gDebugger; |
|
11 let gEditor, gSources, gFrames; |
|
12 |
|
13 function test() { |
|
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 gFrames = gDebugger.DebuggerView.StackFrames; |
|
22 |
|
23 waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(performTest); |
|
24 gDebuggee.simpleCall(); |
|
25 }); |
|
26 } |
|
27 |
|
28 function performTest() { |
|
29 is(gDebugger.gThreadClient.state, "paused", |
|
30 "Should only be getting stack frames while paused."); |
|
31 |
|
32 is(gFrames.itemCount, 1, |
|
33 "Should have only one frame."); |
|
34 |
|
35 is(gSources.itemCount, 1, |
|
36 "Found the expected number of entries in the sources widget."); |
|
37 |
|
38 isnot(gSources.selectedValue, null, |
|
39 "There should be a selected source value."); |
|
40 isnot(gEditor.getText().length, 0, |
|
41 "The source editor should have some text displayed."); |
|
42 isnot(gEditor.getText(), gDebugger.L10N.getStr("loadingText"), |
|
43 "The source editor text should not be 'Loading...'"); |
|
44 |
|
45 is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-notice-container").length, 0, |
|
46 "The sources widget should not display any notice at this point (1)."); |
|
47 is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-notice").length, 0, |
|
48 "The sources widget should not display any notice at this point (2)."); |
|
49 is(gDebugger.document.querySelector("#sources .side-menu-widget-empty-notice > label"), null, |
|
50 "The sources widget should not display a notice at this point (3)."); |
|
51 |
|
52 gDebugger.gThreadClient.resume(() => { |
|
53 testLocationChange(); |
|
54 }); |
|
55 } |
|
56 |
|
57 function testLocationChange() { |
|
58 navigateActiveTabTo(gPanel, "about:blank", gDebugger.EVENTS.SOURCES_ADDED).then(() => { |
|
59 closeDebuggerAndFinish(gPanel); |
|
60 }); |
|
61 } |
|
62 |
|
63 registerCleanupFunction(function() { |
|
64 gTab = null; |
|
65 gDebuggee = null; |
|
66 gPanel = null; |
|
67 gDebugger = null; |
|
68 gEditor = null; |
|
69 gSources = null; |
|
70 gFrames = null; |
|
71 }); |