4

On my Chrome browser (66.0.3359.181 on win 7 64 bits), if I call a geolocation with a timeout, Chrome asks for permission and sends a PositionError "Timeout expired" after the timeout even if I didn't reply for the permission, whereas the W3C specification says :

Note that the time that is spent obtaining the user permission is not included in the period covered by the timeout attribute. The timeout attribute only applies to the location acquisition operation.

Firefox 60 works respectfully with the W3C and does not throw an Error as long as the user gives or reject permission.

Demo : https://codepen.io/benjamin-chevillon/full/GxPwEp/

navigator.geolocation.getCurrentPosition(
successCallback,     errorCallback, 
{enableHighAccuracy: false, timeout:10000, maximumAge: 1000*60*3});

In the codePen :

  • When I click on "Strategie 2: getCurrentPosition {enableHighAccuracy: false, timeout:10000, maximumAge: 1000*60*3}" and I DON'T reply to the permission pop-up and I wait for 10 secondes
  • Expected : nothing should happen
  • Observed :
    • On Chrome: I see the error displayed : error {... "code":3,"message":"Timeout expired"}
    • On Firefox: nothing happen

I think it is pretty new, because I don't remember Chrome acted like this when I created this codepen.

Does anybody know why Chrome acts like this ? Is it a bug ?

BenC
  • 1,468
  • 16
  • 23

0 Answers0