4 https://bugzilla.mozilla.org/show_bug.cgi?id=1223372
8 <title>Test for Bug
1223372</title>
9 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel=
"stylesheet" type=
"text/css" href=
"chrome://global/skin"/>
11 <link rel=
"stylesheet" type=
"text/css" href=
"chrome://mochikit/content/tests/SimpleTest/test.css"/>
12 <script type=
"application/javascript">
14 /** Test for Bug
1223372 **/
15 const {TestUtils} = ChromeUtils.importESModule(
16 "resource://testing-common/TestUtils.sys.mjs"
20 SimpleTest.waitForExplicitFinish();
21 await SpecialPowers.pushPrefEnv({
"set": [[
"security.allow_eval_with_system_principal",
24 var frame = $('subframe');
27 var w = frame.contentWindow;
29 w.eval(
"checkDead = function() { return Components.utils.isDeadWrapper(this); };");
30 var checkDead = w.checkDead;
32 w.eval(
"getObject = function() { return {}; }");
33 var getObject = w.getObject;
35 ok(!checkDead(),
"WindowProxy shouldn't be dead yet");
37 // Load a content page in the chrome frame.
38 w.location =
"https://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html";
41 function tryWindow() {
42 if (w.document.title != 'empty test page') {
43 info(
"Document not loaded yet - retrying");
44 SimpleTest.executeSoon(tryWindow);
48 let winID = w.docShell.outerWindowID;
49 // Remove the frame. This will nuke the WindowProxy wrapper from our chrome
50 // document's global, so evaluating 'this' in it will return a dead wrapper
51 // once the window is destroyed.
54 TestUtils.topicObserved(
"outer-window-nuked", (subject) =
> {
55 let id = subject.QueryInterface(Ci.nsISupportsPRUint64).data;
58 ok(checkDead(),
"Expected a dead object wrapper");
60 // Wrapping the Window should return a dead wrapper now.
61 var global = Cu.getGlobalForObject(getObject());
62 ok(Cu.isDeadWrapper(global),
63 "Expected a dead wrapper when requesting the window's global");
73 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=1223372">Mozilla Bug
1223372</a>
75 <iframe id=
"subframe" src=
"./file_empty.html" onload=
"go()"></iframe>