summaryrefslogtreecommitdiff
path: root/devtools/client/webconsole/test/browser_bug_865288_repeat_different_objects.js
blob: fba83b9fd3379be9f86a02e64a648507831d6bba (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* 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 = "http://example.com/browser/devtools/client/webconsole/" +
                 "test/test-repeated-messages.html";

add_task(function* () {
  yield loadTab(TEST_URI);
  let hud = yield openConsole();

  info("waiting for 3 console.log objects");

  hud.jsterm.clearOutput(true);
  hud.jsterm.execute("window.testConsoleObjects()");

  let [result] = yield waitForMessages({
    webconsole: hud,
    messages: [{
      name: "3 console.log messages",
      text: "abba",
      category: CATEGORY_WEBDEV,
      severity: SEVERITY_LOG,
      count: 3,
      repeats: 1,
      objects: true,
    }],
  });

  let msgs = [...result.matched];
  is(msgs.length, 3, "3 message elements");

  for (let i = 0; i < msgs.length; i++) {
    info("test message element #" + i);

    let msg = msgs[i];
    let clickable = msg.querySelector(".message-body a");
    ok(clickable, "clickable object #" + i);

    msg.scrollIntoView(false);
    yield clickObject(clickable, i);
  }

  function* clickObject(obj, i) {
    executeSoon(() => {
      EventUtils.synthesizeMouse(obj, 2, 2, {}, hud.iframeWindow);
    });

    let varView = yield hud.jsterm.once("variablesview-fetched");
    ok(varView, "variables view fetched #" + i);

    yield findVariableViewProperties(varView, [
      { name: "id", value: "abba" + i },
    ], { webconsole: hud });
  }
});