Skip to content

Commit

Permalink
Bug 1585682 [wpt PR 19467] - [sensors] Round off Ambient Light Sensor…
Browse files Browse the repository at this point in the history
… readouts to the nearest 50 Lux., a=testonly

Automatic update from web-platform-tests
[sensors] Round off Ambient Light Sensor readouts to the nearest 50 Lux.

There have been some concerns regarding the precision of readouts from the
Ambient Light Sensor. To decrease the entropy, we are rounding off the
illuminance value to the nearest 50 Lux to mitigate the known attack
vectors as summarized in [1].

[1] w3c/ambient-light#13 (comment)

This CL is based on
https://chromium-review.googlesource.com/c/chromium/src/+/1695412 by
Rijubrata Bhaumik and myself.

Bug: 642731, 606766
Change-Id: I85449bdb835e8486b080fc269938b6c96f000c2a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1834346
Reviewed-by: Reilly Grant <reillygchromium.org>
Reviewed-by: Kentaro Hara <harakenchromium.org>
Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costaintel.com>
Cr-Commit-Position: refs/heads/master{#705486}

--

wpt-commits: b5c2b81b664dbf9fccf7316017ada0878fc10fa1
wpt-pr: 19467

UltraBlame original commit: 36a1b8d7d73706d8223e20f47649db4e8741d20f
  • Loading branch information
marco-c committed Oct 27, 2019
1 parent 9200bc8 commit 79cfdcb
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 0 deletions.
30 changes: 30 additions & 0 deletions testing/web-platform/tests/generic-sensor/generic-sensor-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2061,7 +2061,10 @@ correct
sensor_test
(
async
(
t
sensorProvider
)
=
>
{
Expand Down Expand Up @@ -2104,6 +2107,25 @@ start
(
)
;
const
mockSensor
=
await
sensorProvider
.
getCreatedSensor
(
sensorName
)
;
await
mockSensor
.
setSensorReading
(
readings
)
;
await
sensorWatcher
.
Expand Down Expand Up @@ -3217,6 +3239,14 @@ getCreatedSensor
sensorName
)
;
await
mockSensor
.
setSensorReading
(
readings
)
;
const
fastCounter
=
Expand Down
138 changes: 138 additions & 0 deletions testing/web-platform/tests/resources/chromium/generic_sensor_mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,144 @@ maxFrequency_
)
;
}
/
/
Chromium
applies
some
rounding
and
other
privacy
-
related
measures
that
/
/
can
cause
ALS
not
to
report
a
reading
when
it
has
not
changed
beyond
a
/
/
certain
threshold
compared
to
the
previous
illuminance
value
.
Make
/
/
each
reading
return
a
different
value
that
is
significantly
different
/
/
from
the
previous
one
when
setSensorReading
(
)
is
not
called
by
client
/
/
code
(
e
.
g
.
run_generic_sensor_iframe_tests
(
)
)
.
if
(
type
=
=
device
.
mojom
.
SensorType
.
AMBIENT_LIGHT
)
{
this
.
activeSensors_
.
get
(
type
)
.
setSensorReading
(
[
[
window
.
performance
.
now
(
)
*
100
]
[
(
window
.
performance
.
now
(
)
+
50
)
*
100
]
]
)
;
}
const
initParams
=
Expand Down

0 comments on commit 79cfdcb

Please sign in to comment.