tor-browser

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

support.js (1034B)


      1 var geo;
      2 
      3 setup(function() {
      4  geo = navigator.geolocation;
      5 });
      6 
      7 // The spec states that an implementation SHOULD acquire user permission before
      8 // beginning the position acquisition steps. If an implementation follows this
      9 // advice, set the following flag to aid debugging.
     10 var isUsingPreemptivePermission = false;
     11 
     12 
     13 var dummyFunction = function() {};
     14 
     15 var positionToString = function(pos) {
     16  var c = pos.coords;
     17  return '[lat: ' + c.latitude + ', lon: ' + c.longitude + ', acc: ' + c.accuracy + ']';
     18 };
     19 
     20 var errorToString = function(err) {
     21  var codeString;
     22  switch(err.code) {
     23    case err.UNKNOWN_ERROR: codeString = 'UNKNOWN_ERROR'; break;
     24    case err.PERMISSION_DENIED: codeString = 'PERMISSION_DENIED'; break;
     25    case err.POSITION_UNAVAILABLE: codeString = 'POSITION_UNAVAILABLE'; break;
     26    case err.TIMEOUT: codeString = 'TIMEOUT'; break;
     27    default: codeString = 'undefined error code'; break;
     28  }
     29  return '[code: ' + codeString + ' (' + err.code + '), message: ' + (err.message ? err.message : '(empty)') + ']';
     30 };