From 31d34023ba4b31ecc8bd1f6018b807448109132f Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Fri, 16 Feb 2024 14:08:51 +0100 Subject: [PATCH] Sensor.timestamp: Account for "get value from latest reading" returning null This addresses a regression introduced by #469. The current algorithm assumes that "get value from latest reading" never returns null, which is not the case. Return null when it does instead of passing an invalid value to "relative high resolution time". --- index.bs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index bdbe6df..4f81200 100644 --- a/index.bs +++ b/index.bs @@ -1122,9 +1122,10 @@ with the internal slots described in the following table: The {{Sensor/timestamp}} getter steps are: 1. Let |global| be [=this=]'s [=relevant global object=]. - 2. Let |unsafeTimestamp| be the result of invoking [=get value from latest reading=] with + 1. Let |unsafeTimestamp| be the result of invoking [=get value from latest reading=] with [=this=] and "timestamp" as arguments. - 3. Return [=relative high resolution time=] with |unsafeTimestamp| and |global|. + 1. If |unsafeTimestamp| is null, return null. + 1. Otherwise, return [=relative high resolution time=] with |unsafeTimestamp| and |global|. ### Sensor.start() ### {#sensor-start}