test_bug1079236.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=1079236
  5. -->
  6. <head>
  7. <meta charset="utf-8">
  8. <title>Test for Bug 1079236</title>
  9. <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  10. <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
  11. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  12. <script type="application/javascript">
  13. /** Test for Bug 1079236 **/
  14. SimpleTest.waitForExplicitFinish();
  15. SimpleTest.waitForFocus(runTests);
  16. function runTests() {
  17. var c = document.getElementById("content");
  18. var sr = c.createShadowRoot();
  19. sr.innerHTML = "<input type='file'" + ">";
  20. var file = sr.firstChild;
  21. is(file.type, "file");
  22. file.offsetLeft; // Flush layout because dispatching mouse events.
  23. document.body.onmousemove = function(e) {
  24. is(e.target, c, "Event target should be the element in non-Shadow DOM");
  25. if (e.originalTarget == file) {
  26. is(e.originalTarget, file,
  27. "type='file' implementation doesn't seem to have native anonymous content");
  28. } else {
  29. var wrapped = SpecialPowers.wrap(e.originalTarget);
  30. isnot(wrapped, file, "Shouldn't have the same event.target and event.originalTarget");
  31. }
  32. ok(!("composedTarget" in e), "Events shouldn't have composedTarget in non-chrome context!");
  33. e = SpecialPowers.wrap(e);
  34. var composedTarget = SpecialPowers.unwrap(e.composedTarget);
  35. ok(composedTarget, file, "composedTarget should be the file object.");
  36. SimpleTest.finish();
  37. }
  38. var r = file.getBoundingClientRect();
  39. synthesizeMouse(file, r.width / 6, r.height / 2, { type: "mousemove"} );
  40. document.body.onmousemove = null;
  41. }
  42. </script>
  43. </head>
  44. <body>
  45. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1079236">Mozilla Bug 1079236</a>
  46. <p id="display"></p>
  47. <div id="content">
  48. </div>
  49. <pre id="test">
  50. </pre>
  51. </body>
  52. </html>