test_bug944011.html (1465B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=944011 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 944011</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 <script type="application/javascript"> 12 13 /** 14 * Test for Bug 944011 comment 24 - Event handlers should fire even if the 15 * target comes from a non-current inner. 16 */ 17 SimpleTest.waitForExplicitFinish(); 18 var gLoadCount = 0; 19 function loaded() { 20 ++gLoadCount; 21 switch(gLoadCount) { 22 case 1: 23 ok(true, "Got first load"); 24 oldBody = window[0].document.body; 25 oldBody.onclick = function() { 26 ok(true, "Got onclick"); 27 SimpleTest.finish(); 28 } 29 $('ifr').setAttribute('srcdoc', '<html><body>Second frame</body></html>'); 30 break; 31 case 2: 32 ok(true, "Got second load"); 33 oldBody.dispatchEvent(new MouseEvent('click')); 34 break; 35 default: 36 ok(false, "Unexpected load"); 37 SimpleTest.finish(); 38 } 39 } 40 41 42 </script> 43 </head> 44 <body> 45 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=944011">Mozilla Bug 944011</a> 46 <p id="display"></p> 47 <div id="content" style="display: none"> 48 <iframe id="ifr" onload="loaded();" srcdoc="<html><body>foo</body></html>"></iframe> 49 <div name="testTarget"></div> 50 </div> 51 <pre id="test"> 52 </pre> 53 </body> 54 </html>