blob: 69e019c0624a0be7f427c00db9d0b4f8161d0c78 (
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
36
37
38
39
40
41
42
43
44
45
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Check that Dead Objects do not break the Web/Browser Consoles.
//
// This test:
// - Opens the Browser Console.
// - Creates a sandbox.
// - Stores a reference to the sandbox on the chrome window object.
// - Nukes the sandbox
// - Tries to use the sandbox. This is the dead object.
"use strict";
add_task(async function () {
// Needed for the execute() function below
await pushPref("security.allow_parent_unrestricted_js_loads", true);
const hud = await BrowserConsoleManager.toggleBrowserConsole();
ok(hud, "browser console opened");
// Add the reference to the nuked sandbox.
execute(
hud,
"window.nukedSandbox = Cu.Sandbox(null); Cu.nukeSandbox(nukedSandbox);"
);
await executeAndWaitForResultMessage(hud, "nukedSandbox", "DeadObject");
const msg = await executeAndWaitForErrorMessage(
hud,
"nukedSandbox.hello",
"can't access dead object"
);
// Check that the link contains an anchor. We can't click on the link because
// clicking links from tests attempts to access an external URL and crashes Firefox.
const anchor = msg.node.querySelector("a");
is(anchor.textContent, "[Learn More]", "Link text is correct");
await executeAndWaitForResultMessage(
hud,
"delete window.nukedSandbox; 1 + 1",
"2"
);
});
|