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 * Make sure that changing the tab location URL to a page with other sources works.
6 */
8 const TAB_URL_1 = EXAMPLE_URL + "doc_recursion-stack.html";
9 const TAB_URL_2 = EXAMPLE_URL + "doc_iframes.html";
11 let gTab, gDebuggee, gPanel, gDebugger;
12 let gEditor, gSources, gFrames;
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;
24 waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(testLocationChange);
25 gDebuggee.simpleCall();
26 });
27 }
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.");
34 is(gFrames.itemCount, 0,
35 "Should have no frames.");
37 is(gSources.itemCount, 1,
38 "Found the expected number of entries in the sources widget.");
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...'");
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.");
50 closeDebuggerAndFinish(gPanel);
51 });
52 }
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 });