test_bug996069.xhtml (1993B)
1 <?xml version="1.0"?> 2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?> 3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?> 4 <!-- 5 https://bugzilla.mozilla.org/show_bug.cgi?id=996069 6 --> 7 <window title="Mozilla Bug 996069" 8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> 10 11 <!-- test results are displayed in the html:body --> 12 <body xmlns="http://www.w3.org/1999/xhtml"> 13 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=996069" 14 target="_blank">Mozilla Bug 996069</a> 15 </body> 16 17 <!-- test code goes here --> 18 <script type="application/javascript"> 19 <![CDATA[ 20 /** Test for Bug 996069 */ 21 SimpleTest.waitForExplicitFinish(); 22 23 function loaded() { 24 var ifr = document.getElementById("ifr").contentWindow; 25 var sb = new Cu.Sandbox([ifr], 26 { sandboxPrototype: ifr }); 27 28 ifr.wrappedJSObject.finishTest = function() { 29 // If we got here we did not hit the NS_ReleaseAssert... 30 ok(true, "ExpandedPrincipal should not be inherited by content windows"); 31 32 // But let's be sure that the new window does not have nsEP 33 newWin.wrappedJSObject.obj = Cu.evalInSandbox("var obj = { foo: 'bar' }; obj", sb); 34 try { 35 newWin.eval("obj.foo"); 36 ok(false, "newWin should not have access to object from a scope with ExpandedPrincipal"); 37 } catch (e) { 38 ok(/Permission denied/.exec(e.message), "newWin should not have access to object from a scope with ExpandedPrincipal"); 39 } 40 newWin.close(); 41 SimpleTest.finish(); 42 }; 43 44 var newWin = Cu.evalInSandbox( 45 "window.open('https://example.org/chrome/js/xpconnect/tests/chrome/file_bug996069.html');", 46 sb); 47 } 48 49 ]]> 50 </script> 51 <iframe id="ifr" onload="loaded();" type="content" src="https://example.org/chrome/js/xpconnect/tests/chrome/file_bug996069.html" /> 52 </window>