File tree Expand file tree Collapse file tree 2 files changed +8
-17
lines changed Expand file tree Collapse file tree 2 files changed +8
-17
lines changed Original file line number Diff line number Diff line change 44< script src ="/resources/testharnessreport.js "> </ script >
55< script src ="/resources/testdriver.js?feature=bidi "> </ script >
66< script src ="/resources/testdriver-vendor.js "> </ script >
7- < script src ="support.js "> </ script >
87
98< script >
109 promise_setup ( async ( ) => {
2827 coordinates : { latitude, longitude, accuracy}
2928 } ) ;
3029
31- const position = await getCurrentGeolocation ( ) ;
30+ const positionPromise = new Promise (
31+ ( resolve , reject ) =>
32+ window . navigator . geolocation . getCurrentPosition (
33+ position => resolve ( position . coords . toJSON ( ) ) ,
34+ error => reject ( error ) ,
35+ { timeout : 200 }
36+ ) )
37+ const position = await positionPromise ;
3238
3339 assert_equals ( position . latitude , latitude ) ;
3440 assert_equals ( position . longitude , longitude ) ;
Original file line number Diff line number Diff line change @@ -28,18 +28,3 @@ var errorToString = function(err) {
2828 }
2929 return '[code: ' + codeString + ' (' + err . code + '), message: ' + ( err . message ? err . message : '(empty)' ) + ']' ;
3030} ;
31-
32- /**
33- * Returns the current geolocation or throws error.
34- *
35- * @param {number } timeout - Timeout in milliseconds, default is 200ms.
36- */
37- function getCurrentGeolocation ( timeout = 200 ) {
38- return new Promise (
39- ( resolve , reject ) => window . navigator . geolocation . getCurrentPosition (
40- position => resolve ( position . coords . toJSON ( ) ) ,
41- error => reject ( error ) ,
42- // Fail fast if geolocation is not available.
43- { timeout}
44- ) )
45- }
You can’t perform that action at this time.
0 commit comments