test_bug489671.html (1640B)
1 <!doctype html> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=489671 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 489671</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" href="/tests/SimpleTest/test.css"> 11 </head> 12 <body> 13 <a target="_blank" 14 href="https://bugzilla.mozilla.org/show_bug.cgi?id=489671" 15 >Mozilla Bug 489671</a> 16 <p id="display" onclick="queueNextTest(); throw 'Got click 1';"></p> 17 <script> 18 // override window.onerror so it won't see our exceptions 19 window.onerror = function() {} 20 21 var testNum = 0; 22 function doTest() { 23 switch(testNum++) { 24 case 0: 25 var event = document.createEvent("MouseEvents"); 26 event.initMouseEvent("click", true, true, document.defaultView, 27 0, 0, 0, 0, 0, false, false, false, false, 0, null); 28 $("display").dispatchEvent(event); 29 break; 30 case 1: 31 var script = document.createElement("script"); 32 script.textContent = "queueNextTest(); throw 'Got click 2'"; 33 document.body.appendChild(script); 34 break; 35 case 2: 36 // eslint-disable-next-line no-implied-eval 37 window.setTimeout("queueNextTest(); throw 'Got click 3'", 0); 38 break; 39 case 3: 40 SimpleTest.endMonitorConsole(); 41 break; 42 } 43 } 44 function queueNextTest() { SimpleTest.executeSoon(doTest); } 45 46 SimpleTest.waitForExplicitFinish(); 47 SimpleTest.monitorConsole(SimpleTest.finish, [ 48 { errorMessage: "uncaught exception: Got click 1" }, 49 { errorMessage: "uncaught exception: Got click 2" }, 50 { errorMessage: "uncaught exception: Got click 3" } 51 ]); 52 53 doTest(); 54 </script> 55 </body> 56 </html>