2012-08-03 13:14:01 -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/ */
|
|
|
|
|
|
|
|
// Test that objects given to console.log() are inspectable.
|
|
|
|
|
|
|
|
function test()
|
|
|
|
{
|
|
|
|
waitForExplicitFinish();
|
|
|
|
|
2012-10-05 09:15:51 -07:00
|
|
|
addTab("data:text/html;charset=utf8,test for bug 676722 - inspectable objects for window.console");
|
2012-08-03 13:14:01 -07:00
|
|
|
|
|
|
|
gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
|
|
|
|
gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
|
|
|
|
openConsole(null, performTest);
|
|
|
|
}, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
function performTest(hud)
|
|
|
|
{
|
|
|
|
hud.jsterm.clearOutput(true);
|
|
|
|
|
|
|
|
hud.jsterm.execute("myObj = {abba: 'omgBug676722'}");
|
|
|
|
hud.jsterm.execute("console.log('fooBug676722', myObj)");
|
|
|
|
waitForSuccess({
|
|
|
|
name: "eval results are shown",
|
|
|
|
validatorFn: function()
|
|
|
|
{
|
|
|
|
return hud.outputNode.textContent.indexOf("fooBug676722") > -1 &&
|
|
|
|
hud.outputNode.querySelector(".hud-clickable");
|
|
|
|
},
|
|
|
|
successFn: function()
|
|
|
|
{
|
|
|
|
isnot(hud.outputNode.textContent.indexOf("myObj = {"), -1,
|
|
|
|
"myObj = ... is shown");
|
|
|
|
|
|
|
|
let clickable = hud.outputNode.querySelector(".hud-clickable");
|
|
|
|
ok(clickable, "the console.log() object .hud-clickable was found");
|
2013-04-09 02:46:30 -07:00
|
|
|
isnot(clickable.textContent.indexOf("Object"), -1,
|
2012-08-03 13:14:01 -07:00
|
|
|
"clickable node content is correct");
|
|
|
|
|
2013-04-09 02:46:30 -07:00
|
|
|
hud.jsterm.once("variablesview-fetched",
|
|
|
|
(aEvent, aVar) => {
|
|
|
|
ok(aVar, "object inspector opened on click");
|
2012-08-03 13:14:01 -07:00
|
|
|
|
2013-04-09 02:46:30 -07:00
|
|
|
findVariableViewProperties(aVar, [{
|
|
|
|
name: "abba",
|
|
|
|
value: "omgBug676722",
|
|
|
|
}], { webconsole: hud }).then(finishTest);
|
|
|
|
});
|
2012-08-03 13:14:01 -07:00
|
|
|
|
|
|
|
executeSoon(function() {
|
|
|
|
EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
failureFn: finishTest,
|
|
|
|
});
|
|
|
|
}
|