2013-01-31 09:19:06 -08:00
|
|
|
/* vim:set ts=2 sw=2 sts=2 et: */
|
|
|
|
/*
|
|
|
|
* Any copyright is dedicated to the Public Domain.
|
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Tests that makes sure messages are not considered repeated when coming from
|
|
|
|
// different lines of code, or from different severities, etc.
|
|
|
|
// See bugs 720180 and 800510.
|
|
|
|
|
|
|
|
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-repeated-messages.html";
|
|
|
|
|
|
|
|
function test() {
|
|
|
|
addTab(TEST_URI);
|
|
|
|
browser.addEventListener("load", function onLoad() {
|
|
|
|
browser.removeEventListener("load", onLoad, true);
|
|
|
|
openConsole(null, consoleOpened);
|
|
|
|
}, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
function consoleOpened(hud) {
|
|
|
|
// Check that css warnings are not coalesced if they come from different lines.
|
2013-04-10 08:22:29 -07:00
|
|
|
info("waiting for 2 css warnings");
|
2013-01-31 09:19:06 -08:00
|
|
|
|
2013-04-10 08:22:29 -07:00
|
|
|
waitForMessages({
|
|
|
|
webconsole: hud,
|
|
|
|
messages: [{
|
|
|
|
name: "two css warnings",
|
|
|
|
category: CATEGORY_CSS,
|
|
|
|
count: 2,
|
|
|
|
repeats: 1,
|
|
|
|
}],
|
|
|
|
}).then(testCSSRepeats.bind(null, hud));
|
2013-01-31 09:19:06 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function testCSSRepeats(hud) {
|
|
|
|
browser.addEventListener("load", function onLoad() {
|
|
|
|
browser.removeEventListener("load", onLoad, true);
|
2013-04-10 08:22:29 -07:00
|
|
|
|
|
|
|
info("wait for repeats after page reload");
|
|
|
|
|
|
|
|
waitForMessages({
|
|
|
|
webconsole: hud,
|
|
|
|
messages: [{
|
|
|
|
name: "two css warnings, repeated twice",
|
|
|
|
category: CATEGORY_CSS,
|
|
|
|
repeats: 2,
|
|
|
|
count: 2,
|
|
|
|
}],
|
|
|
|
}).then(testCSSRepeatsAfterReload.bind(null, hud));
|
2013-01-31 09:19:06 -08:00
|
|
|
}, true);
|
|
|
|
content.location.reload();
|
|
|
|
}
|
|
|
|
|
|
|
|
function testCSSRepeatsAfterReload(hud) {
|
2013-04-10 08:22:29 -07:00
|
|
|
hud.jsterm.clearOutput(true);
|
2013-01-31 09:19:06 -08:00
|
|
|
content.wrappedJSObject.testConsole();
|
|
|
|
|
2013-04-10 08:22:29 -07:00
|
|
|
info("wait for repeats with the console API");
|
|
|
|
|
|
|
|
waitForMessages({
|
|
|
|
webconsole: hud,
|
|
|
|
messages: [
|
|
|
|
{
|
|
|
|
name: "console.log 'foo repeat' repeated twice",
|
|
|
|
category: CATEGORY_WEBDEV,
|
|
|
|
severity: SEVERITY_LOG,
|
|
|
|
repeats: 2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "console.log 'foo repeat' repeated once",
|
|
|
|
category: CATEGORY_WEBDEV,
|
|
|
|
severity: SEVERITY_LOG,
|
|
|
|
repeats: 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "console.error 'foo repeat' repeated once",
|
|
|
|
category: CATEGORY_WEBDEV,
|
|
|
|
severity: SEVERITY_ERROR,
|
|
|
|
repeats: 1,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}).then(testConsoleRepeats.bind(null, hud));
|
2013-01-31 09:19:06 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function testConsoleRepeats(hud) {
|
2013-04-10 08:22:29 -07:00
|
|
|
hud.jsterm.clearOutput(true);
|
2013-01-31 09:19:06 -08:00
|
|
|
hud.jsterm.execute("undefined");
|
|
|
|
content.console.log("undefined");
|
|
|
|
|
2013-04-10 08:22:29 -07:00
|
|
|
info("make sure console API messages are not coalesced with jsterm output");
|
|
|
|
|
|
|
|
waitForMessages({
|
|
|
|
webconsole: hud,
|
|
|
|
messages: [
|
|
|
|
{
|
|
|
|
name: "'undefined' jsterm input message",
|
|
|
|
text: "undefined",
|
|
|
|
category: CATEGORY_INPUT,
|
|
|
|
repeats: 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "'undefined' jsterm output message",
|
|
|
|
text: "undefined",
|
|
|
|
category: CATEGORY_OUTPUT,
|
|
|
|
repeats: 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "'undefined' console.log message",
|
|
|
|
text: "undefined",
|
|
|
|
category: CATEGORY_WEBDEV,
|
|
|
|
repeats: 1,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}).then(finishTest);
|
2013-01-31 09:19:06 -08:00
|
|
|
}
|