tor-browser

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

test_geolocation_position_unavailable.js (725B)


      1 function successCallback() {
      2  Assert.ok(false);
      3  do_test_finished();
      4 }
      5 
      6 function errorCallback(err) {
      7  // GeolocationPositionError has no interface object, so we can't get constants off that.
      8  Assert.equal(err.POSITION_UNAVAILABLE, err.code);
      9  Assert.equal(2, err.code);
     10  do_test_finished();
     11 }
     12 
     13 function run_test() {
     14  do_test_pending();
     15 
     16  if (Services.appinfo.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
     17    Services.prefs.setBoolPref("geo.provider.network.scan", false);
     18    Services.prefs.setCharPref("geo.provider.network.url", "UrlNotUsedHere:");
     19  }
     20 
     21  var geolocation = Cc["@mozilla.org/geolocation;1"].getService(Ci.nsISupports);
     22  geolocation.getCurrentPosition(successCallback, errorCallback);
     23 }