Merge lp:~osomon/oxide/geolocation-doesnt-like-nans into lp:~oxide-developers/oxide/oxide.trunk
Proposed by
Olivier Tilloy
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 770 | ||||
Proposed branch: | lp:~osomon/oxide/geolocation-doesnt-like-nans | ||||
Merge into: | lp:~oxide-developers/oxide/oxide.trunk | ||||
Diff against target: |
113 lines (+32/-5) 4 files modified
qt/core/browser/oxide_qt_location_provider.cc (+21/-5) qt/tests/mock/position/source.cc (+9/-0) qt/tests/mock/position/source.h (+1/-0) qt/tests/qmltests/core/tst_geolocation.qml (+1/-0) |
||||
To merge this branch: | bzr merge lp:~osomon/oxide/geolocation-doesnt-like-nans | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Chris Coulson | Approve | ||
Review via email: mp+235667@code.launchpad.net |
Commit message
Shield ourselves against location sources that return invalid values for attributes (horizontal accuracy, vertical accuracy, speed).
Chromium silently fails to deliver a position update if the horizontal accuracy is NaN.
To post a comment you must log in.
Well done for debugging the problem this far !
On Tue, Sep 23, 2014 at 5:59 PM, Olivier Tilloy <
<email address hidden>> wrote:
> Olivier Tilloy has proposed merging /bugs.launchpad .net/oxide/ +bug/1371166 /code.launchpad .net/~osomon/ oxide/geolocati on-doesnt- like-nans/ +merge/ 235667 /code.launchpad .net/~osomon/ oxide/geolocati on-doesnt- like-nans/ +merge/ 235667 browser/ oxide_qt_ location_ provider. cc' browser/ oxide_qt_ location_ provider. cc 2014-05-06 browser/ oxide_qt_ location_ provider. cc 2014-09-23 qt_location_ provider_ p.h" ute(QGeoPositio nInfo:: HorizontalAccur acy)) { QGeoPositionInf o::HorizontalAc curacy) ; position. accuracy) ) { ute(QGeoPositio nInfo:: VerticalAccurac y)) { altitude_ accuracy = QGeoPositionInf o::VerticalAccu racy); QGeoPositionInf o::VerticalAccu racy); altitude_ accuracy = accuracy; ute(QGeoPositio nInfo:: GroundSpeed) ) { QGeoPositionInf o::GroundSpeed) ; QGeoPositionInf o::GroundSpeed) ; :FromJsTime( info.timestamp( ).toMSecsSinceE poch()) ;
> lp:~osomon/oxide/geolocation-doesnt-like-nans into lp:oxide.
>
> Commit message:
> Shield ourselves against location sources that return invalid values for
> attributes (horizontal accuracy, vertical accuracy, speed).
> Chromium silently fails to deliver a position update if the horizontal
> accuracy is NaN.
>
> Requested reviews:
> Chris Coulson (chrisccoulson)
> Related bugs:
> Bug #1371166 in Oxide: "HERE location does not work in browser, but
> works in osmtouch"
> https:/
>
> For more details, see:
>
> https:/
> --
>
> https:/
> Your team Oxide Developers is subscribed to branch lp:oxide.
>
> === modified file 'qt/core/
> --- qt/core/
> 21:14:38 +0000
> +++ qt/core/
> 15:58:36 +0000
> @@ -19,6 +19,7 @@
> #include "oxide_
>
> #include <cfloat>
> +#include <math.h>
>
> #include <QGeoCoordinate>
> #include <QGeoPositionInfo>
> @@ -43,16 +44,27 @@
> position.altitude = coord.altitude();
> if (info.hasAttrib
> position.accuracy =
> info.attribute(
> + if (isnan(
> + // shield ourselves against invalid data
> + position.accuracy = DBL_MAX;
> + }
> } else {
> // accuracy is mandatory
> position.accuracy = DBL_MAX;
> }
> if (info.hasAttrib
> - position.
> - info.attribute(
> + qreal accuracy = info.attribute(
> + if (!isnan(accuracy)) {
> + // shield ourselves against invalid data
> + position.
> + }
> }
> if (info.hasAttrib
> - position.speed = info.attribute(
> + qreal speed = info.attribute(
> + if (!isnan(speed)) {
> + // shield ourselves against invalid data
> + position.speed = speed;
> + }
> }
> position.timestamp =
> base::Time:
>
>
>