|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Test that black boxed frames are compressed into a single frame on the stack |
|
6 * view. |
|
7 */ |
|
8 |
|
9 const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html"; |
|
10 const BLACKBOXME_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js" |
|
11 |
|
12 let gTab, gDebuggee, gPanel, gDebugger; |
|
13 let gFrames; |
|
14 |
|
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; |
|
22 |
|
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 } |
|
32 |
|
33 function testBlackBoxSource() { |
|
34 return toggleBlackBoxing(gPanel).then(aSource => { |
|
35 ok(aSource.isBlackBoxed, "The source should be black boxed now."); |
|
36 }); |
|
37 } |
|
38 |
|
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 }); |
|
46 |
|
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 } |
|
52 |
|
53 registerCleanupFunction(function() { |
|
54 gTab = null; |
|
55 gDebuggee = null; |
|
56 gPanel = null; |
|
57 gDebugger = null; |
|
58 gFrames = null; |
|
59 }); |