tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_garbageWatch.html (1379B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=482260
      5 -->
      6 <head>
      7  <title>Test for garbage data returned from location provider </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" href="https://bugzilla.mozilla.org/show_bug.cgi?id=455327">Mozilla Bug 482260</a>
     15 <p id="display"></p>
     16 <div id="content" style="display: none">
     17 
     18 </div>
     19 <pre id="test">
     20 <script class="testbody" type="text/javascript">
     21 /** Test for Bug  */
     22 
     23 SimpleTest.waitForExplicitFinish();
     24 
     25 resume_geolocationProvider(function() {
     26  force_prompt(true, test1);
     27 });
     28 
     29 function test1() {
     30  start_sending_garbage(test2);
     31 }
     32 
     33 function successCallback(_pos){
     34  ok(false, "success should have never been called.");
     35  stop_sending_garbage(function() {SimpleTest.finish();});
     36 }
     37 
     38 function errorCallback(err) {
     39  ok(err.code == err.TIMEOUT, "ensure error is a timeout.");
     40  stop_sending_garbage(function() { SimpleTest.finish(); });
     41 }
     42 
     43 var options = {
     44    maximumAge: 0,
     45    timeout: 1000,
     46 };
     47 
     48 function test2() {
     49  navigator.geolocation.watchPosition(successCallback,
     50                                      errorCallback,
     51                                      options);
     52 }
     53 </script>
     54 </pre>
     55 </body>
     56 </html>