test_bug353334.html (1507B)
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 </head> 11 <body> 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=353334">Mozilla Bug 353334</a> 13 <p id="display"> 14 <iframe id="one"></iframe> 15 <object id="two" data="about:blank"></object> 16 <iframe id="three" srcdoc="<body>test</body>"></iframe> 17 <object id="four" data="object_bug353334.html"></object> 18 </p> 19 <div id="content" style="display: none"> 20 21 </div> 22 <pre id="test"> 23 <script class="testbody" type="text/javascript"> 24 25 /** Test for Bug 353334 */ 26 SimpleTest.waitForExplicitFinish(); 27 28 function doPrincipalTest(id) { 29 var doc = SpecialPowers.wrap($(id).contentDocument); 30 31 isnot(doc.nodePrincipal, undefined, "Should have a principal"); 32 isnot(doc.nodePrincipal, null, "Should have a non-null principal"); 33 is(doc.nodePrincipal.origin, SpecialPowers.wrap(document).nodePrincipal.origin, 34 "Wrong principal for document in node with id='" + id + "'"); 35 } 36 37 function checkPrincipal() { 38 ok(SpecialPowers.call_Instanceof(SpecialPowers.wrap(document).nodePrincipal, SpecialPowers.Ci.nsIPrincipal), 39 "Should be a principal"); 40 } 41 42 addLoadEvent(function() { 43 checkPrincipal(); 44 45 for (var i of [ "one", "two", "three", "four" ]) { 46 doPrincipalTest(i); 47 } 48 49 SimpleTest.finish(); 50 }); 51 </script> 52 </pre> 53 </body> 54 </html>