gecko/browser/devtools/debugger/test/browser_dbg_displayName.js
Victor Porof 469a194377 Bug 802546 - Prettify the Stackframes UI, r=rcampbell
--HG--
rename : browser/devtools/shared/VariablesView.jsm => browser/devtools/shared/widgets/VariablesView.jsm
2013-03-09 21:05:09 -08:00

79 lines
2.2 KiB
JavaScript

/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Tests that anonymous functions appear in the stack frame list with either
// their displayName property or a SpiderMonkey-inferred name.
var gPane = null;
var gTab = null;
var gDebuggee = null;
var gDebugger = null;
const TAB_URL = EXAMPLE_URL + "browser_dbg_displayName.html";
function test() {
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
gTab = aTab;
gDebuggee = aDebuggee;
gPane = aPane;
gDebugger = gPane.panelWin;
testAnonCall();
});
}
function testAnonCall() {
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
Services.tm.currentThread.dispatch({ run: function() {
let frames = gDebugger.DebuggerView.StackFrames._container._list;
is(gDebugger.DebuggerController.activeThread.state, "paused",
"Should only be getting stack frames while paused.");
is(frames.querySelectorAll(".dbg-stackframe").length, 3,
"Should have three frames.");
is(frames.querySelector("#stackframe-0 .dbg-stackframe-title").getAttribute("value"),
"anonFunc", "Frame name should be anonFunc");
testInferredName();
}}, 0);
});
gDebuggee.evalCall();
}
function testInferredName() {
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
Services.tm.currentThread.dispatch({ run: function() {
let frames = gDebugger.DebuggerView.StackFrames._container._list;
is(gDebugger.DebuggerController.activeThread.state, "paused",
"Should only be getting stack frames while paused.");
is(frames.querySelectorAll(".dbg-stackframe").length, 3,
"Should have three frames.");
is(frames.querySelector("#stackframe-0 .dbg-stackframe-title").getAttribute("value"),
"a/<", "Frame name should be a/<");
resumeAndFinish();
}}, 0);
});
gDebugger.DebuggerController.activeThread.resume();
}
function resumeAndFinish() {
gDebugger.DebuggerController.activeThread.resume(function() {
removeTab(gTab);
gPane = null;
gDebuggee = null;
finish();
});
}