fune/testing/web-platform/tests/geolocation-API/support.js
Ikko Ashimine 08a1ac044e Bug 1726702 [wpt PR 30101] - Fix typo in support.js, a=testonly
Automatic update from web-platform-tests
Fix typo in support.js (#30101)

beggining -> beginning
--

wpt-commits: a06af784de93828d0561dd95030ade821a0296a8
wpt-pr: 30101
2021-09-02 10:29:47 +00:00

30 lines
1 KiB
JavaScript

var geo;
setup(function() {
geo = navigator.geolocation;
});
// The spec states that an implementation SHOULD acquire user permission before
// beginning the position acquisition steps. If an implementation follows this
// advice, set the following flag to aid debugging.
var isUsingPreemptivePermission = false;
var dummyFunction = function() {};
var positionToString = function(pos) {
var c = pos.coords;
return '[lat: ' + c.latitude + ', lon: ' + c.longitude + ', acc: ' + c.accuracy + ']';
};
var errorToString = function(err) {
var codeString;
switch(err.code) {
case err.UNKNOWN_ERROR: codeString = 'UNKNOWN_ERROR'; break;
case err.PERMISSION_DENIED: codeString = 'PERMISSION_DENIED'; break;
case err.POSITION_UNAVAILABLE: codeString = 'POSITION_UNAVAILABLE'; break;
case err.TIMEOUT: codeString = 'TIMEOUT'; break;
default: codeString = 'undefined error code'; break;
}
return '[code: ' + codeString + ' (' + err.code + '), message: ' + (err.message ? err.message : '(empty)') + ']';
};