tor-browser

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

test_errorcheck.html (1287B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=684722
      5 -->
      6 <head>
      7  <title>Test for ErrorChecking </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=684722">Mozilla Bug 684722</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 
     22 SimpleTest.waitForExplicitFinish();
     23 
     24 resume_geolocationProvider(function() {
     25  force_prompt(true, test1);
     26 });
     27 
     28 function test1() {
     29    send404_geolocationProvider(test2);
     30 }
     31 
     32 function errorCallback(error) {
     33    // GeolocationPositionError has no interface object, so we can't get constants off that.
     34    is(error.code, error.POSITION_UNAVAILABLE,
     35       "Geolocation error handler fired");
     36    is(error.POSITION_UNAVAILABLE, 2,
     37       "Value of POSITION_UNAVAILABLE should be correct");
     38    SimpleTest.finish();
     39 }
     40 
     41 function successCallback(_position) {
     42    test2();
     43 }
     44 
     45 function test2() {
     46  navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
     47 }
     48 </script>
     49 </pre>
     50 </body>
     51 </html>