Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

/* Any copyright is dedicated to the Public Domain.
"use strict";
// See Bug 597756. Check that errors are still displayed in the console after
// reloading a page.
const TEST_URI =
"test/browser/test-reopen-closed-tab.html";
add_task(async function () {
// If we persist log, the test might be successful even if only the first
// error log is shown.
pushPref("devtools.webconsole.persistlog", false);
info("Open console and refresh tab.");
expectUncaughtExceptionNoE10s();
let hud = await openNewTabAndConsole(TEST_URI);
await clearOutput(hud);
expectUncaughtExceptionNoE10s();
await reloadBrowser();
await waitForError(hud);
// Close and reopen
await closeConsole();
expectUncaughtExceptionNoE10s();
gBrowser.removeCurrentTab();
hud = await openNewTabAndConsole(TEST_URI);
expectUncaughtExceptionNoE10s();
await reloadBrowser();
await waitForError(hud);
});
async function waitForError(hud) {
info("Wait for error message");
await waitFor(() => findErrorMessage(hud, "fooBug597756_error"));
ok(true, "error message displayed");
}
function expectUncaughtExceptionNoE10s() {
// On e10s, the exception is triggered in child process
// and is ignored by test harness
if (!Services.appinfo.browserTabsRemoteAutostart) {
expectUncaughtException();
}
}