gecko/browser/devtools/debugger/test/browser_dbg_variables-view-05.js
Victor Porof 4bc45f79e8 Bug 876277 - Cleanup debugger variables view tests, r=past
--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
2013-09-13 16:23:18 +03:00

209 lines
12 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that grips are correctly applied to variables and properties.
*/
const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
let variables = aPanel.panelWin.DebuggerView.Variables;
let globalScope = variables.addScope("Test-Global");
let localScope = variables.addScope("Test-Local");
ok(globalScope, "The globalScope hasn't been created correctly.");
ok(localScope, "The localScope hasn't been created correctly.");
let windowVar = globalScope.addItem("window");
let documentVar = globalScope.addItem("document");
ok(windowVar, "The windowVar hasn't been created correctly.");
ok(documentVar, "The documentVar hasn't been created correctly.");
windowVar.setGrip({ type: "object", class: "Window" });
documentVar.setGrip({ type: "object", class: "HTMLDocument" });
let localVar0 = localScope.addItem("localVar0");
let localVar1 = localScope.addItem("localVar1");
let localVar2 = localScope.addItem("localVar2");
let localVar3 = localScope.addItem("localVar3");
let localVar4 = localScope.addItem("localVar4");
let localVar5 = localScope.addItem("localVar5");
let localVar6 = localScope.addItem("localVar6");
let localVar7 = localScope.addItem("localVar7");
let localVar8 = localScope.addItem("localVar8");
let localVar9 = localScope.addItem("localVar9");
ok(localVar0, "The localVar0 hasn't been created correctly.");
ok(localVar1, "The localVar1 hasn't been created correctly.");
ok(localVar2, "The localVar2 hasn't been created correctly.");
ok(localVar3, "The localVar3 hasn't been created correctly.");
ok(localVar4, "The localVar4 hasn't been created correctly.");
ok(localVar5, "The localVar5 hasn't been created correctly.");
ok(localVar6, "The localVar6 hasn't been created correctly.");
ok(localVar7, "The localVar7 hasn't been created correctly.");
ok(localVar8, "The localVar8 hasn't been created correctly.");
ok(localVar9, "The localVar9 hasn't been created correctly.");
localVar0.setGrip(42);
localVar1.setGrip(true);
localVar2.setGrip("nasu");
localVar3.setGrip({ type: "undefined" });
localVar4.setGrip({ type: "null" });
localVar5.setGrip({ type: "object", class: "Object" });
localVar6.setGrip({ type: "Infinity" });
localVar7.setGrip({ type: "-Infinity" });
localVar8.setGrip({ type: "NaN" });
localVar9.setGrip({ type: "-0" });
localVar5.addItems({
someProp0: { value: 42, enumerable: true },
someProp1: { value: true, enumerable: true },
someProp2: { value: "nasu", enumerable: true },
someProp3: { value: { type: "undefined" }, enumerable: true },
someProp4: { value: { type: "null" }, enumerable: true },
someProp5: { value: { type: "object", class: "Object" }, enumerable: true },
someProp6: { value: { type: "Infinity" }, enumerable: true },
someProp7: { value: { type: "-Infinity" }, enumerable: true },
someProp8: { value: { type: "NaN" }, enumerable: true },
someProp9: { value: { type: "-0" }, enumerable: true },
someUndefined: {
get: { type: "undefined" },
set: { type: "undefined" },
enumerable: true
},
someAccessor: {
get: { type: "object", class: "Function" },
set: { type: "undefined" },
enumerable: true
}
});
localVar5.get("someProp5").addItems({
someProp0: { value: 42, enumerable: true },
someProp1: { value: true, enumerable: true },
someProp2: { value: "nasu", enumerable: true },
someProp3: { value: { type: "undefined" }, enumerable: true },
someProp4: { value: { type: "null" }, enumerable: true },
someProp5: { value: { type: "object", class: "Object" }, enumerable: true },
someProp6: { value: { type: "Infinity" }, enumerable: true },
someProp7: { value: { type: "-Infinity" }, enumerable: true },
someProp8: { value: { type: "NaN" }, enumerable: true },
someProp9: { value: { type: "-0" }, enumerable: true },
someUndefined: {
get: { type: "undefined" },
set: { type: "undefined" },
enumerable: true
},
someAccessor: {
get: { type: "object", class: "Function" },
set: { type: "undefined" },
enumerable: true
}
});
is(globalScope.target.querySelector(".enum").childNodes.length, 0,
"The globalScope doesn't contain all the created enumerable variable elements.");
is(globalScope.target.querySelector(".nonenum").childNodes.length, 2,
"The globalScope doesn't contain all the created non-enumerable variable elements.");
is(localScope.target.querySelector(".enum").childNodes.length, 0,
"The localScope doesn't contain all the created enumerable variable elements.");
is(localScope.target.querySelector(".nonenum").childNodes.length, 10,
"The localScope doesn't contain all the created non-enumerable variable elements.");
is(localVar5.target.querySelector(".enum").childNodes.length, 12,
"The localVar5 doesn't contain all the created enumerable properties.");
is(localVar5.target.querySelector(".nonenum").childNodes.length, 0,
"The localVar5 doesn't contain all the created non-enumerable properties.");
is(localVar5.get("someProp5").target.querySelector(".enum").childNodes.length, 12,
"The localVar5.someProp5 doesn't contain all the created enumerable properties.");
is(localVar5.get("someProp5").target.querySelector(".nonenum").childNodes.length, 0,
"The localVar5.someProp5 doesn't contain all the created non-enumerable properties.");
is(windowVar.target.querySelector(".value").getAttribute("value"), "Window",
"The grip information for the windowVar wasn't set correctly.");
is(documentVar.target.querySelector(".value").getAttribute("value"), "HTMLDocument",
"The grip information for the documentVar wasn't set correctly.");
is(localVar0.target.querySelector(".value").getAttribute("value"), "42",
"The grip information for the localVar0 wasn't set correctly.");
is(localVar1.target.querySelector(".value").getAttribute("value"), "true",
"The grip information for the localVar1 wasn't set correctly.");
is(localVar2.target.querySelector(".value").getAttribute("value"), "\"nasu\"",
"The grip information for the localVar2 wasn't set correctly.");
is(localVar3.target.querySelector(".value").getAttribute("value"), "undefined",
"The grip information for the localVar3 wasn't set correctly.");
is(localVar4.target.querySelector(".value").getAttribute("value"), "null",
"The grip information for the localVar4 wasn't set correctly.");
is(localVar5.target.querySelector(".value").getAttribute("value"), "Object",
"The grip information for the localVar5 wasn't set correctly.");
is(localVar6.target.querySelector(".value").getAttribute("value"), "Infinity",
"The grip information for the localVar6 wasn't set correctly.");
is(localVar7.target.querySelector(".value").getAttribute("value"), "-Infinity",
"The grip information for the localVar7 wasn't set correctly.");
is(localVar8.target.querySelector(".value").getAttribute("value"), "NaN",
"The grip information for the localVar8 wasn't set correctly.");
is(localVar9.target.querySelector(".value").getAttribute("value"), "-0",
"The grip information for the localVar9 wasn't set correctly.");
is(localVar5.get("someProp0").target.querySelector(".value").getAttribute("value"), "42",
"The grip information for the someProp0 wasn't set correctly.");
is(localVar5.get("someProp1").target.querySelector(".value").getAttribute("value"), "true",
"The grip information for the someProp1 wasn't set correctly.");
is(localVar5.get("someProp2").target.querySelector(".value").getAttribute("value"), "\"nasu\"",
"The grip information for the someProp2 wasn't set correctly.");
is(localVar5.get("someProp3").target.querySelector(".value").getAttribute("value"), "undefined",
"The grip information for the someProp3 wasn't set correctly.");
is(localVar5.get("someProp4").target.querySelector(".value").getAttribute("value"), "null",
"The grip information for the someProp4 wasn't set correctly.");
is(localVar5.get("someProp5").target.querySelector(".value").getAttribute("value"), "Object",
"The grip information for the someProp5 wasn't set correctly.");
is(localVar5.get("someProp6").target.querySelector(".value").getAttribute("value"), "Infinity",
"The grip information for the someProp6 wasn't set correctly.");
is(localVar5.get("someProp7").target.querySelector(".value").getAttribute("value"), "-Infinity",
"The grip information for the someProp7 wasn't set correctly.");
is(localVar5.get("someProp8").target.querySelector(".value").getAttribute("value"), "NaN",
"The grip information for the someProp8 wasn't set correctly.");
is(localVar5.get("someProp9").target.querySelector(".value").getAttribute("value"), "-0",
"The grip information for the someProp9 wasn't set correctly.");
is(localVar5.get("someUndefined").target.querySelector(".value").getAttribute("value"), "",
"The grip information for the someUndefined wasn't set correctly.");
is(localVar5.get("someAccessor").target.querySelector(".value").getAttribute("value"), "",
"The grip information for the someAccessor wasn't set correctly.");
is(localVar5.get("someProp5").get("someProp0").target.querySelector(".value").getAttribute("value"), "42",
"The grip information for the sub-someProp0 wasn't set correctly.");
is(localVar5.get("someProp5").get("someProp1").target.querySelector(".value").getAttribute("value"), "true",
"The grip information for the sub-someProp1 wasn't set correctly.");
is(localVar5.get("someProp5").get("someProp2").target.querySelector(".value").getAttribute("value"), "\"nasu\"",
"The grip information for the sub-someProp2 wasn't set correctly.");
is(localVar5.get("someProp5").get("someProp3").target.querySelector(".value").getAttribute("value"), "undefined",
"The grip information for the sub-someProp3 wasn't set correctly.");
is(localVar5.get("someProp5").get("someProp4").target.querySelector(".value").getAttribute("value"), "null",
"The grip information for the sub-someProp4 wasn't set correctly.");
is(localVar5.get("someProp5").get("someProp5").target.querySelector(".value").getAttribute("value"), "Object",
"The grip information for the sub-someProp5 wasn't set correctly.");
is(localVar5.get("someProp5").get("someProp6").target.querySelector(".value").getAttribute("value"), "Infinity",
"The grip information for the sub-someProp6 wasn't set correctly.");
is(localVar5.get("someProp5").get("someProp7").target.querySelector(".value").getAttribute("value"), "-Infinity",
"The grip information for the sub-someProp7 wasn't set correctly.");
is(localVar5.get("someProp5").get("someProp8").target.querySelector(".value").getAttribute("value"), "NaN",
"The grip information for the sub-someProp8 wasn't set correctly.");
is(localVar5.get("someProp5").get("someProp9").target.querySelector(".value").getAttribute("value"), "-0",
"The grip information for the sub-someProp9 wasn't set correctly.");
is(localVar5.get("someProp5").get("someUndefined").target.querySelector(".value").getAttribute("value"), "",
"The grip information for the sub-someUndefined wasn't set correctly.");
is(localVar5.get("someProp5").get("someAccessor").target.querySelector(".value").getAttribute("value"), "",
"The grip information for the sub-someAccessor wasn't set correctly.");
closeDebuggerAndFinish(aPanel);
});
}