Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os == 'win' && socketprocess_networking && fission OR os == 'mac' && socketprocess_networking && fission OR os == 'mac' && debug OR os == 'linux' && socketprocess_networking
- Manifest: toolkit/components/extensions/test/xpcshell/xpcshell-remote.toml includes toolkit/components/extensions/test/xpcshell/xpcshell-common.toml
- Manifest: toolkit/components/extensions/test/xpcshell/xpcshell.toml includes toolkit/components/extensions/test/xpcshell/xpcshell-common.toml
"use strict";
const server = createHttpServer({ hosts: ["example.com"] });
server.registerDirectory("/data/", do_get_file("data"));
add_task(async function testBackgroundWindow() {
// Background navigates to http:-URL.
allow_unsafe_parent_loads_when_extensions_not_remote();
let extension = ExtensionTestUtils.loadExtension({
background() {
browser.test.log("background script executed");
window.location =
},
});
let awaitConsole = new Promise(resolve => {
Services.console.registerListener(function listener(message) {
if (/WebExt Privilege Escalation/.test(message.message)) {
Services.console.unregisterListener(listener);
resolve(message);
}
});
});
await extension.startup();
let message = await awaitConsole;
ok(
message.message.includes(
"WebExt Privilege Escalation: typeof(browser) = undefined"
),
"Document does not have `browser` APIs."
);
await extension.unload();
revert_allow_unsafe_parent_loads_when_extensions_not_remote();
});