test_bug738244.xul 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 type="application/javascript"
  11. src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
  12. <!-- test results are displayed in the html:body -->
  13. <body xmlns="http://www.w3.org/1999/xhtml">
  14. <iframe src="http://example.org/tests/js/xpconnect/tests/mochitest/file_bug738244.html"
  15. onload="xrayTest(this)">
  16. </iframe>
  17. </body>
  18. <!-- test code goes here -->
  19. <script type="application/javascript"><![CDATA[
  20. SimpleTest.waitForExplicitFinish();
  21. function xrayTest(ifr) {
  22. var win = ifr.contentWindow;
  23. var doc = ifr.contentDocument;
  24. doc.getElementById = 42;
  25. is(doc.getElementById, 42,
  26. "Native property cannot be shadowed on the xray");
  27. is(doc.form1.name, "form1",
  28. "Form elements cannot be found by name on the document through xray");
  29. is(doc.form1.input1.name, "input1",
  30. "Input element cannot be found by name on a form element through xray");
  31. is(typeof doc.form1.appendChild, "function",
  32. "Input element shadows native property with its name through xray");
  33. is(win.frame1.name, "frame1",
  34. "IFrames cannot be found by name on the window through xray");
  35. is(win[0].name, "frame1",
  36. "IFrames cannot be found by index on the window through xray");
  37. win["1000"] = "foopy";
  38. ok(!("1000" in win), "Shouldn't be able to add indexed expandos to xray");
  39. win["1000a"] = "foopy";
  40. ok("1000a" in win, "Should be able to add named expandos to xray");
  41. SimpleTest.finish();
  42. }
  43. ]]></script>
  44. </window>