mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-25 02:40:22 -10:00
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] https://github.com/w3c/ambient-light/issues/13#issuecomment-302393458 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 <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Commit-Queue: Raphael Kubo da Costa <[email protected]> Cr-Commit-Position: refs/heads/master@{#705486} -- wpt-commits: b5c2b81b664dbf9fccf7316017ada0878fc10fa1 wpt-pr: 19467
The resources/generic-sensor-helpers.js tests require an implementation of
the GenericSensorTest interface, which should emulate platform
sensor backends. The GenericSensorTest interface is defined as:
class MockSensor {
// Sets fake data that is used to deliver sensor reading updates.
async setSensorReading(FrozenArray<double> readingData);
setStartShouldFail(boolean shouldFail); // Sets flag that forces sensor to fail.
getSamplingFrequency(); // Return the sampling frequency.
};
class MockSensorProvider {
// Sets flag that forces mock SensorProvider to fail when getSensor() is
// invoked.
setGetSensorShouldFail(DOMString sensorType, boolean shouldFail);
// Sets flag that forces mock SensorProvider to permissions denied when
// getSensor() is invoked.
setPermissionsDenied(DOMString sensorType, boolean permissionsDenied);
getCreatedSensor(DOMString sensorType); // Return `MockSensor` interface.
setMaximumSupportedFrequency(double frequency); // Sets the maximum frequency.
setMinimumSupportedFrequency(double frequency); // Sets the minimum frequency.
}
class GenericSensorTest {
initialize(); // Sets up the testing environment.
async reset(); // Frees the resources.
getSensorProvider(); // Returns `MockSensorProvider` interface.
};
The Chromium implementation of the GenericSensorTest interface is located in
generic_sensor_mocks.js.
Other browser vendors should provide their own implementations of
the GenericSensorTest interface.
Known issue: a WebDriver extension is a better approach for the Generic Sensor tests automation.