tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_webconsole_repeat_different_objects.js (1090B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // Test that makes sure messages are not considered repeated when console.log()
      5 // is invoked with different objects, see bug 865288.
      6 
      7 "use strict";
      8 
      9 const TEST_URI = "data:text/html,<!DOCTYPE html>Test repeated objects";
     10 
     11 add_task(async function () {
     12  const hud = await openNewTabAndConsole(TEST_URI);
     13 
     14  const onMessages = waitForMessagesByType({
     15    hud,
     16    messages: [
     17      {
     18        text: "abba",
     19        typeSelector: ".console-api",
     20      },
     21      {
     22        text: "abba",
     23        typeSelector: ".console-api",
     24      },
     25      {
     26        text: "abba",
     27        typeSelector: ".console-api",
     28      },
     29    ],
     30  });
     31 
     32  SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
     33    for (let i = 0; i < 3; i++) {
     34      const o = { id: "abba" };
     35      content.console.log("abba", o);
     36    }
     37  });
     38 
     39  info("waiting for 3 console.log objects, with the exact same text content");
     40  const messages = await onMessages;
     41  is(messages.length, 3, "There are 3 messages, as expected.");
     42 });