4 https://bugzilla.mozilla.org/show_bug.cgi?id=837723
6 When we use Debugger.Object.prototype.unsafeDereference to get a non-D.O
7 reference to a content object in chrome, that reference should be via an
11 <meta charset=
"utf-8">
12 <title>Mozilla Bug
837723</title>
13 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
14 <link rel=
"stylesheet" type=
"text/css" href=
"chrome://mochikit/content/tests/SimpleTest/test.css">
21 const {addDebuggerToGlobal
} = ChromeUtils
.importESModule("resource://gre/modules/jsdebugger.sys.mjs");
22 addDebuggerToGlobal(globalThis
);
24 window
.onload = function() {
25 SimpleTest
.waitForExplicitFinish();
27 const iframe
= document
.createElement("iframe");
28 iframe
.src
= "http://mochi.test:8888/chrome/devtools/server/tests/chrome/nonchrome_unsafeDereference.html";
30 iframe
.onload = function() {
31 const dbg
= new Debugger();
32 const contentDO
= dbg
.addDebuggee(iframe
.contentWindow
);
33 const xhrDesc
= contentDO
.getOwnPropertyDescriptor("xhr");
35 isnot(xhrDesc
, undefined, "xhr should be visible as property of content global");
36 isnot(xhrDesc
.value
, undefined, "xhr should have a value");
38 const xhr
= xhrDesc
.value
.unsafeDereference();
40 is(typeof xhr
, "object", "we should be able to deference xhr's value's D.O");
41 is(xhr
.timeout
, 1742, "chrome should see the xhr's 'timeout' property");
42 is(xhr
.expando
, undefined, "chrome should not see the xhr's 'expando' property");
47 document
.body
.appendChild(iframe
);