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 * Test that black boxed frames are compressed into a single frame on the stack
6 * view.
7 */
9 const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html";
10 const BLACKBOXME_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js"
12 let gTab, gDebuggee, gPanel, gDebugger;
13 let gFrames;
15 function test() {
16 initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
17 gTab = aTab;
18 gDebuggee = aDebuggee;
19 gPanel = aPanel;
20 gDebugger = gPanel.panelWin;
21 gFrames = gDebugger.DebuggerView.StackFrames;
23 waitForSourceShown(gPanel, BLACKBOXME_URL)
24 .then(testBlackBoxSource)
25 .then(testBlackBoxStack)
26 .then(() => resumeDebuggerThenCloseAndFinish(gPanel))
27 .then(null, aError => {
28 ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
29 });
30 });
31 }
33 function testBlackBoxSource() {
34 return toggleBlackBoxing(gPanel).then(aSource => {
35 ok(aSource.isBlackBoxed, "The source should be black boxed now.");
36 });
37 }
39 function testBlackBoxStack() {
40 let finished = waitForSourceAndCaretAndScopes(gPanel, ".html", 21).then(() => {
41 is(gFrames.itemCount, 3,
42 "Should only get 3 frames.");
43 is(gDebugger.document.querySelectorAll(".dbg-stackframe-black-boxed").length, 1,
44 "And one of them should be the combined black boxed frames.");
45 });
47 // Spin the event loop before causing the debuggee to pause, to allow
48 // this function to return first.
49 executeSoon(() => gDebuggee.runTest());
50 return finished;
51 }
53 registerCleanupFunction(function() {
54 gTab = null;
55 gDebuggee = null;
56 gPanel = null;
57 gDebugger = null;
58 gFrames = null;
59 });