test_bug297761.html (1759B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=297761 5 --> 6 <head> 7 <title>Test for Bug 297761</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=297761">Mozilla Bug 297761</a> 13 <p id="display"></p> 14 <div id="content"> 15 <iframe src="file_bug297761.html"></iframe> 16 <iframe src="file_bug297761.html"></iframe> 17 <iframe src="file_bug297761.html"></iframe> 18 <iframe src="file_bug297761.html"></iframe> 19 </div> 20 <pre id="test"> 21 <script type="application/javascript"> 22 23 /** Test for Bug 297761 */ 24 25 SimpleTest.waitForExplicitFinish(); 26 27 var nbTests = 4; 28 var curTest = 0; 29 30 function nextTest() 31 { 32 if (curTest == 3) { 33 frames[curTest].document.forms[0].submit(); 34 } else { 35 var el = null; 36 if (curTest == 2) { 37 el = frames[curTest].document.getElementById('i'); 38 } else { 39 el = frames[curTest].document.forms[0].elements[curTest]; 40 } 41 42 el.focus(); 43 el.click(); 44 } 45 } 46 47 function frameLoaded(aFrame) 48 { 49 var documentLocation = location.href.replace(/\.html.*/, "\.html"); 50 is(aFrame.contentWindow.location.href.replace(/\?x=0&y=0/, "?"), 51 documentLocation.replace(/test_bug/, "file_bug") + "?", 52 "form should have been submitted to the document location"); 53 54 if (++curTest == nbTests) { 55 SimpleTest.finish(); 56 } else { 57 nextTest(); 58 } 59 } 60 61 function runTest() 62 { 63 // Initialize event handlers. 64 var frames = document.getElementsByTagName('iframe'); 65 for (var i=0; i<nbTests; ++i) { 66 frames[i].setAttribute('onload', "frameLoaded(this);"); 67 } 68 69 nextTest(); 70 } 71 72 addLoadEvent(runTest); 73 74 </script> 75 </pre> 76 </body> 77 </html>