browser/devtools/webconsole/test/browser_bug_865288_repeat_different_objects.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 /*
     2  * Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/publicdomain/zero/1.0/
     4  */
     6 // Test that makes sure messages are not considered repeated when console.log()
     7 // is invoked with different objects, see bug 865288.
     9 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-repeated-messages.html";
    11 let hud = null;
    13 function test() {
    14   addTab(TEST_URI);
    15   browser.addEventListener("load", function onLoad() {
    16     browser.removeEventListener("load", onLoad, true);
    17     openConsole(null, consoleOpened);
    18   }, true);
    19 }
    21 function consoleOpened(aHud) {
    22   hud = aHud;
    24   // Check that css warnings are not coalesced if they come from different lines.
    25   info("waiting for 3 console.log objects");
    27   hud.jsterm.clearOutput(true);
    28   content.wrappedJSObject.testConsoleObjects();
    30   waitForMessages({
    31     webconsole: hud,
    32     messages: [{
    33       name: "3 console.log messages",
    34       text: "abba",
    35       category: CATEGORY_WEBDEV,
    36       severity: SEVERITY_LOG,
    37       count: 3,
    38       repeats: 1,
    39       objects: true,
    40     }],
    41   }).then(checkMessages);
    42 }
    44 function checkMessages([result])
    45 {
    46   let msgs = [...result.matched];
    47   is(msgs.length, 3, "3 message elements");
    48   let m = -1;
    50   function nextMessage()
    51   {
    52     let msg = msgs[++m];
    53     if (msg) {
    54       ok(msg, "message element #" + m);
    56       let clickable = msg.querySelector(".message-body a");
    57       ok(clickable, "clickable object #" + m);
    59       msg.scrollIntoView(false);
    60       clickObject(clickable);
    61     }
    62     else {
    63       finishTest();
    64     }
    65   }
    67   nextMessage();
    69   function clickObject(aObject)
    70   {
    71     hud.jsterm.once("variablesview-fetched", onObjectFetch);
    72     EventUtils.synthesizeMouse(aObject, 2, 2, {}, hud.iframeWindow);
    73   }
    75   function onObjectFetch(aEvent, aVar)
    76   {
    77     findVariableViewProperties(aVar, [
    78       { name: "id", value: "abba" + m },
    79     ], { webconsole: hud }).then(nextMessage);
    80   }
    81 }

mercurial