Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: asan
- Manifest: devtools/client/webconsole/test/browser/_webconsole.toml
/* Any copyright is dedicated to the Public Domain.
// Tests if the JSTerm sandbox is updated when the user navigates from one
// domain to another, in order to avoid permission denied errors with a sandbox
"use strict";
const BASE_URI =
"browser/devtools/client/webconsole/test/browser/test-console.html";
add_task(async function () {
await pushPref("devtools.webconsole.persistlog", false);
const hud = await openNewTabAndConsole(TEST_URI1);
await executeAndWaitForResultMessage(hud, "window.location.href", TEST_URI1);
// load second url
await navigateTo(TEST_URI2);
ok(
!findErrorMessage(hud, "Permission denied"),
"no permission denied errors"
);
info("wait for window.location.href after page navigation");
await clearOutput(hud);
await executeAndWaitForResultMessage(hud, "window.location.href", TEST_URI2);
ok(
!findErrorMessage(hud, "Permission denied"),
"no permission denied errors"
);
// Navigation clears messages. Wait for that clear to happen before
// continuing the test or it might destroy messages we wait later on (Bug
// 1270234).
const promises = [
hud.ui.once("messages-cleared"),
hud.commands.targetCommand.once("switched-target"),
];
gBrowser.goBack();
info("Waiting for messages-cleared event due to navigation");
await Promise.all(promises);
info("Messages cleared after navigation; checking location");
await executeAndWaitForResultMessage(hud, "window.location.href", TEST_URI1);
ok(
!findErrorMessage(hud, "Permission denied"),
"no permission denied errors"
);
});