Tue, 06 Jan 2015 21:39:09 +0100
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=911595
5 -->
6 <head>
7 <title>Test for spinning the event loop inside position handlers</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" href="https://bugzilla.mozilla.org/show_bug.cgi?id=911595 ">Mozilla Bug 911595</a>
15 <p id="display"></p>
16 <div id="content" style="display: none">
18 </div>
19 <pre id="test">
20 <script class="testbody" type="text/javascript">
22 /*
23 * In bug 911595 , spinning the event loop from inside position
24 * handlers could cause both success and error callbacks to be
25 * fired for the same request if that request has a small timeout.
26 */
28 SimpleTest.waitForExplicitFinish();
30 resume_geolocationProvider(function() {
31 force_prompt(true, test1);
32 });
34 function spinEventLoopAndSetTimeout() {
35 if (successCallbackCalled || errorCallbackCalled) {
36 // this should only be called once from either callback
37 return;
38 }
40 window.showModalDialog("javascript:window.close()");
42 setTimeout(function() {
43 ok(successCallbackCalled != errorCallbackCalled, "Ensure only one callback is called");
44 SimpleTest.finish();
45 }, 5);
46 }
48 var successCallbackCalled = false;
49 function successCallback(position) {
50 spinEventLoopAndSetTimeout();
51 successCallbackCalled = true;
52 }
54 var errorCallbackCalled = false;
55 function errorCallback(error) {
56 spinEventLoopAndSetTimeout();
57 errorCallbackCalled = true;
58 }
60 function test1() {
61 navigator.geolocation.getCurrentPosition(successCallback, errorCallback, {timeout: 1});
62 }
63 </script>
64 </pre>
65 </body>
66 </html>