test_bug944011.html 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=944011
  5. -->
  6. <head>
  7. <meta charset="utf-8">
  8. <title>Test for Bug 944011</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. <script type="application/javascript">
  12. /** Test for Bug 944011 comment 24 - Event handlers should fire even if the
  13. target comes from a non-current inner. **/
  14. SimpleTest.waitForExplicitFinish();
  15. var gLoadCount = 0;
  16. function loaded() {
  17. ++gLoadCount;
  18. switch(gLoadCount) {
  19. case 1:
  20. ok(true, "Got first load");
  21. oldBody = window[0].document.body;
  22. oldBody.onclick = function() {
  23. ok(true, "Got onclick");
  24. SimpleTest.finish();
  25. }
  26. $('ifr').setAttribute('src', 'data:text/html,<html><body>Second frame</body></html>');
  27. break;
  28. case 2:
  29. ok(true, "Got second load");
  30. oldBody.dispatchEvent(new MouseEvent('click'));
  31. break;
  32. default:
  33. ok(false, "Unexpected load");
  34. SimpleTest.finish();
  35. }
  36. }
  37. </script>
  38. </head>
  39. <body>
  40. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=944011">Mozilla Bug 944011</a>
  41. <p id="display"></p>
  42. <div id="content" style="display: none">
  43. <iframe id="ifr" onload="loaded();" src="data:text/html,<html><body>foo</body></html>"></iframe>
  44. <div name="testTarget"></div>
  45. </div>
  46. <pre id="test">
  47. </pre>
  48. </body>
  49. </html>