Skip to content

Commit 89f10df

Browse files
authored
Use double as attribute type and introduce 'hasReading' attribute (web-platform-tests#7485)
1 parent 238e985 commit 89f10df

File tree

6 files changed

+23
-16
lines changed

6 files changed

+23
-16
lines changed

accelerometer/idlharness.https.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
[SecureContext, Exposed=Window]
2525
interface Sensor : EventTarget {
2626
readonly attribute boolean activated;
27+
readonly attribute boolean hasReading;
2728
readonly attribute DOMHighResTimeStamp? timestamp;
2829
void start();
2930
void stop();
@@ -34,9 +35,9 @@
3435

3536
[Constructor(optional SensorOptions options), Exposed=Window]
3637
interface Accelerometer : Sensor {
37-
readonly attribute unrestricted double? x;
38-
readonly attribute unrestricted double? y;
39-
readonly attribute unrestricted double? z;
38+
readonly attribute double? x;
39+
readonly attribute double? y;
40+
readonly attribute double? z;
4041
};
4142

4243
[Constructor(optional SensorOptions options), Exposed=Window]

ambient-light/idlharness.https.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
[SecureContext, Exposed=Window]
2525
interface Sensor : EventTarget {
2626
readonly attribute boolean activated;
27+
readonly attribute boolean hasReading;
2728
readonly attribute DOMHighResTimeStamp? timestamp;
2829
void start();
2930
void stop();
@@ -34,7 +35,7 @@
3435

3536
[Constructor(optional SensorOptions sensorOptions), Exposed=Window]
3637
interface AmbientLightSensor : Sensor {
37-
readonly attribute unrestricted double? illuminance;
38+
readonly attribute double? illuminance;
3839
};
3940
</script>
4041

generic-sensor/generic-sensor-tests.js

+2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ function runGenericSensorTests(sensorType) {
4040
let sensor = new sensorType();
4141
sensor.onreading = t.step_func_done(() => {
4242
assert_reading_not_null(sensor);
43+
assert_true(sensor.hasReading);
4344
sensor.stop();
4445
assert_reading_null(sensor);
46+
assert_false(sensor.hasReading);
4547
});
4648
sensor.onerror = t.step_func_done(unreached);
4749
sensor.start();

gyroscope/idlharness.https.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
[SecureContext, Exposed=Window]
2525
interface Sensor : EventTarget {
2626
readonly attribute boolean activated;
27+
readonly attribute boolean hasReading;
2728
readonly attribute DOMHighResTimeStamp? timestamp;
2829
void start();
2930
void stop();
@@ -34,9 +35,9 @@
3435

3536
[Constructor(optional SensorOptions sensorOptions), Exposed=Window]
3637
interface Gyroscope : Sensor {
37-
readonly attribute unrestricted double? x;
38-
readonly attribute unrestricted double? y;
39-
readonly attribute unrestricted double? z;
38+
readonly attribute double? x;
39+
readonly attribute double? y;
40+
readonly attribute double? z;
4041
};
4142
</script>
4243

magnetometer/idlharness.https.html

+10-9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
[SecureContext, Exposed=Window]
2525
interface Sensor : EventTarget {
2626
readonly attribute boolean activated;
27+
readonly attribute boolean hasReading;
2728
readonly attribute DOMHighResTimeStamp? timestamp;
2829
void start();
2930
void stop();
@@ -34,19 +35,19 @@
3435

3536
[Constructor(optional SensorOptions sensorOptions), Exposed=Window]
3637
interface Magnetometer : Sensor {
37-
readonly attribute unrestricted double? x;
38-
readonly attribute unrestricted double? y;
39-
readonly attribute unrestricted double? z;
38+
readonly attribute double? x;
39+
readonly attribute double? y;
40+
readonly attribute double? z;
4041
};
4142

4243
[Constructor(optional SensorOptions sensorOptions), Exposed=Window]
4344
interface UncalibratedMagnetometer : Sensor {
44-
readonly attribute unrestricted double? x;
45-
readonly attribute unrestricted double? y;
46-
readonly attribute unrestricted double? z;
47-
readonly attribute unrestricted double? xBias;
48-
readonly attribute unrestricted double? yBias;
49-
readonly attribute unrestricted double? zBias;
45+
readonly attribute double? x;
46+
readonly attribute double? y;
47+
readonly attribute double? z;
48+
readonly attribute double? xBias;
49+
readonly attribute double? yBias;
50+
readonly attribute double? zBias;
5051
};
5152
</script>
5253

orientation-sensor/idlharness.https.html

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
[SecureContext, Exposed=Window]
2525
interface Sensor : EventTarget {
2626
readonly attribute boolean activated;
27+
readonly attribute boolean hasReading;
2728
readonly attribute DOMHighResTimeStamp? timestamp;
2829
void start();
2930
void stop();

0 commit comments

Comments
 (0)