test_bug661980.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=661980
  5. -->
  6. <head>
  7. <title>Test for Bug 661980</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. </head>
  11. <body>
  12. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=661980">Mozilla Bug 661980</a>
  13. <p id="display"></p>
  14. <div id="content" style="display: none">
  15. </div>
  16. <pre id="test">
  17. <script type="application/javascript">
  18. /** Test for Bug 661980 **/
  19. // While not currently needed, make this as similar as possible to a real
  20. // EventTarget just to make sure that we're tripping on the wrapping and
  21. // nothing else.
  22. var fakeTarget = {
  23. addEventListener: function() {},
  24. removeEventListener: function() {},
  25. dispatchEvent: function() {}
  26. }
  27. var mouseevent = document.createEvent("MouseEvent");
  28. var didThrow = false;
  29. dump("hello nurse\n");
  30. try {
  31. mouseevent.initMouseEvent("mouseover",
  32. false, false,
  33. window,
  34. 1, 2, 3, 4, 5,
  35. false, false, false, false,
  36. 0,
  37. fakeTarget);
  38. }
  39. catch (ex) {
  40. didThrow = true;
  41. }
  42. ok(didThrow, "should not be able to implement EventTarget using script");
  43. mouseevent.initMouseEvent("mouseout",
  44. false, false,
  45. window,
  46. 1, 2, 3, 4, 5,
  47. false, false, false, false,
  48. 0,
  49. document.body);
  50. is(mouseevent.type, "mouseout",
  51. "should able to implement EventTarget using Element");
  52. </script>
  53. </pre>
  54. </body>
  55. </html>