Conditions:
* Wifi must be disbled.
* I expect this happens on Linux, Mac, or Windows desktop, and also ChromeOS. Confirmed on Mac.
Steps:
1. Go to a site that will use the geolocation watchPosition() API such as https://www.audero.it/demo/geolocation-api-demo.html.
2. Start watching position.
3. Enable a VPN or otherwise change the network configuration and the public IP address.
Expected:
A new network geolocation takes place and a new call to watchPosition() ensues.
Actual:
No new network geolocation takes place.
Root cause:
NetworkLocationProvider only detects changes in public IP address as a side effect of scanning wifi networks. Therefore IP address changes are ignored if Wifi scanning doesn't take place.
Arguably this is a feature request for improved geolocation. But I filed as a bug because the following more elaborate scenario shows a case where it has a pretty weird behavior:
Steps:
1. Go to a site that will use the geolocation watchPosition() API such as https://www.audero.it/demo/geolocation-api-demo.html.
2. Go to another such site (or the same one) in a new window side-by-side.
3. In the first window, open another tab with any site in it. Then switch back to the geolocation tab.
[So two tabs in the first window, one tab in the other, geolocation tab on top in both.]
4. Start watchPosition() in both windows.
5. Enable a VPN or otherwise change the network configuration and the public IP address.
[As above, geolocation will not update.]
6. In the first window, flip between the two tabs.
[No effect at this stage.]
7. Close the second window, leaving only the first window (with two tabs) open.
8. In the first window, flip between the two tabs.
Surprising:
Now that the other window is closed, new network geolocations *do* take place!
This happens because GeolocationImpl is unbound when a tab stops being topmost. But as long as at least one GeolocationImpl is still topmost somewhere, the LocationArbitrator and its NetworkLocationProvider stays alive. By closing the other window and flipping between tabs, we get a fresh NetworkLocationProvider which thus makes a fresh network geolocation request ...
Comment 1 by scheib@chromium.org
, Oct 19 2017