|
1 /* vim:set ts=2 sw=2 sts=2 et: */ |
|
2 /* Any copyright is dedicated to the Public Domain. |
|
3 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
4 |
|
5 const TEST_URI = 'data:text/html;charset=utf-8,<div style="-moz-opacity:0;">test repeated' + |
|
6 ' css warnings</div><p style="-moz-opacity:0">hi</p>'; |
|
7 |
|
8 function onContentLoaded() |
|
9 { |
|
10 browser.removeEventListener("load", onContentLoaded, true); |
|
11 |
|
12 let HUD = HUDService.getHudByWindow(content); |
|
13 |
|
14 let cssWarning = "Unknown property '-moz-opacity'. Declaration dropped."; |
|
15 |
|
16 waitForMessages({ |
|
17 webconsole: HUD, |
|
18 messages: [{ |
|
19 text: cssWarning, |
|
20 category: CATEGORY_CSS, |
|
21 severity: SEVERITY_WARNING, |
|
22 repeats: 2, |
|
23 }], |
|
24 }).then(testConsoleLogRepeats); |
|
25 } |
|
26 |
|
27 function testConsoleLogRepeats() |
|
28 { |
|
29 let HUD = HUDService.getHudByWindow(content); |
|
30 let jsterm = HUD.jsterm; |
|
31 |
|
32 jsterm.clearOutput(); |
|
33 |
|
34 jsterm.setInputValue("for (let i = 0; i < 10; ++i) console.log('this is a line of reasonably long text that I will use to verify that the repeated text node is of an appropriate size.');"); |
|
35 jsterm.execute(); |
|
36 |
|
37 waitForMessages({ |
|
38 webconsole: HUD, |
|
39 messages: [{ |
|
40 text: "this is a line of reasonably long text", |
|
41 category: CATEGORY_WEBDEV, |
|
42 severity: SEVERITY_LOG, |
|
43 repeats: 10, |
|
44 }], |
|
45 }).then(finishTest); |
|
46 } |
|
47 |
|
48 /** |
|
49 * Unit test for bug 611795: |
|
50 * Repeated CSS messages get collapsed into one. |
|
51 */ |
|
52 function test() |
|
53 { |
|
54 addTab(TEST_URI); |
|
55 browser.addEventListener("load", function onLoad() { |
|
56 browser.removeEventListener("load", onLoad, true); |
|
57 openConsole(null, function(aHud) { |
|
58 // Clear cached messages that are shown once the Web Console opens. |
|
59 aHud.jsterm.clearOutput(true); |
|
60 browser.addEventListener("load", onContentLoaded, true); |
|
61 content.location.reload(); |
|
62 }); |
|
63 }, true); |
|
64 } |