dom/tests/mochitest/geolocation/test_manyWindows.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/geolocation/test_manyWindows.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,67 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=478911
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for many windows </title>
    1.11 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="text/javascript" src="geolocation_common.js"></script>
    1.13 +
    1.14 +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.15 +</head>
    1.16 +<body>
    1.17 +<a target="_blank"
    1.18 +href="https://bugzilla.mozilla.org/show_bug.cgi?id=478911">Crash in Multiple Windows</a>
    1.19 +<p id="display"></p>
    1.20 +<div id="content" style="display: none">
    1.21 +  
    1.22 +</div>
    1.23 +<pre id="test">
    1.24 +<script class="testbody" type="text/javascript">
    1.25 +
    1.26 +// ensure we are using the right testing provider
    1.27 +resume_geolocationProvider(function() {
    1.28 +  force_prompt(true, test1);
    1.29 +});
    1.30 +
    1.31 +/** Test for Bug  **/
    1.32 +
    1.33 +var numberOfWindows = 5;  // 20 seems to be the default max popups during the mochitest run
    1.34 +var loadedWindows = 0;
    1.35 +
    1.36 +var windows = new Array(numberOfWindows);
    1.37 +
    1.38 +addEventListener("message", function() {
    1.39 +  ++loadedWindows;
    1.40 +  if (loadedWindows == numberOfWindows) {
    1.41 +    SimpleTest.executeSoon(closeWindows);
    1.42 +  }
    1.43 +}, false);
    1.44 +
    1.45 +function test1() {
    1.46 +  for(var i = 0; i < numberOfWindows; i++) {
    1.47 +    windows[i] = window.open("geolocation.html", "_blank", "width=700,height=400");
    1.48 +  }
    1.49 +}
    1.50 +
    1.51 +function closeWindows()
    1.52 +{
    1.53 +  for(var i = 0; i < numberOfWindows; i++) {
    1.54 +    windows[i].close();
    1.55 +  }
    1.56 +  SimpleTest.waitForFocus(done);
    1.57 +}
    1.58 +
    1.59 +SimpleTest.waitForExplicitFinish();
    1.60 +
    1.61 +function done()
    1.62 +{
    1.63 +  ok(navigator.geolocation, "Opened a bunch of windows and didn't crash.");
    1.64 +  SimpleTest.finish();
    1.65 +}
    1.66 +
    1.67 +</script>
    1.68 +</pre>
    1.69 +</body>
    1.70 +</html>

mercurial