browser/devtools/webconsole/test/browser_console_log_inspectable_object.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* vim:set ts=2 sw=2 sts=2 et: */
     2 /* Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/publicdomain/zero/1.0/ */
     5 // Test that objects given to console.log() are inspectable.
     7 function test()
     8 {
     9   waitForExplicitFinish();
    11   addTab("data:text/html;charset=utf8,test for bug 676722 - inspectable objects for window.console");
    13   gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
    14     gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
    15     openConsole(null, performTest);
    16   }, true);
    17 }
    19 function performTest(hud)
    20 {
    21   hud.jsterm.clearOutput(true);
    23   hud.jsterm.execute("myObj = {abba: 'omgBug676722'}");
    24   hud.jsterm.execute("console.log('fooBug676722', myObj)");
    26   waitForMessages({
    27     webconsole: hud,
    28     messages: [{
    29       text: "fooBug676722",
    30       category: CATEGORY_WEBDEV,
    31       severity: SEVERITY_LOG,
    32       objects: true,
    33     }],
    34   }).then(([result]) => {
    35     let msg = [...result.matched][0];
    36     ok(msg, "message element");
    37     let body = msg.querySelector(".message-body");
    38     ok(body, "message body");
    39     let clickable = result.clickableElements[0];
    40     ok(clickable, "the console.log() object anchor was found");
    41     ok(body.textContent.contains('{ abba: "omgBug676722" }'),
    42        "clickable node content is correct");
    44     hud.jsterm.once("variablesview-fetched",
    45       (aEvent, aVar) => {
    46         ok(aVar, "object inspector opened on click");
    48         findVariableViewProperties(aVar, [{
    49           name: "abba",
    50           value: "omgBug676722",
    51         }], { webconsole: hud }).then(finishTest);
    52       });
    54     executeSoon(function() {
    55       EventUtils.synthesizeMouse(clickable, 2, 2, {}, hud.iframeWindow);
    56     });
    57   });
    58 }

mercurial