test_bug738244.xhtml (1963B)
1 <?xml version="1.0"?> 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 4 type="text/css"?> 5 <!-- 6 https://bugzilla.mozilla.org/show_bug.cgi?id=533596 7 --> 8 <window title="Mozilla Bug 533596" 9 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 10 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 11 12 <!-- test results are displayed in the html:body --> 13 <body xmlns="http://www.w3.org/1999/xhtml"> 14 15 <iframe src="http://example.org/tests/js/xpconnect/tests/mochitest/file_bug738244.html" 16 onload="xrayTest(this)"> 17 </iframe> 18 </body> 19 20 <!-- test code goes here --> 21 <script type="application/javascript"><![CDATA[ 22 23 SimpleTest.waitForExplicitFinish(); 24 25 function xrayTest(ifr) { 26 var win = ifr.contentWindow; 27 var doc = ifr.contentDocument; 28 29 doc.getElementById = 42; 30 is(doc.getElementById, 42, 31 "Native property cannot be shadowed on the xray"); 32 33 is(doc.form1.name, "form1", 34 "Form elements cannot be found by name on the document through xray"); 35 36 is(doc.form1.input1.name, "input1", 37 "Input element cannot be found by name on a form element through xray"); 38 39 is(typeof doc.form1.appendChild, "function", 40 "Input element shadows native property with its name through xray"); 41 42 is(win.frame1, undefined, 43 "IFrames should not be found by name on the window through xray"); 44 45 is(win[0].name, "frame1", 46 "IFrames should be found by index on the window through xray"); 47 48 win["1000"] = "foopy"; 49 ok(!("1000" in win), "Shouldn't be able to add indexed expandos to xray"); 50 51 win["1000a"] = "foopy"; 52 ok("1000a" in win, "Should be able to add named expandos to xray"); 53 54 SimpleTest.finish(); 55 } 56 57 ]]></script> 58 </window>