Backed out changeset b71c8c052463 (bug 1943846) for causing mass failures. CLOSED...
[gecko.git] / devtools / server / tests / chrome / test_unsafeDereference.html
blobeca1e7d43e545f8cb9596d72b60033326346bf89
1 <!DOCTYPE HTML>
2 <html>
3 <!--
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
8 xray wrapper.
9 -->
10 <head>
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">
15 </head>
16 <body>
17 <pre id="test">
18 <script>
19 "use strict";
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");
44 SimpleTest.finish();
47 document.body.appendChild(iframe);
50 </script>
51 </pre>
52 </body>
53 </html>