From 0b6c059be0e2766641d5ab7deebb95844c5f3518 Mon Sep 17 00:00:00 2001 From: Malte Legenhausen Date: Tue, 21 Jun 2016 09:49:26 +0200 Subject: [PATCH 1/2] CB-11462: (all) Make sure Coordinates#speed follows the w3c specification. Speed can have a negative value on iOS devices when the OS is not able to determine the current speed. This is against the w3c specification. Which only allows null and a number value >= 0. See the following links for further informations: * https://dev.w3.org/geo/api/spec-source.html#speed * https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocation_Class/#//apple_ref/occ/instp/CLLocation/speed --- www/Coordinates.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/Coordinates.js b/www/Coordinates.js index 59ee6e2c..b3007643 100644 --- a/www/Coordinates.js +++ b/www/Coordinates.js @@ -54,7 +54,7 @@ const Coordinates = function (lat, lng, alt, acc, head, vel, altacc) { /** * The velocity with which the device is moving at the position. */ - this.speed = vel !== undefined ? vel : null; + this.speed = (typeof vel === 'number' && vel >= 0 ? vel : null); if (this.speed === 0 || this.speed === null) { this.heading = NaN; From e4bd983bb3c883681eaf0d125c3a4b95148e78e7 Mon Sep 17 00:00:00 2001 From: Malte Legenhausen Date: Tue, 21 Jun 2016 09:58:14 +0200 Subject: [PATCH 2/2] CB-11462: (all) Make sure Coordinates#heading follows the w3c specification. Heading (course) can have a negative value on iOS devices when the OS is not able to determine the current heading. This is against the w3c specification. Which only allows null and a number value >= 0 and <= 360. See the following links for further informations: * https://dev.w3.org/geo/api/spec-source.html#heading * https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocation_Class/#//apple_ref/occ/instp/CLLocation/course --- www/Coordinates.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/Coordinates.js b/www/Coordinates.js index b3007643..6ef21662 100644 --- a/www/Coordinates.js +++ b/www/Coordinates.js @@ -50,7 +50,7 @@ const Coordinates = function (lat, lng, alt, acc, head, vel, altacc) { /** * The direction the device is moving at the position. */ - this.heading = head !== undefined ? head : null; + this.heading = (typeof head === 'number' && head >= 0 && head <= 360 ? head : null); /** * The velocity with which the device is moving at the position. */