test_bug866823.xhtml (1826B)
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=866823 6 --> 7 <window title="Mozilla Bug 866823" 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=866823" 14 target="_blank">Mozilla Bug 866823</a> 15 </body> 16 17 <!-- test code goes here --> 18 <script type="application/javascript"> 19 <![CDATA[ 20 /** Test for Bug 866823 */ 21 SimpleTest.waitForExplicitFinish(); 22 23 function go() { 24 var iwin = $('ifr').contentWindow; 25 26 // Make sure that Xray waivers can't be transitively extended onto objects 27 // for whom the extender may not waive. 28 var sb = new Cu.Sandbox(iwin, { wantXrays: true }); 29 sb.iwin = iwin; 30 ok(Cu.evalInSandbox('iwin.wrappedJSObject.top == iwin.top', sb), "Waiver does not propagate"); 31 Cu.evalInSandbox('iwin.wrappedJSObject.waiver = iwin.wrappedJSObject', sb); 32 ok(iwin.wrappedJSObject.eval('waiver == window'), "Waivers disappear same-compartment"); 33 34 // Make sure that standard prototypes don't get COWs. 35 sb.objProto = Object.prototype; 36 try { 37 sb.eval('objProto.toString;', sb); 38 ok(false, "Should have thrown"); 39 } catch (e) { 40 ok(/denied|insecure/, "No silent failure when accessing properties on forbidden prototype"); 41 } 42 43 SimpleTest.finish(); 44 } 45 46 ]]> 47 </script> 48 <iframe id="ifr" onload="go();" type="content" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html" /> 49 </window>