mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-07 11:56:51 +00:00
9b762a09b1
--HG-- rename : browser/devtools/debugger/test/browser_dbg_propertyview-02.js => browser/devtools/debugger/test/browser_dbg_variables-view-01.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-03.js => browser/devtools/debugger/test/browser_dbg_variables-view-02.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-04.js => browser/devtools/debugger/test/browser_dbg_variables-view-03.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-05.js => browser/devtools/debugger/test/browser_dbg_variables-view-04.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-06.js => browser/devtools/debugger/test/browser_dbg_variables-view-05.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-data.js => browser/devtools/debugger/test/browser_dbg_variables-view-data.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-01.js => browser/devtools/debugger/test/browser_dbg_variables-view-edit-getset-01.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-data-getset-02.js => browser/devtools/debugger/test/browser_dbg_variables-view-edit-getset-02.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-edit-value.js => browser/devtools/debugger/test/browser_dbg_variables-view-edit-value.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-edit-watch.js => browser/devtools/debugger/test/browser_dbg_variables-view-edit-watch.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-01.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-01.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-02.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-02.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-05.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-03.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-06.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-04.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-08.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-05.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-filter-03.js => browser/devtools/debugger/test/browser_dbg_variables-view-filter-pref.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-08.js => browser/devtools/debugger/test/browser_dbg_variables-view-frame-parameters-01.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-07.js => browser/devtools/debugger/test/browser_dbg_variables-view-frame-parameters-02.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-09.js => browser/devtools/debugger/test/browser_dbg_variables-view-frame-parameters-03.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-10.js => browser/devtools/debugger/test/browser_dbg_variables-view-frame-with.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-12.js => browser/devtools/debugger/test/browser_dbg_variables-view-frozen-sealed-nonext.js rename : browser/devtools/debugger/test/browser_dbg_bug786070_hide_nonenums.js => browser/devtools/debugger/test/browser_dbg_variables-view-hide-non-enums.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-data-big.js => browser/devtools/debugger/test/browser_dbg_variables-view-large-array-buffer.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-reexpand.js => browser/devtools/debugger/test/browser_dbg_variables-view-reexpand-01.js rename : browser/devtools/debugger/test/browser_dbg_propertyview-11.js => browser/devtools/debugger/test/browser_dbg_variables-view-webidl.js
90 lines
3.0 KiB
JavaScript
90 lines
3.0 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
/**
|
|
* Make sure that the editing variables or properties values works properly.
|
|
*/
|
|
|
|
const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
|
|
|
|
let gTab, gDebuggee, gPanel, gDebugger;
|
|
let gVars;
|
|
|
|
function test() {
|
|
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
|
|
gTab = aTab;
|
|
gDebuggee = aDebuggee;
|
|
gPanel = aPanel;
|
|
gDebugger = gPanel.panelWin;
|
|
gVars = gDebugger.DebuggerView.Variables;
|
|
|
|
waitForSourceAndCaretAndScopes(gPanel, ".html", 24)
|
|
.then(() => initialChecks())
|
|
.then(() => testModification("a", "1"))
|
|
.then(() => testModification("{ a: 1 }", "Object"))
|
|
.then(() => testModification("[a]", "Array"))
|
|
.then(() => testModification("b", "Object"))
|
|
.then(() => testModification("b.a", "1"))
|
|
.then(() => testModification("c.a", "1"))
|
|
.then(() => testModification("Infinity", "Infinity"))
|
|
.then(() => testModification("NaN", "NaN"))
|
|
.then(() => testModification("new Function", "Function"))
|
|
.then(() => testModification("+0", "0"))
|
|
.then(() => testModification("-0", "-0"))
|
|
.then(() => testModification("Object.keys({})", "Array"))
|
|
.then(() => testModification("document.title", '"Debugger test page"'))
|
|
.then(() => resumeDebuggerThenCloseAndFinish(gPanel))
|
|
.then(null, aError => {
|
|
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
|
});
|
|
|
|
EventUtils.sendMouseEvent({ type: "click" },
|
|
gDebuggee.document.querySelector("button"),
|
|
gDebuggee);
|
|
});
|
|
}
|
|
|
|
function initialChecks() {
|
|
let localScope = gVars.getScopeAtIndex(0);
|
|
let aVar = localScope.get("a");
|
|
|
|
is(aVar.target.querySelector(".name").getAttribute("value"), "a",
|
|
"Should have the right name for 'a'.");
|
|
is(aVar.target.querySelector(".value").getAttribute("value"), "1",
|
|
"Should have the right initial value for 'a'.");
|
|
}
|
|
|
|
function testModification(aNewValue, aNewResult) {
|
|
let localScope = gVars.getScopeAtIndex(0);
|
|
let aVar = localScope.get("a");
|
|
|
|
// Allow the target variable to get painted, so that clicking on
|
|
// its value would scroll the new textbox node into view.
|
|
executeSoon(() => {
|
|
let varValue = aVar.target.querySelector(".title > .value");
|
|
EventUtils.sendMouseEvent({ type: "mousedown" }, varValue, gDebugger);
|
|
|
|
let varInput = aVar.target.querySelector(".title > .element-value-input");
|
|
setText(varInput, aNewValue);
|
|
EventUtils.sendKey("RETURN", gDebugger);
|
|
});
|
|
|
|
return waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES).then(() => {
|
|
let localScope = gVars.getScopeAtIndex(0);
|
|
let aVar = localScope.get("a");
|
|
|
|
is(aVar.target.querySelector(".name").getAttribute("value"), "a",
|
|
"Should have the right name for 'a'.");
|
|
is(aVar.target.querySelector(".value").getAttribute("value"), aNewResult,
|
|
"Should have the right new value for 'a'.");
|
|
});
|
|
}
|
|
|
|
registerCleanupFunction(function() {
|
|
gTab = null;
|
|
gDebuggee = null;
|
|
gPanel = null;
|
|
gDebugger = null;
|
|
gVars = null;
|
|
});
|