summaryrefslogtreecommitdiffstats
path: root/devtools/client/webconsole/test/browser/browser_webconsole_repeat_different_objects.js
blob: 43fcc993f931d3cda15aaadf26ddcd63a8cf50e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

// Test that makes sure messages are not considered repeated when console.log()
// is invoked with different objects, see bug 865288.

"use strict";

const TEST_URI = "data:text/html,<!DOCTYPE html>Test repeated objects";

add_task(async function () {
  const hud = await openNewTabAndConsole(TEST_URI);

  const onMessages = waitForMessagesByType({
    hud,
    messages: [
      {
        text: "abba",
        typeSelector: ".console-api",
      },
      {
        text: "abba",
        typeSelector: ".console-api",
      },
      {
        text: "abba",
        typeSelector: ".console-api",
      },
    ],
  });

  SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
    for (let i = 0; i < 3; i++) {
      const o = { id: "abba" };
      content.console.log("abba", o);
    }
  });

  info("waiting for 3 console.log objects, with the exact same text content");
  const messages = await onMessages;
  is(messages.length, 3, "There are 3 messages, as expected.");
});