test_bug706301.xhtml (1707B)
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=706301 6 --> 7 <window title="Mozilla Bug 706301" 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=706301" 14 target="_blank">Mozilla Bug 706301</a> 15 <iframe id="ifr" src="http://mochi.test:8888/tests/js/xpconnect/tests/mochitest/file_bug706301.html" onload="doTest();" /> 16 </body> 17 18 <!-- test code goes here --> 19 <script type="application/javascript"> 20 <![CDATA[ 21 /** Test for Bug 706301 */ 22 23 SimpleTest.waitForExplicitFinish(); 24 25 function getLengthInChrome(nodelist) { 26 27 // Make sure the object is Xray wrapped. 28 is(nodelist, Cu.unwaiveXrays(nodelist), 29 "object passed from content to chrome should be Xray-wrapped."); 30 31 // Perform the operation. 32 Object.getOwnPropertyDescriptor(nodelist, 'length'); 33 return !nodelist.length; 34 } 35 36 function finishTestInChrome() { 37 SimpleTest.finish(); 38 } 39 40 function doTest() { 41 42 // Set up the callbacks for content. 43 $('ifr').contentWindow.wrappedJSObject.getLengthInChrome = getLengthInChrome; 44 $('ifr').contentWindow.wrappedJSObject.finishTestInChrome = finishTestInChrome; 45 $('ifr').contentWindow.wrappedJSObject.ok = ok; 46 47 // Kick off the test. 48 $('ifr').contentWindow.postMessage({}, '*'); 49 } 50 ]]> 51 </script> 52 </window>