browser/devtools/webconsole/test/browser_jsterm_inspect.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/webconsole/test/browser_jsterm_inspect.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +/*
     1.5 + * Any copyright is dedicated to the Public Domain.
     1.6 + * http://creativecommons.org/publicdomain/zero/1.0/
     1.7 + */
     1.8 +
     1.9 +// Check that the inspect() jsterm helper function works.
    1.10 +
    1.11 +function test()
    1.12 +{
    1.13 +  const TEST_URI = "data:text/html;charset=utf8,<p>hello bug 869981";
    1.14 +
    1.15 +  addTab(TEST_URI);
    1.16 +  browser.addEventListener("load", function onLoad() {
    1.17 +    browser.removeEventListener("load", onLoad, true);
    1.18 +    openConsole(null, consoleOpened);
    1.19 +  }, true);
    1.20 +
    1.21 +  function consoleOpened(hud)
    1.22 +  {
    1.23 +    content.wrappedJSObject.testProp = "testValue";
    1.24 +
    1.25 +    hud.jsterm.once("variablesview-fetched", onObjFetch);
    1.26 +    hud.jsterm.execute("inspect(window)");
    1.27 +  }
    1.28 +
    1.29 +  function onObjFetch(aEvent, aVar)
    1.30 +  {
    1.31 +    ok(aVar._variablesView, "variables view object");
    1.32 +
    1.33 +    findVariableViewProperties(aVar, [
    1.34 +      { name: "testProp", value: "testValue" },
    1.35 +      { name: "document", value: /HTMLDocument \u2192 data:/ },
    1.36 +    ], { webconsole: hud }).then(finishTest);
    1.37 +  }
    1.38 +}

mercurial