2012-03-15 01:17:03 -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/
|
|
|
|
*/
|
2012-11-15 22:34:13 -08:00
|
|
|
|
|
|
|
const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html";
|
|
|
|
|
2012-03-15 01:17:03 -07:00
|
|
|
var gPane = null;
|
|
|
|
var gTab = null;
|
|
|
|
var gDebuggee = null;
|
|
|
|
var gDebugger = null;
|
|
|
|
|
2012-11-15 22:34:13 -08:00
|
|
|
requestLongerTimeout(2);
|
2012-05-24 04:23:53 -07:00
|
|
|
|
2012-03-15 01:17:03 -07:00
|
|
|
function test() {
|
2012-05-24 04:23:53 -07:00
|
|
|
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
|
2012-03-15 01:17:03 -07:00
|
|
|
gTab = aTab;
|
|
|
|
gDebuggee = aDebuggee;
|
|
|
|
gPane = aPane;
|
2012-11-27 02:39:10 -08:00
|
|
|
gDebugger = gPane.contentWindow;
|
2012-03-15 01:17:03 -07:00
|
|
|
|
2012-11-15 22:34:13 -08:00
|
|
|
gDebugger.DebuggerController.StackFrames.autoScopeExpand = true;
|
|
|
|
gDebugger.DebuggerView.Variables.nonEnumVisible = false;
|
2012-05-24 04:23:53 -07:00
|
|
|
testFrameEval();
|
2012-03-15 01:17:03 -07:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2012-05-24 04:23:53 -07:00
|
|
|
function testFrameEval() {
|
|
|
|
gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
|
|
|
|
gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
|
2012-03-15 01:17:03 -07:00
|
|
|
Services.tm.currentThread.dispatch({ run: function() {
|
|
|
|
|
2012-05-24 04:23:53 -07:00
|
|
|
is(gDebugger.DebuggerController.activeThread.state, "paused",
|
|
|
|
"Should only be getting stack frames while paused.");
|
2012-03-15 01:17:03 -07:00
|
|
|
|
2012-10-26 10:10:17 -07:00
|
|
|
var localScope = gDebugger.DebuggerView.Variables._list.querySelector(".scope"),
|
2012-05-24 04:23:53 -07:00
|
|
|
localNodes = localScope.querySelector(".details").childNodes,
|
|
|
|
varA = localNodes[7];
|
2012-03-15 01:17:03 -07:00
|
|
|
|
2012-05-20 13:49:51 -07:00
|
|
|
is(varA.querySelector(".name").getAttribute("value"), "a",
|
2012-05-24 04:23:53 -07:00
|
|
|
"Should have the right name for 'a'.");
|
2012-03-15 01:17:03 -07:00
|
|
|
|
2012-05-20 13:49:51 -07:00
|
|
|
is(varA.querySelector(".value").getAttribute("value"), 1,
|
2012-05-24 04:23:53 -07:00
|
|
|
"Should have the right initial value for 'a'.");
|
2012-03-15 01:17:03 -07:00
|
|
|
|
2012-05-24 04:23:53 -07:00
|
|
|
testModification(varA, function(aVar) {
|
|
|
|
testModification(aVar, function(aVar) {
|
|
|
|
testModification(aVar, function(aVar) {
|
|
|
|
resumeAndFinish();
|
|
|
|
}, "document.title", '"Debugger Function Call Parameter Test"');
|
|
|
|
}, "b", "[object Object]");
|
|
|
|
}, "{ a: 1 }", "[object Object]");
|
2012-03-15 01:17:03 -07:00
|
|
|
}}, 0);
|
2012-05-24 04:23:53 -07:00
|
|
|
}, false);
|
2012-03-15 01:17:03 -07:00
|
|
|
|
|
|
|
EventUtils.sendMouseEvent({ type: "click" },
|
2012-05-24 04:23:53 -07:00
|
|
|
content.document.querySelector("button"),
|
|
|
|
content.window);
|
2012-03-15 01:17:03 -07:00
|
|
|
}
|
|
|
|
|
2012-05-24 04:23:53 -07:00
|
|
|
function testModification(aVar, aCallback, aNewValue, aNewResult) {
|
2012-03-15 01:17:03 -07:00
|
|
|
function makeChangesAndExitInputMode() {
|
2012-05-24 04:23:53 -07:00
|
|
|
EventUtils.sendString(aNewValue);
|
|
|
|
EventUtils.sendKey("RETURN");
|
2012-03-15 01:17:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EventUtils.sendMouseEvent({ type: "click" },
|
|
|
|
aVar.querySelector(".value"),
|
|
|
|
gDebugger);
|
|
|
|
|
|
|
|
executeSoon(function() {
|
|
|
|
ok(aVar.querySelector(".element-input"),
|
|
|
|
"There should be an input element created.");
|
|
|
|
|
2012-05-29 02:08:20 -07:00
|
|
|
let count = 0;
|
2012-05-24 04:23:53 -07:00
|
|
|
gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
|
2012-05-29 02:08:20 -07:00
|
|
|
// 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;
|
|
|
|
}
|
2012-05-24 04:23:53 -07:00
|
|
|
gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
|
|
|
|
// Get the variable reference anew, since the old ones were discarded when
|
|
|
|
// we resumed.
|
2012-10-26 10:10:17 -07:00
|
|
|
var localScope = gDebugger.DebuggerView.Variables._list.querySelector(".scope"),
|
2012-05-24 04:23:53 -07:00
|
|
|
localNodes = localScope.querySelector(".details").childNodes,
|
|
|
|
varA = localNodes[7];
|
2012-03-15 01:17:03 -07:00
|
|
|
|
2012-05-20 13:49:51 -07:00
|
|
|
is(varA.querySelector(".value").getAttribute("value"), aNewResult,
|
2012-05-24 04:23:53 -07:00
|
|
|
"Should have the right value for 'a'.");
|
2012-03-15 01:17:03 -07:00
|
|
|
|
|
|
|
executeSoon(function() {
|
2012-05-24 04:23:53 -07:00
|
|
|
aCallback(varA);
|
2012-03-15 01:17:03 -07:00
|
|
|
});
|
2012-05-24 04:23:53 -07:00
|
|
|
}, false);
|
2012-03-15 01:17:03 -07:00
|
|
|
|
|
|
|
makeChangesAndExitInputMode();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function resumeAndFinish() {
|
|
|
|
gDebugger.DebuggerController.activeThread.resume(function() {
|
2012-05-31 03:01:13 -07:00
|
|
|
closeDebuggerAndFinish();
|
2012-03-15 01:17:03 -07:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
registerCleanupFunction(function() {
|
|
|
|
removeTab(gTab);
|
|
|
|
gPane = null;
|
|
|
|
gTab = null;
|
|
|
|
gDebuggee = null;
|
|
|
|
gDebugger = null;
|
|
|
|
});
|