test_manyWindows.html (1541B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=478911 5 --> 6 <head> 7 <title>Test for many windows </title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script type="text/javascript" src="geolocation_common.js"></script> 10 11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 12 </head> 13 <body> 14 <a target="_blank" 15 href="https://bugzilla.mozilla.org/show_bug.cgi?id=478911">Crash in Multiple Windows</a> 16 <p id="display"></p> 17 <div id="content" style="display: none"> 18 19 </div> 20 <pre id="test"> 21 <script class="testbody" type="text/javascript"> 22 23 // ensure we are using the right testing provider 24 resume_geolocationProvider(function() { 25 force_prompt(true, test1); 26 }); 27 28 /** Test for Bug */ 29 30 var numberOfWindows = 5; // 20 seems to be the default max popups during the mochitest run 31 var loadedWindows = 0; 32 33 var windows = new Array(numberOfWindows); 34 35 addEventListener("message", function() { 36 ++loadedWindows; 37 if (loadedWindows == numberOfWindows) { 38 SimpleTest.executeSoon(closeWindows); 39 } 40 }, false); 41 42 function test1() { 43 for(var i = 0; i < numberOfWindows; i++) { 44 windows[i] = window.open("geolocation.html", "_blank", "width=700,height=400"); 45 } 46 } 47 48 function closeWindows() 49 { 50 for(var i = 0; i < numberOfWindows; i++) { 51 windows[i].close(); 52 } 53 SimpleTest.waitForFocus(done); 54 } 55 56 SimpleTest.waitForExplicitFinish(); 57 58 function done() 59 { 60 ok(navigator.geolocation, "Opened a bunch of windows and didn't crash."); 61 SimpleTest.finish(); 62 } 63 64 </script> 65 </pre> 66 </body> 67 </html>