test_bug412567.html 1.2 KB

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