Bug 130898

Summary: [GTK] Geoclue2 providers won't work after reloading
Product: WebKit Reporter: Mario Sanchez Prada <mario>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: cgarcia, commit-queue
Priority: P2 Keywords: Gtk
Version: 528+ (Nightly build)   
Hardware: All   
OS: Linux   
Attachments:
Description Flags
Patch proposal none

Description Mario Sanchez Prada 2014-03-28 07:00:56 PDT
There is a bug in the code of the Geoclue2 geolocation provider that prevents geolocation from working if you try to reload a page after having started using the geolocation API previously.

Steps to reproduce:

1. Open http://html5demos.com/geo in a geolocation in Minibrowser
2. Allow to know the location when requested through a dialog
3. Wait until it says "Found you!"
4. Reload the page and repeat step 2

Expected outcome:

You should see the found location once again

Actual:

You will see "Failed" instead, because the geolocation provider is trying to use the same client proxy for geoclue2 service, that is no longer available after having called geoclue_client_call_stop() in GeolocarionProviderGeoclue::stopUpdating(), since apparently it can be reused from previous times.
Comment 1 Mario Sanchez Prada 2014-03-28 07:14:53 PDT
Created attachment 228049 [details]
Patch proposal

The fix is quite simple. Please consider reviewing it quickly so we can request integrating it into the stable branch before the next release.

Thanks!
Comment 2 Martin Robinson 2014-03-28 07:34:03 PDT
Comment on attachment 228049 [details]
Patch proposal

View in context: https://bugs.webkit.org/attachment.cgi?id=228049&action=review

> Source/WebCore/platform/geoclue/GeolocationProviderGeoclue2.cpp:76
> -    startGeoclueClient();
> +    geoclue_manager_call_get_client(m_managerProxy.get(), nullptr, reinterpret_cast<GAsyncReadyCallback>(getGeoclueClientCallback), this);

You don't mention in the changelog why you no longer call startGeoclueClient.
Comment 3 Mario Sanchez Prada 2014-03-28 07:46:49 PDT
(In reply to comment #2)
> (From update of attachment 228049 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=228049&action=review
> 
> > Source/WebCore/platform/geoclue/GeolocationProviderGeoclue2.cpp:76
> > -    startGeoclueClient();
> > +    geoclue_manager_call_get_client(m_managerProxy.get(), nullptr, reinterpret_cast<GAsyncReadyCallback>(getGeoclueClientCallback), this);
> 
> You don't mention in the changelog why you no longer call startGeoclueClient.

I no longer call him here because it will be called later on, once the client proxy is created, down in createGeoclueClientProxyCallback().

Not sure whether it's worth mentioning that in the ChangeLog?
Comment 4 Mario Sanchez Prada 2014-03-28 08:05:18 PDT
Comment on attachment 228049 [details]
Patch proposal

Thanks for the review!
Comment 5 WebKit Commit Bot 2014-03-28 08:34:29 PDT
Comment on attachment 228049 [details]
Patch proposal

Clearing flags on attachment: 228049

Committed r166406: <http://trac.webkit.org/changeset/166406>
Comment 6 WebKit Commit Bot 2014-03-28 08:34:32 PDT
All reviewed patches have been landed.  Closing bug.