Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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/ */
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>';
8 function onContentLoaded()
9 {
10 browser.removeEventListener("load", onContentLoaded, true);
12 let HUD = HUDService.getHudByWindow(content);
14 let cssWarning = "Unknown property '-moz-opacity'. Declaration dropped.";
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 }
27 function testConsoleLogRepeats()
28 {
29 let HUD = HUDService.getHudByWindow(content);
30 let jsterm = HUD.jsterm;
32 jsterm.clearOutput();
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();
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 }
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 }