test_bug706301.xul 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
  10. <!-- test results are displayed in the html:body -->
  11. <body xmlns="http://www.w3.org/1999/xhtml">
  12. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=706301"
  13. target="_blank">Mozilla Bug 706301</a>
  14. <iframe id="ifr" src="http://mochi.test:8888/tests/js/xpconnect/tests/mochitest/file_bug706301.html" onload="doTest();" />
  15. </body>
  16. <!-- test code goes here -->
  17. <script type="application/javascript">
  18. <![CDATA[
  19. /** Test for Bug 706301 **/
  20. SimpleTest.waitForExplicitFinish();
  21. function getLengthInChrome(nodelist) {
  22. // Make sure the object is Xray wrapped.
  23. ok(nodelist === XPCNativeWrapper(nodelist), "object passed from content to chrome " +
  24. "should be Xray-wrapped.");
  25. // Perform the operation.
  26. Object.getOwnPropertyDescriptor(nodelist, 'length');
  27. return nodelist['length'] == 0;
  28. }
  29. function finishTestInChrome() {
  30. SimpleTest.finish();
  31. }
  32. function doTest() {
  33. // Set up the callbacks for content.
  34. $('ifr').contentWindow.wrappedJSObject.getLengthInChrome = getLengthInChrome;
  35. $('ifr').contentWindow.wrappedJSObject.finishTestInChrome = finishTestInChrome;
  36. $('ifr').contentWindow.wrappedJSObject.ok = ok;
  37. // Kick off the test.
  38. $('ifr').contentWindow.postMessage({}, '*');
  39. }
  40. ]]>
  41. </script>
  42. </window>