From 0a4fd137aa8a2b4fed14c528d9e5d62470d927df Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Sat, 17 Feb 2024 11:01:27 +0100 Subject: [PATCH] Sensor.timestamp: Account for "get value from latest reading" returning null (#480) 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}