|
1 /* |
|
2 * Any copyright is dedicated to the Public Domain. |
|
3 * http://creativecommons.org/publicdomain/zero/1.0/ |
|
4 */ |
|
5 |
|
6 // Test that makes sure messages are not considered repeated when console.log() |
|
7 // is invoked with different objects, see bug 865288. |
|
8 |
|
9 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-repeated-messages.html"; |
|
10 |
|
11 let hud = null; |
|
12 |
|
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 } |
|
20 |
|
21 function consoleOpened(aHud) { |
|
22 hud = aHud; |
|
23 |
|
24 // Check that css warnings are not coalesced if they come from different lines. |
|
25 info("waiting for 3 console.log objects"); |
|
26 |
|
27 hud.jsterm.clearOutput(true); |
|
28 content.wrappedJSObject.testConsoleObjects(); |
|
29 |
|
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 } |
|
43 |
|
44 function checkMessages([result]) |
|
45 { |
|
46 let msgs = [...result.matched]; |
|
47 is(msgs.length, 3, "3 message elements"); |
|
48 let m = -1; |
|
49 |
|
50 function nextMessage() |
|
51 { |
|
52 let msg = msgs[++m]; |
|
53 if (msg) { |
|
54 ok(msg, "message element #" + m); |
|
55 |
|
56 let clickable = msg.querySelector(".message-body a"); |
|
57 ok(clickable, "clickable object #" + m); |
|
58 |
|
59 msg.scrollIntoView(false); |
|
60 clickObject(clickable); |
|
61 } |
|
62 else { |
|
63 finishTest(); |
|
64 } |
|
65 } |
|
66 |
|
67 nextMessage(); |
|
68 |
|
69 function clickObject(aObject) |
|
70 { |
|
71 hud.jsterm.once("variablesview-fetched", onObjectFetch); |
|
72 EventUtils.synthesizeMouse(aObject, 2, 2, {}, hud.iframeWindow); |
|
73 } |
|
74 |
|
75 function onObjectFetch(aEvent, aVar) |
|
76 { |
|
77 findVariableViewProperties(aVar, [ |
|
78 { name: "id", value: "abba" + m }, |
|
79 ], { webconsole: hud }).then(nextMessage); |
|
80 } |
|
81 } |