2012-02-07 09:22:30 -08: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/
|
|
|
|
*/
|
|
|
|
var gPane = null;
|
|
|
|
var gTab = null;
|
|
|
|
var gDebuggee = null;
|
|
|
|
var gDebugger = null;
|
|
|
|
|
|
|
|
function test() {
|
|
|
|
debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
|
|
|
|
gTab = aTab;
|
|
|
|
gDebuggee = aDebuggee;
|
|
|
|
gPane = aPane;
|
2012-11-30 00:07:59 -08:00
|
|
|
gDebugger = gPane.panelWin;
|
2012-02-07 09:22:30 -08:00
|
|
|
|
|
|
|
testSimpleCall();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function testSimpleCall() {
|
2012-04-08 22:15:47 -07:00
|
|
|
gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
|
2012-02-07 09:22:30 -08:00
|
|
|
Services.tm.currentThread.dispatch({ run: function() {
|
|
|
|
|
2012-10-26 10:10:17 -07:00
|
|
|
let testScope = gDebugger.DebuggerView.Variables.addScope("test");
|
2013-06-14 10:42:52 -07:00
|
|
|
let testVar = testScope.addItem("something");
|
2012-02-07 09:22:30 -08:00
|
|
|
|
2013-01-24 10:59:44 -08:00
|
|
|
testVar.setGrip(1.618);
|
2012-02-07 09:22:30 -08:00
|
|
|
|
2012-10-26 10:10:17 -07:00
|
|
|
is(testVar.target.querySelector(".value").getAttribute("value"), "1.618",
|
2012-02-07 09:22:30 -08:00
|
|
|
"The grip information for the variable wasn't set correctly.");
|
|
|
|
|
2013-02-20 15:33:36 -08:00
|
|
|
is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 0,
|
2012-02-07 09:22:30 -08:00
|
|
|
"Adding a value property shouldn't add any new tree nodes.");
|
|
|
|
|
|
|
|
|
2013-01-24 10:59:44 -08:00
|
|
|
testVar.setGrip({ "type": "object", "class": "Window" });
|
2012-02-07 09:22:30 -08:00
|
|
|
|
2013-02-20 15:33:36 -08:00
|
|
|
is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 0,
|
2012-02-07 09:22:30 -08:00
|
|
|
"Adding type and class properties shouldn't add any new tree nodes.");
|
|
|
|
|
2012-10-26 10:10:17 -07:00
|
|
|
is(testVar.target.querySelector(".value").getAttribute("value"), "[object Window]",
|
2012-02-07 09:22:30 -08:00
|
|
|
"The information for the variable wasn't set correctly.");
|
|
|
|
|
|
|
|
|
2013-06-14 10:42:52 -07:00
|
|
|
testVar.addItems({ "helloWorld": { "value": "hello world", "enumerable": true } });
|
2012-02-07 09:22:30 -08:00
|
|
|
|
2013-02-20 15:33:36 -08:00
|
|
|
is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 1,
|
2012-02-07 09:22:30 -08:00
|
|
|
"A new detail node should have been added in the variable tree.");
|
|
|
|
|
|
|
|
|
2013-06-14 10:42:52 -07:00
|
|
|
testVar.addItems({ "helloWorld": { "value": "hello jupiter", "enumerable": true } });
|
2012-02-07 09:22:30 -08:00
|
|
|
|
2013-02-20 15:33:36 -08:00
|
|
|
is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 1,
|
2012-02-07 09:22:30 -08:00
|
|
|
"Shouldn't be able to duplicate nodes added in the variable tree.");
|
|
|
|
|
|
|
|
|
2013-06-14 10:42:52 -07:00
|
|
|
testVar.addItems({ "someProp0": { "value": "random string", "enumerable": true },
|
|
|
|
"someProp1": { "value": "another string", "enumerable": true } });
|
2012-02-07 09:22:30 -08:00
|
|
|
|
2013-02-20 15:33:36 -08:00
|
|
|
is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 3,
|
2012-02-07 09:22:30 -08:00
|
|
|
"Two new detail nodes should have been added in the variable tree.");
|
|
|
|
|
|
|
|
|
2013-06-14 10:42:52 -07:00
|
|
|
testVar.addItems({ "someProp2": { "value": { "type": "null" }, "enumerable": true },
|
|
|
|
"someProp3": { "value": { "type": "undefined" }, "enumerable": true },
|
|
|
|
"someProp4": {
|
|
|
|
"value": { "type": "object", "class": "Object" },
|
|
|
|
"enumerable": true
|
|
|
|
}
|
|
|
|
});
|
2012-02-07 09:22:30 -08:00
|
|
|
|
2013-02-20 15:33:36 -08:00
|
|
|
is(testVar.target.querySelector(".variables-view-element-details").childNodes.length, 6,
|
2012-02-07 09:22:30 -08:00
|
|
|
"Three new detail nodes should have been added in the variable tree.");
|
|
|
|
|
|
|
|
|
2012-04-08 22:15:47 -07:00
|
|
|
gDebugger.DebuggerController.activeThread.resume(function() {
|
2012-05-31 03:01:13 -07:00
|
|
|
closeDebuggerAndFinish();
|
2012-03-06 00:22:17 -08:00
|
|
|
});
|
2012-02-07 09:22:30 -08:00
|
|
|
}}, 0);
|
|
|
|
});
|
|
|
|
|
|
|
|
gDebuggee.simpleCall();
|
|
|
|
}
|
|
|
|
|
2012-03-06 00:22:17 -08:00
|
|
|
registerCleanupFunction(function() {
|
|
|
|
removeTab(gTab);
|
|
|
|
gPane = null;
|
|
|
|
gTab = null;
|
|
|
|
gDebuggee = null;
|
|
|
|
gDebugger = null;
|
|
|
|
});
|