test_bug1224790-1.xhtml (2253B)
1 <?xml version="1.0"?> 2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?> 3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?> 4 <!-- 5 https://bugzilla.mozilla.org/show_bug.cgi?id=1224790 6 --> 7 <window title="Mozilla Bug 1224790" 8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> 10 <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> 11 12 <!-- test code goes here --> 13 <script type="application/javascript"> 14 <![CDATA[ 15 16 /** Test for Bug 1224790 */ 17 /* 18 * 1. Opens modal dialog 19 * 2. Open non-modal window from modal dialog 20 * 3. Close non-modal window 21 * 4. Close modal dialog 22 * 5. Click button to ensure mouse event is working 23 */ 24 25 function startTest() { 26 window.openDialog('file_bug1224790-1_modal.xhtml', '', 'modal,noopener', window); 27 } 28 29 function modalClosed() { 30 SimpleTest.waitForFocus(gotFocus); 31 } 32 33 var timer = null; 34 function gotFocus() { 35 var button = document.getElementById('button'); 36 synthesizeMouseAtCenter(button, { type: 'mousemove' }, window); 37 function click() { 38 // The bug is not reproducible with synthesizeMouseAtCenter. 39 synthesizeNativeMouseEvent({ type: "click", target: button, atCenter: true }); 40 } 41 click(); 42 // On debug build, it's possible that the click event handler is not 43 // triggered by the first click in case the click is dispatched too early 44 // before Firefox gets ready for input. 45 // Click the button again after 1 sec when we don't get click event. 46 timer = setTimeout(click, 1000); 47 } 48 49 function onClick() { 50 if (timer) { 51 // Avoid clicking unrelated thing. 52 clearTimeout(timer); 53 } 54 ok(true, "Click event should be fired"); 55 SimpleTest.finish(); 56 } 57 58 SimpleTest.waitForExplicitFinish(); 59 SimpleTest.waitForFocus(startTest); 60 ]]> 61 </script> 62 63 <!-- test results are displayed in the html:body --> 64 <body xmlns="http://www.w3.org/1999/xhtml"> 65 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1224790" 66 target="_blank">Mozilla Bug 1224790</a> 67 </body> 68 <button id="button" label="button" oncommand="onClick()" /> 69 </window>