1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_bug_659907_console_dir.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,29 @@ 1.4 +/* vim:set ts=2 sw=2 sts=2 et: */ 1.5 +/* 1.6 + * Any copyright is dedicated to the Public Domain. 1.7 + * http://creativecommons.org/publicdomain/zero/1.0/ 1.8 + */ 1.9 + 1.10 +// Tests that console.dir works as intended. 1.11 + 1.12 +function test() { 1.13 + addTab("data:text/html;charset=utf-8,Web Console test for bug 659907: Expand console " + 1.14 + "object with a dir method"); 1.15 + browser.addEventListener("load", function onLoad(aEvent) { 1.16 + browser.removeEventListener(aEvent.type, onLoad, true); 1.17 + openConsole(null, consoleOpened); 1.18 + }, true); 1.19 +} 1.20 + 1.21 +function consoleOpened(hud) { 1.22 + hud.jsterm.execute("console.dir(document)"); 1.23 + hud.jsterm.once("variablesview-fetched", testConsoleDir.bind(null, hud)); 1.24 +} 1.25 + 1.26 +function testConsoleDir(hud, ev, view) { 1.27 + findVariableViewProperties(view, [ 1.28 + { name: "__proto__.__proto__.querySelectorAll", value: "querySelectorAll()" }, 1.29 + { name: "location", value: /Location \u2192 data:Web/ }, 1.30 + { name: "__proto__.write", value: "write()" }, 1.31 + ], { webconsole: hud }).then(finishTest); 1.32 +}