Bug 1892041 - Part 1: Update test262 features. r=spidermonkey-reviewers,dminor
[gecko.git] / dom / base / test / test_bug353334.html
blob4fa30828a2e4ee5463fca6a817d8408bc44e9622
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=353334
5 -->
6 <head>
7 <title>Test for Bug 353334</title>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
10 <script>var x = "PASS"</script>
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=353334">Mozilla Bug 353334</a>
14 <p id="display">
15 <iframe id="one"></iframe>
16 <object id="two" data="about:blank"></object>
17 <iframe id="three" srcdoc="<body>test</body>"></iframe>
18 <object id="four" data="object_bug353334.html"></object>
19 <iframe id="five" src="javascript:parent.x"></iframe>
20 <object id="six" data="javascript:x"></object>
21 </p>
22 <div id="content" style="display: none">
24 </div>
25 <pre id="test">
26 <script class="testbody" type="text/javascript">
28 /** Test for Bug 353334 **/
29 SimpleTest.waitForExplicitFinish();
31 function doPrincipalTest(id) {
32 var doc = SpecialPowers.wrap($(id).contentDocument);
34 isnot(doc.nodePrincipal, undefined, "Should have a principal");
35 isnot(doc.nodePrincipal, null, "Should have a non-null principal");
36 is(doc.nodePrincipal.origin, SpecialPowers.wrap(document).nodePrincipal.origin,
37 "Wrong principal for document in node with id='" + id + "'");
40 function doContentTest(id) {
41 is($(id).contentDocument.documentElement.textContent, "PASS",
42 "Script executed in wrong context in node with id='" + id + "'");
45 function checkPrincipal() {
46 ok(SpecialPowers.call_Instanceof(SpecialPowers.wrap(document).nodePrincipal, SpecialPowers.Ci.nsIPrincipal),
47 "Should be a principal");
50 addLoadEvent(function() {
51 checkPrincipal();
53 for (var i of [ "one", "two", "three", "four" ]) {
54 doPrincipalTest(i);
57 for (i of [ "five", "six" ]) {
58 doContentTest(i);
61 SimpleTest.finish();
62 });
63 </script>
64 </pre>
65 </body>
66 </html>