Bug 214566

Summary: [GTK] GeoclueGeolocationProvider uses very low accuracy setting (city) as default geolocation API
Product: WebKit Reporter: Chris McGee <newton688>
Component: WebKitGTKAssignee: Adrian Perez <aperez>
Status: RESOLVED FIXED    
Severity: Normal CC: aperez, bugs-noreply, cgarcia, clopez, pnormand
Priority: P2    
Version: WebKit Nightly Build   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Patch
none
Patch v2 none

Chris McGee
Reported 2020-07-20 12:53:23 PDT
When using the Epiphany browser in Linux with libwebkit2gtk (v2.28.3) and the geoclue2 library with a website like openstreetmap.org or maps.google.com the accuracy is very low at around 25km or "city" level. Geoclue ends up using only IP-based location, which is intended to give a city level of accuracy. According to the source code of Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.cpp geoclue will only be instructed to provide greater accuracy with cell phone tower location, wifi, bluetooth beacons and even GPS if the enableHighAccuracy position option is enabled. Websites like Open Street Map or Google Maps do not use the enableHighAccuracy position options for simple location, which not very useful with only a city level of accuracy. They appear to assume that at least a street level of accuracy could be given without enabling a GPS on the device. The MDN reference on the HTML Geolocation API points out GPS as a differentiating factor for using enableHighAccuracy: https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions/enableHighAccuracy In terms of geoclue, street level accuracy can be achieved without GPS using the presence of nearby cell phone towers, wifi endpoints and bluetooth low energy beacons. But, these require the street level setting. Otherwise, it's just the IP address based lookup. Changing GeoclueGeoLocationProvider.cpp to use GeoclueAccuracySteetLevel (6) as the default could be a more reasonable tradeoff of accuracy for performance and might give a better experience for Linux users.
Attachments
Patch (2.15 KB, patch)
2020-07-27 04:49 PDT, Adrian Perez
no flags
Patch v2 (2.27 KB, patch)
2020-07-27 05:57 PDT, Adrian Perez
no flags
Adrian Perez
Comment 1 2020-07-27 04:49:42 PDT
Carlos Garcia Campos
Comment 2 2020-07-27 05:40:38 PDT
Comment on attachment 405266 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=405266&action=review > Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.cpp:244 > unsigned accuracy = m_isHighAccuracyEnabled ? 8 : 4; You have only changed the comment, I guess this should be: unsigned accuracy = m_isHighAccuracyEnabled ? 8 : 6; no?
Adrian Perez
Comment 3 2020-07-27 05:53:14 PDT
(In reply to Carlos Garcia Campos from comment #2) > Comment on attachment 405266 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=405266&action=review > > > Source/WebKit/UIProcess/geoclue/GeoclueGeolocationProvider.cpp:244 > > unsigned accuracy = m_isHighAccuracyEnabled ? 8 : 4; > > You have only changed the comment, I guess this should be: > > unsigned accuracy = m_isHighAccuracyEnabled ? 8 : 6; > > no? Indeed, I'll post an updated patch 🤦️
Adrian Perez
Comment 4 2020-07-27 05:57:53 PDT
Created attachment 405268 [details] Patch v2
EWS
Comment 5 2020-07-27 08:05:05 PDT
Committed r264920: <https://trac.webkit.org/changeset/264920> All reviewed patches have been landed. Closing bug and clearing flags on attachment 405268 [details].
Note You need to log in before you can comment on or make changes to this bug.