2012-05-29 02:08:20 -07:00
|
|
|
/* vim:set ts=2 sw=2 sts=2 et: */
|
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Make sure that the property view populates the global scope pane.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html";
|
|
|
|
|
|
|
|
var gPane = null;
|
|
|
|
var gTab = null;
|
|
|
|
var gDebugger = null;
|
|
|
|
|
2012-11-15 22:34:13 -08:00
|
|
|
requestLongerTimeout(2);
|
|
|
|
|
2012-05-29 02:08:20 -07:00
|
|
|
function test()
|
|
|
|
{
|
|
|
|
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
|
|
|
|
gTab = aTab;
|
|
|
|
gPane = aPane;
|
2012-11-30 00:07:59 -08:00
|
|
|
gDebugger = gPane.panelWin;
|
2012-05-29 02:08:20 -07:00
|
|
|
|
2012-11-15 22:34:13 -08:00
|
|
|
gDebugger.DebuggerController.StackFrames.autoScopeExpand = true;
|
|
|
|
gDebugger.DebuggerView.Variables.nonEnumVisible = false;
|
2012-05-29 02:08:20 -07:00
|
|
|
testFrameParameters();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function testFrameParameters()
|
|
|
|
{
|
|
|
|
let count = 0;
|
|
|
|
gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
|
|
|
|
// We expect 2 Debugger:FetchedVariables events, one from the global object
|
|
|
|
// scope and the regular one.
|
2012-10-26 10:10:17 -07:00
|
|
|
if (++count < 2) {
|
2012-05-29 02:08:20 -07:00
|
|
|
info("Number of received Debugger:FetchedVariables events: " + count);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
|
|
|
|
Services.tm.currentThread.dispatch({ run: function() {
|
|
|
|
|
2013-06-21 07:33:56 -07:00
|
|
|
var frames = gDebugger.DebuggerView.StackFrames.widget._list,
|
2013-02-20 15:33:36 -08:00
|
|
|
globalScope = gDebugger.DebuggerView.Variables._list.querySelectorAll(".variables-view-scope")[2],
|
|
|
|
globalNodes = globalScope.querySelector(".variables-view-element-details").childNodes;
|
2012-05-29 02:08:20 -07:00
|
|
|
|
|
|
|
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.");
|
|
|
|
|
2012-10-26 10:10:17 -07:00
|
|
|
is(globalNodes[1].querySelector(".name").getAttribute("value"), "SpecialPowers",
|
|
|
|
"Should have the right property name for |SpecialPowers|.");
|
2012-05-29 02:08:20 -07:00
|
|
|
|
2013-04-30 14:44:50 -07:00
|
|
|
is(globalNodes[1].querySelector(".value").getAttribute("value"), "[object Object]",
|
2012-10-26 10:10:17 -07:00
|
|
|
"Should have the right property value for |SpecialPowers|.");
|
2012-05-29 02:08:20 -07:00
|
|
|
|
2013-05-11 02:05:21 -07:00
|
|
|
let globalScopeObject = gDebugger.DebuggerView.Variables.getScopeForNode(globalScope);
|
|
|
|
let documentNode = globalScopeObject.get("document");
|
|
|
|
|
|
|
|
is(documentNode.target.querySelector(".name").getAttribute("value"), "document",
|
2013-04-30 14:44:50 -07:00
|
|
|
"Should have the right property name for |document|.");
|
|
|
|
|
2013-05-11 02:05:21 -07:00
|
|
|
is(documentNode.target.querySelector(".value").getAttribute("value"), "[object HTMLDocument]",
|
2013-04-30 14:44:50 -07:00
|
|
|
"Should have the right property value for |document|.");
|
|
|
|
|
2012-05-29 02:08:20 -07:00
|
|
|
let len = globalNodes.length - 1;
|
2012-10-26 10:10:17 -07:00
|
|
|
is(globalNodes[len].querySelector(".name").getAttribute("value"), "window",
|
|
|
|
"Should have the right property name for |window|.");
|
2012-05-29 02:08:20 -07:00
|
|
|
|
2013-04-30 14:44:50 -07:00
|
|
|
is(globalNodes[len].querySelector(".value").getAttribute("value"), "[object Window]",
|
2012-10-26 10:10:17 -07:00
|
|
|
"Should have the right property value for |window|.");
|
2012-05-29 02:08:20 -07:00
|
|
|
|
|
|
|
resumeAndFinish();
|
|
|
|
}}, 0);
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
EventUtils.sendMouseEvent({ type: "click" },
|
|
|
|
content.document.querySelector("button"),
|
|
|
|
content.window);
|
|
|
|
}
|
|
|
|
|
|
|
|
function resumeAndFinish() {
|
|
|
|
gDebugger.addEventListener("Debugger:AfterFramesCleared", function listener() {
|
|
|
|
gDebugger.removeEventListener("Debugger:AfterFramesCleared", listener, true);
|
|
|
|
Services.tm.currentThread.dispatch({ run: function() {
|
2013-06-21 07:33:56 -07:00
|
|
|
var frames = gDebugger.DebuggerView.StackFrames.widget._list;
|
2012-05-29 02:08:20 -07:00
|
|
|
|
|
|
|
is(frames.querySelectorAll(".dbg-stackframe").length, 0,
|
|
|
|
"Should have no frames.");
|
|
|
|
|
2012-05-31 03:01:13 -07:00
|
|
|
closeDebuggerAndFinish();
|
2012-05-29 02:08:20 -07:00
|
|
|
}}, 0);
|
|
|
|
}, true);
|
|
|
|
|
|
|
|
gDebugger.DebuggerController.activeThread.resume();
|
|
|
|
}
|
|
|
|
|
|
|
|
registerCleanupFunction(function() {
|
|
|
|
removeTab(gTab);
|
|
|
|
gPane = null;
|
|
|
|
gTab = null;
|
|
|
|
gDebugger = null;
|
|
|
|
});
|