|
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 when we are already paused. |
|
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 waitForSourceAndCaretAndScopes(gPanel, ".html", 21) |
|
24 .then(testBlackBoxStack) |
|
25 .then(testBlackBoxSource) |
|
26 .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) |
|
27 .then(null, aError => { |
|
28 ok(false, "Got an error: " + aError.message + "\n" + aError.stack); |
|
29 }); |
|
30 |
|
31 gDebuggee.runTest(); |
|
32 }); |
|
33 } |
|
34 |
|
35 function testBlackBoxStack() { |
|
36 is(gFrames.itemCount, 6, |
|
37 "Should get 6 frames."); |
|
38 is(gDebugger.document.querySelectorAll(".dbg-stackframe-black-boxed").length, 0, |
|
39 "And none of them are black boxed."); |
|
40 } |
|
41 |
|
42 function testBlackBoxSource() { |
|
43 return toggleBlackBoxing(gPanel, BLACKBOXME_URL).then(aSource => { |
|
44 ok(aSource.isBlackBoxed, "The source should be black boxed now."); |
|
45 |
|
46 is(gFrames.itemCount, 3, |
|
47 "Should only get 3 frames."); |
|
48 is(gDebugger.document.querySelectorAll(".dbg-stackframe-black-boxed").length, 1, |
|
49 "And one of them should be the combined black boxed frames."); |
|
50 }); |
|
51 } |
|
52 |
|
53 registerCleanupFunction(function() { |
|
54 gTab = null; |
|
55 gDebuggee = null; |
|
56 gPanel = null; |
|
57 gDebugger = null; |
|
58 gFrames = null; |
|
59 }); |