browser/devtools/debugger/test/browser_dbg_location-changes-03-new.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:271647ebaa34
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 other sources works.
6 */
7
8 const TAB_URL_1 = EXAMPLE_URL + "doc_recursion-stack.html";
9 const TAB_URL_2 = EXAMPLE_URL + "doc_iframes.html";
10
11 let gTab, gDebuggee, gPanel, gDebugger;
12 let gEditor, gSources, gFrames;
13
14 function test() {
15 initDebugger(TAB_URL_1).then(([aTab, aDebuggee, aPanel]) => {
16 gTab = aTab;
17 gDebuggee = aDebuggee;
18 gPanel = aPanel;
19 gDebugger = gPanel.panelWin;
20 gEditor = gDebugger.DebuggerView.editor;
21 gSources = gDebugger.DebuggerView.Sources;
22 gFrames = gDebugger.DebuggerView.StackFrames;
23
24 waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(testLocationChange);
25 gDebuggee.simpleCall();
26 });
27 }
28
29 function testLocationChange() {
30 navigateActiveTabTo(gPanel, TAB_URL_2, gDebugger.EVENTS.SOURCES_ADDED).then(() => {
31 isnot(gDebugger.gThreadClient.state, "paused",
32 "Should not be paused after a tab navigation.");
33
34 is(gFrames.itemCount, 0,
35 "Should have no frames.");
36
37 is(gSources.itemCount, 1,
38 "Found the expected number of entries in the sources widget.");
39
40 is(gSources.selectedValue, EXAMPLE_URL + "doc_inline-debugger-statement.html",
41 "There should be a selected source value.");
42 isnot(gEditor.getText().length, 0,
43 "The source editor should have some text displayed.");
44 is(gEditor.getText(), gDebugger.L10N.getStr("loadingText"),
45 "The source editor text should not be 'Loading...'");
46
47 is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-text").length, 0,
48 "The sources widget should not display any notice at this point.");
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 });

mercurial