test_bug1079236.html (2203B)
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 src="/tests/SimpleTest/SimpleTest.js"></script> 10 <script src="/tests/SimpleTest/EventUtils.js"></script> 11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 12 <script type="application/javascript"> 13 14 /** Test for Bug 1079236 */ 15 16 function runTests() { 17 var iframe = document.createElement('iframe'); 18 document.body.appendChild(iframe); 19 iframe.contentDocument.body.innerHTML = '<div id="content"></div>'; 20 21 var c = iframe.contentDocument.getElementById("content"); 22 var sr = c.attachShadow({mode: 'open'}); 23 sr.innerHTML = "<input type='file'" + ">"; 24 var file = sr.firstChild; 25 is(file.type, "file"); 26 file.offsetLeft; // Flush layout because dispatching mouse events. 27 iframe.contentDocument.body.onmousemove = function(e) { 28 is(e.target, c, "Event target should be the element in non-Shadow DOM"); 29 if (e.originalTarget == file) { 30 is(e.originalTarget, file, 31 "type='file' implementation doesn't seem to have native anonymous content"); 32 } else { 33 var wrapped = SpecialPowers.wrap(e.originalTarget); 34 isnot(wrapped, file, "Shouldn't have the same event.target and event.originalTarget"); 35 } 36 37 ok(!("composedTarget" in e), "Events shouldn't have composedTarget in non-chrome context!"); 38 e = SpecialPowers.wrap(e); 39 var composedTarget = SpecialPowers.unwrap(e.composedTarget); 40 is(composedTarget, file, "composedTarget should be the file object."); 41 42 SimpleTest.finish(); 43 } 44 45 var r = file.getBoundingClientRect(); 46 synthesizeMouse(file, r.width / 6, r.height / 2, { type: "mousemove"}, iframe.contentWindow); 47 iframe.contentDocument.body.onmousemove = null; 48 } 49 50 SimpleTest.waitForExplicitFinish(); 51 window.onload = () => { 52 SimpleTest.waitForFocus(runTests); 53 }; 54 55 </script> 56 </head> 57 <body> 58 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1079236">Mozilla Bug 1079236</a> 59 <p id="display"></p> 60 <div id="content"> 61 62 </div> 63 <pre id="test"> 64 </pre> 65 </body> 66 </html>