blob: a603b03a29215965150fd4e9f6718b50cf4560bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
"use strict";
const server = createHttpServer({ hosts: ["example.com"] });
server.registerDirectory("/data/", do_get_file("data"));
add_task(async function testBackgroundWindow() {
let extension = ExtensionTestUtils.loadExtension({
background() {
browser.test.log("background script executed");
window.location =
"http://example.com/data/file_privilege_escalation.html";
},
});
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();
});
|