blob: b8b2dd0688c5b13cd94596c8a2cf800dfdbb0b11 (
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
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// For bug 773980, test that Components.utils.isDeadWrapper works as expected.
add_task(async function test() {
const url =
"http://mochi.test:8888/browser/js/xpconnect/tests/browser/browser_deadObjectOnUnload.html";
let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
let browser = gBrowser.selectedBrowser;
let innerWindowId = browser.innerWindowID;
let contentDocDead = await ContentTask.spawn(
browser,
{ innerWindowId },
async function (args) {
let doc = content.document;
let { TestUtils } = ChromeUtils.importESModule(
"resource://testing-common/TestUtils.sys.mjs"
);
let promise = TestUtils.topicObserved(
"inner-window-nuked",
(subject, data) => {
let id = subject.QueryInterface(Ci.nsISupportsPRUint64).data;
return id == args.innerWindowId;
}
);
content.location = "http://mochi.test:8888/";
await promise;
return Cu.isDeadWrapper(doc);
}
);
is(contentDocDead, true, "wrapper is dead");
BrowserTestUtils.removeTab(newTab);
});
|