browser/devtools/webconsole/test/browser_webconsole_bug_611795.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial