Client-based Geolocation does not handle multiple simultaneous requests to Geolocation methods on a single Geolocation object.
For client-based Geolocation, Geolocation::startUpdating() adds an observer to the GeolocationController for each new method call. However, the GeolocationController asserts that the same observer is not added twice.
Instead, we should allow the same observer to be added multiple times. There's no need to keep track of the number of times a given observer is added as Geolocation::stopUpdating(), which removes the observer, is only called when all requests in the Geolocation object are complete.
See also: bug 39908.
I'm told the original design was that one doesn't add an observer multiple times.
Created attachment 57861 [details]
> I'm told the original design was that one doesn't add an observer multiple
No, the original Geolocation implementation by Greg uses multiple calls to startUpdating(). This is required so that the options for each request can be passed to the provider. When client-based Geolocation was added, each call to startUpdating() adds the observer to the controller.
Note that this change fixes reentrant-error.html reentrant-success.html (see Bug
39908) so my patch removes these from the mac skipped list.
maximum-age.html is still broken, due to more serious problems with the client-based implementation. Once this change lands, I'll update Bug 39908 to reflect this.
+ on the mac skipped list. reentrant-error.html required a minor tweak as the mac
+ GeolocationController can only provide an error code of 2 (POSITION_UNAVAILABLE)
Maybe it would be useful to also have a test for reentrant "permission denied" error, since that uses a different code path, at least with client-based Geolocation.
The patch looks good to me, but it ideally, Sam should review it, since it touches one of the assumptions that were believed true when writing client based geolocation code.
> Maybe it would be useful to also have a test for reentrant "permission denied"
> error, since that uses a different code path, at least with client-based
Sure, filed Bug 40174
Sam, could you take a look at this please?
Comment on attachment 57861 [details]
Sam looked at this, and agrees that this is right. Thanks for fixing the problem!
Committed r60998: <http://trac.webkit.org/changeset/60998>