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 * Tests that anonymous functions appear in the stack frame list with either
6 * their displayName property or a SpiderMonkey-inferred name.
7 */
9 const TAB_URL = EXAMPLE_URL + "doc_function-display-name.html";
11 let gTab, gDebuggee, gPanel, gDebugger;
13 function test() {
14 initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
15 gTab = aTab;
16 gDebuggee = aDebuggee;
17 gPanel = aPanel;
18 gDebugger = gPanel.panelWin;
20 testAnonCall();
21 });
22 }
24 function testAnonCall() {
25 waitForSourceAndCaretAndScopes(gPanel, ".html", 15).then(() => {
26 ok(isCaretPos(gPanel, 15),
27 "The source editor caret position was incorrect.");
28 is(gDebugger.gThreadClient.state, "paused",
29 "Should only be getting stack frames while paused.");
30 is(gDebugger.document.querySelectorAll(".dbg-stackframe").length, 3,
31 "Should have three frames.");
32 is(gDebugger.document.querySelector("#stackframe-0 .dbg-stackframe-title").getAttribute("value"),
33 "anonFunc", "Frame name should be 'anonFunc'.");
35 testInferredName();
36 });
38 gDebuggee.evalCall();
39 }
41 function testInferredName() {
42 waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES).then(() => {
43 ok(isCaretPos(gPanel, 15),
44 "The source editor caret position was incorrect.");
45 is(gDebugger.gThreadClient.state, "paused",
46 "Should only be getting stack frames while paused.");
47 is(gDebugger.document.querySelectorAll(".dbg-stackframe").length, 3,
48 "Should have three frames.");
49 is(gDebugger.document.querySelector("#stackframe-0 .dbg-stackframe-title").getAttribute("value"),
50 "a/<", "Frame name should be 'a/<'.");
52 resumeDebuggerThenCloseAndFinish(gPanel);
53 });
55 gDebugger.gThreadClient.resume();
56 }
58 registerCleanupFunction(function() {
59 gTab = null;
60 gDebuggee = null;
61 gPanel = null;
62 gDebugger = null;
63 });