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 works.
6 */
8 const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
10 let gTab, gDebuggee, gPanel, gDebugger;
11 let gEditor, gSources, gFrames;
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;
23 waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(performTest);
24 gDebuggee.simpleCall();
25 });
26 }
28 function performTest() {
29 is(gDebugger.gThreadClient.state, "paused",
30 "Should only be getting stack frames while paused.");
32 is(gFrames.itemCount, 1,
33 "Should have only one frame.");
35 is(gSources.itemCount, 1,
36 "Found the expected number of entries in the sources widget.");
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...'");
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).");
52 gDebugger.gThreadClient.resume(() => {
53 testLocationChange();
54 });
55 }
57 function testLocationChange() {
58 navigateActiveTabTo(gPanel, "about:blank", gDebugger.EVENTS.SOURCES_ADDED).then(() => {
59 closeDebuggerAndFinish(gPanel);
60 });
61 }
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 });