Bug 40148 - Client-based Geolocation does not handle multiple simultaneous requests
Summary: Client-based Geolocation does not handle multiple simultaneous requests
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 40374
  Show dependency treegraph
 
Reported: 2010-06-03 17:01 PDT by Steve Block
Modified: 2010-06-11 01:51 PDT (History)
4 users (show)

See Also:


Attachments
Patch (7.09 KB, patch)
2010-06-04 03:30 PDT, Steve Block
ap: review+
steveblock: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Block 2010-06-03 17:01:41 PDT
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.
Comment 1 Alexey Proskuryakov 2010-06-03 17:06:25 PDT
See also: bug 39908.

I'm told the original design was that one doesn't add an observer multiple times.
Comment 2 Steve Block 2010-06-04 03:30:33 PDT
Created attachment 57861 [details]
Patch
Comment 3 Steve Block 2010-06-04 03:34:22 PDT
> I'm told the original design was that one doesn't add an observer multiple
> times.
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.
Comment 4 Alexey Proskuryakov 2010-06-04 10:30:04 PDT
+        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.
Comment 5 Steve Block 2010-06-04 10:55:47 PDT
> 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.
Sure, filed Bug 40174
Comment 6 Steve Block 2010-06-10 02:30:29 PDT
Sam, could you take a look at this please?
Comment 7 Alexey Proskuryakov 2010-06-10 13:28:15 PDT
Comment on attachment 57861 [details]
Patch

Sam looked at this, and agrees that this is right. Thanks for fixing the problem!
Comment 8 Steve Block 2010-06-11 01:51:25 PDT
Committed r60998: <http://trac.webkit.org/changeset/60998>