dom/tests/mochitest/geolocation/test_manyWindows.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <script type="text/javascript" src="geolocation_common.js"></script>
    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">
    19 </div>
    20 <pre id="test">
    21 <script class="testbody" type="text/javascript">
    23 // ensure we are using the right testing provider
    24 resume_geolocationProvider(function() {
    25   force_prompt(true, test1);
    26 });
    28 /** Test for Bug  **/
    30 var numberOfWindows = 5;  // 20 seems to be the default max popups during the mochitest run
    31 var loadedWindows = 0;
    33 var windows = new Array(numberOfWindows);
    35 addEventListener("message", function() {
    36   ++loadedWindows;
    37   if (loadedWindows == numberOfWindows) {
    38     SimpleTest.executeSoon(closeWindows);
    39   }
    40 }, false);
    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 }
    48 function closeWindows()
    49 {
    50   for(var i = 0; i < numberOfWindows; i++) {
    51     windows[i].close();
    52   }
    53   SimpleTest.waitForFocus(done);
    54 }
    56 SimpleTest.waitForExplicitFinish();
    58 function done()
    59 {
    60   ok(navigator.geolocation, "Opened a bunch of windows and didn't crash.");
    61   SimpleTest.finish();
    62 }
    64 </script>
    65 </pre>
    66 </body>
    67 </html>

mercurial