Backed out changeset 713114c0331a (bug 1938707) by developer request CLOSED TREE
[gecko.git] / js / xpconnect / tests / mochitest / test_bug829872.html
blob07e2a4ca77824584eb4f7d4974348f00f85b39b5
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=829872
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Test for Bug 829872</title>
9 <script src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
11 <script type="application/javascript">
13 /** Test for Bug 829872 and Bug 968003 **/
14 SimpleTest.waitForExplicitFinish();
16 var gLoadCount = 0;
17 function loaded() {
18 if (++gLoadCount == 3)
19 go();
22 async function check(elem, desc) {
23 is(elem.contentDocument, null, "null cross-origin contentDocument for " + desc);
24 ok(await SpecialPowers.spawn(elem, [], () => this.content.eval('frameElement === null;')),
25 "null cross-origin frameElement for " + desc);
26 if (!(elem instanceof elem.ownerDocument.defaultView.HTMLFrameElement))
27 is(elem.getSVGDocument(), null, "null cross-origin getSVGDocument() for " + desc);
30 async function go() {
31 ok(true, "Starting test");
32 await check($('ifr'), "iframe element");
33 await check($('obj'), "object element");
34 await check($('framesetholder').contentDocument.getElementById('fr'), "frameset frame");
35 SimpleTest.finish();
38 </script>
39 </head>
40 <body>
41 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=829872">Mozilla Bug 829872</a>
42 <p id="display"></p>
43 <div id="content" style="display: none">
45 </div>
46 <pre id="test">
47 </pre>
48 <iframe id="ifr" onload="loaded();" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html"></iframe>
49 <object id="obj" onload="loaded();" data="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html"></object>
50 <iframe id="framesetholder" srcdoc="<html><head></head><frameset cols='100%'><frame id='fr' onload='parent.loaded();' src='http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html' /></frameset></html>"></iframe>
51 </body>
52 </html>