1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 // For bug 773980, test that Components.utils.isDeadWrapper works as expected.
8 add_task(async function test() {
10 "http://mochi.test:8888/browser/js/xpconnect/tests/browser/browser_deadObjectOnUnload.html";
11 let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
12 let browser = gBrowser.selectedBrowser;
13 let innerWindowId = browser.innerWindowID;
14 let contentDocDead = await ContentTask.spawn(
17 async function (args) {
18 let doc = content.document;
19 let { TestUtils } = ChromeUtils.importESModule(
20 "resource://testing-common/TestUtils.sys.mjs"
22 let promise = TestUtils.topicObserved("inner-window-nuked", subject => {
23 let id = subject.QueryInterface(Ci.nsISupportsPRUint64).data;
24 return id == args.innerWindowId;
26 content.location = "http://mochi.test:8888/";
28 return Cu.isDeadWrapper(doc);
31 is(contentDocDead, true, "wrapper is dead");
32 BrowserTestUtils.removeTab(newTab);