1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/xpconnect/tests/chrome/test_bug738244.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> 1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 1.7 + type="text/css"?> 1.8 +<!-- 1.9 +https://bugzilla.mozilla.org/show_bug.cgi?id=533596 1.10 +--> 1.11 +<window title="Mozilla Bug 533596" 1.12 + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 1.13 + <script type="application/javascript" 1.14 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.15 + 1.16 + <!-- test results are displayed in the html:body --> 1.17 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.18 + 1.19 + <iframe src="http://example.org/tests/js/xpconnect/tests/mochitest/file_bug738244.html" 1.20 + onload="xrayTest(this)"> 1.21 + </iframe> 1.22 + </body> 1.23 + 1.24 + <!-- test code goes here --> 1.25 + <script type="application/javascript"><![CDATA[ 1.26 + 1.27 + SimpleTest.waitForExplicitFinish(); 1.28 + 1.29 + function xrayTest(ifr) { 1.30 + var win = ifr.contentWindow; 1.31 + var doc = ifr.contentDocument; 1.32 + 1.33 + doc.getElementById = 42; 1.34 + is(doc.getElementById, 42, 1.35 + "Native property cannot be shadowed on the xray"); 1.36 + 1.37 + is(doc.form1.name, "form1", 1.38 + "Form elements cannot be found by name on the document through xray"); 1.39 + 1.40 + is(doc.form1.input1.name, "input1", 1.41 + "Input element cannot be found by name on a form element through xray"); 1.42 + 1.43 + is(typeof doc.form1.appendChild, "function", 1.44 + "Input element shadows native property with its name through xray"); 1.45 + 1.46 + is(win.frame1.name, "frame1", 1.47 + "IFrames cannot be found by name on the window through xray"); 1.48 + 1.49 + is(win[0].name, "frame1", 1.50 + "IFrames cannot be found by index on the window through xray"); 1.51 + 1.52 + win["1000"] = "foopy"; 1.53 + ok(!("1000" in win), "Shouldn't be able to add indexed expandos to xray"); 1.54 + 1.55 + win["1000a"] = "foopy"; 1.56 + ok("1000a" in win, "Should be able to add named expandos to xray"); 1.57 + 1.58 + SimpleTest.finish(); 1.59 + } 1.60 + 1.61 + ]]></script> 1.62 +</window>