test_bug447736.html (1330B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=447736 5 --> 6 <head> 7 <title>Test for Bug 447736</title> 8 <script 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=447736">Mozilla Bug 447736</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 16 </div> 17 <div id="secondTarget"></div> 18 <pre id="test"> 19 <script class="testbody" type="text/javascript"> 20 21 /** Test for Bug 447736 */ 22 23 var loadEvent = null; 24 window.addEventListener("load", 25 function (evt) { 26 is(evt.target, window.document, "Wrong target!"); 27 is(evt.originalTarget, window.document, "Wrong originalTarget!"); 28 ok(evt.isTrusted, "Event should be trusted!"); 29 loadEvent = evt; 30 // eslint-disable-next-line no-implied-eval 31 setTimeout("st.dispatchEvent(loadEvent)", 0); 32 }, true); 33 34 var st = document.getElementById("secondTarget"); 35 st.addEventListener("load", 36 function (evt) { 37 is(evt.target, st, "Wrong target! (2)"); 38 is(evt.originalTarget, st, "Wrong originalTarget! (2)"); 39 ok(!evt.isTrusted, "Event shouldn't be trusted anymore!"); 40 SimpleTest.finish(); 41 }, true); 42 43 SimpleTest.waitForExplicitFinish(); 44 </script> 45 </pre> 46 </body> 47 </html>