test_bug396851.html 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=396851
  5. -->
  6. <head>
  7. <title>Test for Bug 396851</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. <script type="text/javascript">
  11. function go() {
  12. var iframe = $("ifr");
  13. var win = iframe.contentWindow;
  14. try {
  15. var doc = win.document;
  16. fail("Allowed cross-origin access to the document");
  17. } catch (e) {
  18. ok(e.toString().match("Permission denied") != null, "Weird exception thrown");
  19. }
  20. doc = SpecialPowers.wrap(win).document;
  21. ok(doc != null, "Able to access the cross-origin document");
  22. SimpleTest.finish();
  23. }
  24. </script>
  25. </head>
  26. <body>
  27. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=396851">Mozilla Bug 396851</a>
  28. <p id="display"></p>
  29. <div id="content" style="display: none">
  30. </div>
  31. <script type="text/javascript">
  32. SimpleTest.waitForExplicitFinish();
  33. </script>
  34. <iframe id="ifr"
  35. src="http://example.org/tests/js/xpconnect/tests/mochitest/inner.html"
  36. onload="go()">
  37. </iframe>
  38. </body>
  39. </html>