file_bug789713.html 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=789713
  5. -->
  6. <head>
  7. <meta charset="utf-8">
  8. </head>
  9. <body>
  10. <script type="application/javascript">
  11. /** Test for Bug 789713 **/
  12. function go() {
  13. var ifr = document.getElementById('ifr');
  14. var pass = true;
  15. var doc = ifr.contentDocument;
  16. // Tree walkers use nsDOMGenericSH, which has a spineless PreCreate.
  17. var walker = doc.createTreeWalker(doc.body);
  18. pass = pass && (walker.root === doc.body);
  19. // Grab a reference to Object.prototype to make sure we test the machinery
  20. // with respect to standard prototype remapping.
  21. var objProto = ifr.contentWindow.Object.prototype;
  22. // First, do the document.domain operation. This shouldn't crash.
  23. document.domain = "example.org";
  24. // Now, make sure that we still can't access cross-origin properties despite
  25. // the fact that the WN is shared under the hood.
  26. try {
  27. walker.root;
  28. pass = false;
  29. } catch (e) { pass = pass && /Permission denied/.exec(e.message); }
  30. window.parent.postMessage(pass, '*');
  31. }
  32. </script>
  33. <iframe id="ifr" src="file_empty.html" onload="go()"></iframe>
  34. </pre>
  35. </body>
  36. </html>