|
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 to a page with no sources 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(testLocationChange); |
|
24 gDebuggee.simpleCall(); |
|
25 }); |
|
26 } |
|
27 |
|
28 function testLocationChange() { |
|
29 navigateActiveTabTo(gPanel, "about:blank", gDebugger.EVENTS.SOURCES_ADDED).then(() => { |
|
30 isnot(gDebugger.gThreadClient.state, "paused", |
|
31 "Should not be paused after a tab navigation."); |
|
32 |
|
33 is(gFrames.itemCount, 0, |
|
34 "Should have no frames."); |
|
35 |
|
36 is(gSources.itemCount, 0, |
|
37 "Found no entries in the sources widget."); |
|
38 |
|
39 is(gSources.selectedValue, "", |
|
40 "There should be no selected source value."); |
|
41 is(gEditor.getText().length, 0, |
|
42 "The source editor should not have any text displayed."); |
|
43 |
|
44 is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-text").length, 1, |
|
45 "The sources widget should now display a notice (1)."); |
|
46 is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-text")[0].getAttribute("value"), |
|
47 gDebugger.L10N.getStr("noSourcesText"), |
|
48 "The sources widget should now display a notice (2)."); |
|
49 |
|
50 closeDebuggerAndFinish(gPanel); |
|
51 }); |
|
52 } |
|
53 |
|
54 registerCleanupFunction(function() { |
|
55 gTab = null; |
|
56 gDebuggee = null; |
|
57 gPanel = null; |
|
58 gDebugger = null; |
|
59 gEditor = null; |
|
60 gSources = null; |
|
61 gFrames = null; |
|
62 }); |