Files
firefox/devtools/client/webconsole/test/browser/browser_webconsole_loglimit.js
T
Kris Maglione 8c0d38f33d Bug 1596918: Part 3a - Scripted rewrite of most ContentTask.spawn calls to SpecialPowers.spawn calls. r=mccr8,remote-protocol-reviewers,ato
This is generally pretty straightforward, and rewrites nearly all calls. It
skips the ones that it can detect using frame script globals like
`sendAsyncMessage`, though.

Differential Revision: https://phabricator.services.mozilla.com/D53740
2019-12-13 20:36:16 +00:00

48 lines
1.5 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test that messages are properly updated when the log limit is reached.
const TEST_URI =
"data:text/html;charset=utf-8,Web Console test for " +
"Old messages are removed after passing devtools.hud.loglimit";
add_task(async function() {
await pushPref("devtools.hud.loglimit", 140);
const hud = await openNewTabAndConsole(TEST_URI);
await clearOutput(hud);
let onMessage = waitForMessage(hud, "test message [149]");
SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function() {
for (let i = 0; i < 150; i++) {
content.console.log(`test message [${i}]`);
}
});
await onMessage;
ok(!findMessage(hud, "test message [0]"), "Message 0 has been pruned");
ok(!findMessage(hud, "test message [9]"), "Message 9 has been pruned");
ok(findMessage(hud, "test message [10]"), "Message 10 is still displayed");
is(
findMessages(hud, "").length,
140,
"Number of displayed messages is correct"
);
onMessage = waitForMessage(hud, "hello world");
SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function() {
content.console.log("hello world");
});
await onMessage;
ok(!findMessage(hud, "test message [10]"), "Message 10 has been pruned");
ok(findMessage(hud, "test message [11]"), "Message 11 is still displayed");
is(
findMessages(hud, "").length,
140,
"Number of displayed messages is still correct"
);
});