browser/devtools/debugger/test/browser_dbg_blackboxing-03.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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 when we are already paused.
     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     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       });
    31     gDebuggee.runTest();
    32   });
    33 }
    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 }
    42 function testBlackBoxSource() {
    43   return toggleBlackBoxing(gPanel, BLACKBOXME_URL).then(aSource => {
    44     ok(aSource.isBlackBoxed, "The source should be black boxed now.");
    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 }
    53 registerCleanupFunction(function() {
    54   gTab = null;
    55   gDebuggee = null;
    56   gPanel = null;
    57   gDebugger = null;
    58   gFrames = null;
    59 });

mercurial