test_bug636097.html 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=504877
  5. test by moz_bug_r_a4@yahoo.com
  6. -->
  7. <head>
  8. <title>Test for Bug 504877</title>
  9. <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  10. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  11. </head>
  12. <body>
  13. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=504877">Mozilla Bug 504877</a>
  14. <p id="display"></p>
  15. <div id="content" style="display: none">
  16. </div>
  17. <pre id="test">
  18. <script type="application/javascript">
  19. /** Test for Bug 504877 **/
  20. SimpleTest.waitForExplicitFinish();
  21. var targetUrl = "http://example.com/";
  22. var l;
  23. function a() {
  24. var r = "FAIL", s;
  25. try {
  26. s = l.toString();
  27. }
  28. catch (e) {
  29. if (/denied|insecure/.test(e))
  30. r = "PASS";
  31. s = e;
  32. }
  33. is(r, "PASS", "should have thrown an exception");
  34. SimpleTest.finish();
  35. }
  36. var p = 0;
  37. function b() {
  38. switch (++p) {
  39. case 1:
  40. frames[0].location = "about:blank";
  41. break;
  42. case 2:
  43. l = frames[0].location;
  44. frames[0].location = targetUrl;
  45. break;
  46. case 3:
  47. a();
  48. break;
  49. }
  50. }
  51. </script>
  52. </pre>
  53. <iframe onload="b()"></iframe>
  54. </body>
  55. </html>