dom/tests/mochitest/geolocation/test_manyWindows.html
author Serge Gautherie <sgautherie.bz@free.fr>
Tue, 17 Mar 2009 15:22:54 +0100
changeset 26248 1b83dc5ed168fd03320c884a02122a2cbfc0eb68
parent 26168 54030de86b9c60824ca23a813e0fd144efb23400
child 28048 8f7b73d88f6bbedec99c6c8ef48b243ab922d05c
permissions -rw-r--r--
Bug 451949 - Mochitest <geolocation/test_manyWindows.html> fails intermittently, when some previous tests failed (!?); (Av1) Add missing |SimpleTest.waitForExplicitFinish();|; r=doug.turner

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=478911
-->
<head>
  <title>Test for many windows </title>
  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="geolocation_common.js"></script>

<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=478911">Crash in Multiple Windows</a>
<p id="display"></p>
<div id="content" style="display: none">
  
</div>
<pre id="test">
<script class="testbody" type="text/javascript">

/** Test for Bug  **/

var numberOfWindows = 2;  // 20 seems to be the default max popups during the mochitest run
var totalWindows = numberOfWindows;

var windows = new Array(numberOfWindows);

for(var i = 0; i < numberOfWindows; i++) {
  windows[i] = window.open("geolocation.html", "_blank", "width=700,height=400");
}

for(var i = 0; i < numberOfWindows; i++) {
  windows[i].close();
  totalWindows --;
}

SimpleTest.waitForExplicitFinish();

function checkDone()
{
    if (totalWindows == 0)
    {
        ok(navigator.geolocation, "Opened a bunch of windows and didn't crash.");
        clearInterval(timer);
        SimpleTest.finish();
    }
}

var timer = setInterval(checkDone, 1000);

</script>
</pre>
</body>
</html>