tor-browser

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

test_clearWatchBeforeAllowing.html (1513B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=886026
      5 -->
      6 <head>
      7  <title>Test for getCurrentPosition </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"
     15 href="https://bugzilla.mozilla.org/show_bug.cgi?id=886026">Mozilla Bug 886026</a>
     16 <p id="display"></p>
     17 <div id="content" style="display: none">
     18 
     19 </div>
     20 <pre id="test">
     21 <script class="testbody" type="text/javascript">
     22 "use strict";
     23 
     24 SimpleTest.waitForExplicitFinish();
     25 resume_geolocationProvider(function() {
     26  force_prompt(true, run_test);
     27 });
     28 
     29 function run_test() {
     30  var successCallbackCalled = false,
     31  errorCallbackCalled = false;
     32 
     33  var watchId = navigator.geolocation.watchPosition(
     34    function(pos) {
     35      check_geolocation(pos);
     36      successCallbackCalled = true;
     37    }, function(_err) {
     38      errorCallbackCalled = true;
     39    }
     40  );
     41 
     42  navigator.geolocation.getCurrentPosition(
     43    function(pos) {
     44      check_geolocation(pos);
     45      SimpleTest.executeSoon(function() {
     46        ok(!successCallbackCalled,
     47        "getCurrentPosition : Success callback should not have been called");
     48 
     49        ok(!errorCallbackCalled,
     50        "getCurrentPosition : Error callback should not have been called");
     51 
     52        SimpleTest.finish();
     53      });
     54    }
     55  );
     56 
     57  navigator.geolocation.clearWatch(watchId);
     58 }
     59 </script>
     60 </pre>
     61 </body>
     62 </html>