test_bug447736.html 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=447736
  5. -->
  6. <head>
  7. <title>Test for Bug 447736</title>
  8. <script type="text/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=447736">Mozilla Bug 447736</a>
  13. <p id="display"></p>
  14. <div id="content" style="display: none">
  15. </div>
  16. <div id="secondTarget"></div>
  17. <pre id="test">
  18. <script class="testbody" type="text/javascript">
  19. /** Test for Bug 447736 **/
  20. var loadEvent = null;
  21. window.addEventListener("load",
  22. function (evt) {
  23. is(evt.target, window.document, "Wrong target!");
  24. is(evt.originalTarget, window.document, "Wrong originalTarget!");
  25. ok(evt.isTrusted, "Event should be trusted!");
  26. loadEvent = evt;
  27. setTimeout("st.dispatchEvent(loadEvent)", 0);
  28. }, true);
  29. var st = document.getElementById("secondTarget");
  30. st.addEventListener("load",
  31. function (evt) {
  32. is(evt.target, st, "Wrong target! (2)");
  33. is(evt.originalTarget, st, "Wrong originalTarget! (2)");
  34. ok(!evt.isTrusted, "Event shouldn't be trusted anymore!");
  35. SimpleTest.finish();
  36. }, true);
  37. SimpleTest.waitForExplicitFinish();
  38. </script>
  39. </pre>
  40. </body>
  41. </html>