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-05-03 10:36:40 -07:00
|
|
|
gDebugger = gPane.contentWindow;
|
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-05-29 02:08:20 -07:00
|
|
|
let globalScope = gDebugger.DebuggerView.Properties.addScope("Global");
|
|
|
|
let localScope = gDebugger.DebuggerView.Properties.addScope("Local");
|
2012-04-26 04:36:27 -07:00
|
|
|
globalScope.empty();
|
|
|
|
localScope.empty();
|
|
|
|
|
2012-02-07 09:22:30 -08:00
|
|
|
let windowVar = globalScope.addVar("window");
|
|
|
|
let documentVar = globalScope.addVar("document");
|
|
|
|
let localVar0 = localScope.addVar("localVariable");
|
|
|
|
let localVar1 = localScope.addVar("localVar1");
|
|
|
|
let localVar2 = localScope.addVar("localVar2");
|
|
|
|
let localVar3 = localScope.addVar("localVar3");
|
|
|
|
let localVar4 = localScope.addVar("localVar4");
|
|
|
|
let localVar5 = localScope.addVar("localVar5");
|
|
|
|
|
|
|
|
localVar0.setGrip(42);
|
|
|
|
localVar1.setGrip(true);
|
|
|
|
localVar2.setGrip("nasu");
|
|
|
|
|
|
|
|
localVar3.setGrip({ "type": "undefined" });
|
|
|
|
localVar4.setGrip({ "type": "null" });
|
|
|
|
localVar5.setGrip({ "type": "object", "class": "Object" });
|
|
|
|
|
2012-10-05 11:20:47 -07:00
|
|
|
localVar5.addProperties({ "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
|
|
|
|
}
|
|
|
|
});
|
2012-02-07 09:22:30 -08:00
|
|
|
|
2012-10-05 11:20:47 -07:00
|
|
|
localVar5.someProp5.addProperties({ "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 },
|
2012-02-07 09:22:30 -08:00
|
|
|
"someAccessor": { "get": { "type": "object", "class": "Function" },
|
2012-10-05 11:20:47 -07:00
|
|
|
"set": { "type": "undefined" },
|
|
|
|
"enumerable": true } });
|
2012-02-07 09:22:30 -08:00
|
|
|
|
|
|
|
windowVar.setGrip({ "type": "object", "class": "Window" });
|
|
|
|
windowVar.addProperties({ "helloWorld": { "value": "hello world" } });
|
|
|
|
|
|
|
|
documentVar.setGrip({ "type": "object", "class": "HTMLDocument" });
|
|
|
|
documentVar.addProperties({ "onload": { "value": { "type": "null" } },
|
|
|
|
"onunload": { "value": { "type": "null" } },
|
|
|
|
"onfocus": { "value": { "type": "null" } },
|
|
|
|
"onblur": { "value": { "type": "null" } },
|
|
|
|
"onclick": { "value": { "type": "null" } },
|
|
|
|
"onkeypress": { "value": { "type": "null" } } });
|
|
|
|
|
|
|
|
|
|
|
|
ok(windowVar, "The windowVar hasn't been created correctly.");
|
|
|
|
ok(documentVar, "The documentVar hasn't been created correctly.");
|
|
|
|
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.");
|
|
|
|
|
|
|
|
|
2012-04-26 04:36:27 -07:00
|
|
|
for each (let elt in globalScope.querySelector(".details").childNodes) {
|
|
|
|
info("globalScope :: " + {
|
|
|
|
id: elt.id, className: elt.className }.toSource());
|
|
|
|
}
|
2012-02-07 09:22:30 -08:00
|
|
|
is(globalScope.querySelector(".details").childNodes.length, 2,
|
|
|
|
"The globalScope doesn't contain all the created variable elements.");
|
|
|
|
|
2012-04-26 04:36:27 -07:00
|
|
|
for each (let elt in localScope.querySelector(".details").childNodes) {
|
|
|
|
info("localScope :: " + {
|
|
|
|
id: elt.id, className: elt.className }.toSource());
|
|
|
|
}
|
|
|
|
is(localScope.querySelector(".details").childNodes.length, 6,
|
2012-02-07 09:22:30 -08:00
|
|
|
"The localScope doesn't contain all the created variable elements.");
|
|
|
|
|
|
|
|
|
|
|
|
is(localVar5.querySelector(".details").childNodes.length, 6,
|
|
|
|
"The localVar5 doesn't contain all the created properties.");
|
|
|
|
|
|
|
|
is(localVar5.someProp5.querySelector(".details").childNodes.length, 6,
|
|
|
|
"The localVar5.someProp5 doesn't contain all the created properties.");
|
|
|
|
|
|
|
|
|
2012-05-20 13:49:51 -07:00
|
|
|
is(windowVar.querySelector(".value").getAttribute("value"), "[object Window]",
|
2012-02-07 09:22:30 -08:00
|
|
|
"The grip information for the windowVar wasn't set correctly.");
|
|
|
|
|
2012-05-20 13:49:51 -07:00
|
|
|
is(documentVar.querySelector(".value").getAttribute("value"), "[object HTMLDocument]",
|
2012-02-07 09:22:30 -08:00
|
|
|
"The grip information for the documentVar wasn't set correctly.");
|
|
|
|
|
2012-05-20 13:49:51 -07:00
|
|
|
is(localVar0.querySelector(".value").getAttribute("value"), "42",
|
2012-02-07 09:22:30 -08:00
|
|
|
"The grip information for the localVar0 wasn't set correctly.");
|
|
|
|
|
2012-05-20 13:49:51 -07:00
|
|
|
is(localVar1.querySelector(".value").getAttribute("value"), "true",
|
2012-02-07 09:22:30 -08:00
|
|
|
"The grip information for the localVar1 wasn't set correctly.");
|
|
|
|
|
2012-05-20 13:49:51 -07:00
|
|
|
is(localVar2.querySelector(".value").getAttribute("value"), "\"nasu\"",
|
2012-02-07 09:22:30 -08:00
|
|
|
"The grip information for the localVar2 wasn't set correctly.");
|
|
|
|
|
2012-05-20 13:49:51 -07:00
|
|
|
is(localVar3.querySelector(".value").getAttribute("value"), "undefined",
|
2012-02-07 09:22:30 -08:00
|
|
|
"The grip information for the localVar3 wasn't set correctly.");
|
|
|
|
|
2012-05-20 13:49:51 -07:00
|
|
|
is(localVar4.querySelector(".value").getAttribute("value"), "null",
|
2012-02-07 09:22:30 -08:00
|
|
|
"The grip information for the localVar4 wasn't set correctly.");
|
|
|
|
|
2012-05-20 13:49:51 -07:00
|
|
|
is(localVar5.querySelector(".value").getAttribute("value"), "[object Object]",
|
2012-02-07 09:22:30 -08:00
|
|
|
"The grip information for the localVar5 wasn't set correctly.");
|
|
|
|
|
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;
|
|
|
|
});
|