test_bug462428.html 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=462428
  5. -->
  6. <head>
  7. <title>Test for Bug 462428</title>
  8. <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  9. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  10. </head>
  11. <body>
  12. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=462428">Mozilla Bug 462428</a>
  13. <p id="display"></p>
  14. <div id="content" style="display: none">
  15. </div>
  16. <pre id="test">
  17. <script type="application/javascript">
  18. /** Test for Bug 462428 **/
  19. var getter = document.__lookupGetter__('documentElement');
  20. ok(getter !== undefined, "But able to look it up the normal way");
  21. ok(!document.hasOwnProperty('documentElement'), "property should still be on the prototype");
  22. var sawProp = false;
  23. for (var i in document) {
  24. if (i === "documentElement") {
  25. sawProp = true;
  26. }
  27. }
  28. ok(sawProp, "property should be enumerable");
  29. is(getter.call(document), document.documentElement, "the getter actually works");
  30. Document.prototype.__defineSetter__('documentElement', function() {});
  31. is(getter.call(document), document.documentElement, "the getter works after defineSetter");
  32. var oldTitle = document.title;
  33. try {
  34. var setter = document.__lookupSetter__('title');
  35. setter.call(document, "title 1");
  36. is(document.title, "title 1", "the setter is bound correctly");
  37. } finally {
  38. document.title = oldTitle
  39. }
  40. </script>
  41. </pre>
  42. </body>
  43. </html>