@@ -512,6 +512,20 @@ might also help mitigate certain threats,
512
512
thus user agents should not provide
513
513
unnecessarily verbose readouts of sensors data.
514
514
515
+ Implementations of concrete sensors may define a [=threshold check algorithm=]
516
+ so that new readings that do not differ enough from the [=latest readings=] are
517
+ discarded.
518
+
519
+ Implementations of concrete sensors may define a [=reading quantization
520
+ algorithm=] to reduce the accuracy of the [=sensor readings=] received from a
521
+ [=device sensor=] .
522
+
523
+ Note: these two mitigation measures often complement each other. An
524
+ implementation that only executes the [=threshold check algorithm=] might
525
+ expose readings that are too precise, while an implementation that only rounds
526
+ readings up may provide attackers with information about more precise readings
527
+ when raw readings are rounded to different values.
528
+
515
529
Note: Inaccuracies will further increase for operations carried out on the
516
530
[=sensor readings=] , or time deltas calculated from the [=reading timestamp|timestamps=] .
517
531
So, this mitigation strategy can affect certain use cases.
@@ -711,19 +725,6 @@ define ways to uniquely identify each one.
711
725
</pre>
712
726
</div>
713
727
714
- ## Reading change threshold ## {#concepts-reading-change-threshold}
715
-
716
- A [=platform sensor=] reports [=sensor readings|readings=] to the user agent considering
717
- the [=reading change threshold=] .
718
-
719
- The <dfn>reading change threshold</dfn> refers to a value which indicates whether or
720
- not the changes in the [=device sensor=] 's measurements were significant enough to
721
- update the corresponding [=sensor readings=] .
722
-
723
- The [=reading change threshold|threshold=] value depends on the surrounding software and hardware
724
- environment constraints, e.g., software power consumption optimizations or the underlying
725
- [=device sensor=] 's accuracy.
726
-
727
728
## Sampling Frequency and Reporting Frequency ## {#concepts-sampling-and-reporting-frequencies}
728
729
729
730
For the purpose of this specification, <dfn>sampling frequency</dfn> for a [=platform sensor=] is
@@ -739,8 +740,12 @@ can support it.
739
740
The [=sampling frequency=] differs from the [=requested sampling frequency=] in the following cases:
740
741
- the [=requested sampling frequency=] exceeds upper or lower [=sampling frequency=] bounds
741
742
supported by the underlying platform.
742
- - the [=reading change threshold|threshold=] value is significant so that some of the
743
- [=device sensor=] 's measurements are skipped and the [=sensor readings=] are not updated.
743
+ - the operating system and/or the [=device sensor=] automatically discard
744
+ readings that do not differ enough (in absolute or relative terms) from the
745
+ previously reported ones via a hardware or operating system filter.
746
+ - the [=platform sensor=] 's associated [=sensor type=]' s [=threshold check
747
+ algorithm=] fails and the [=platform sensor=] 's [=latest readings=] are not
748
+ updated.
744
749
745
750
The <dfn>reporting frequency</dfn> for a concrete {{Sensor}} object is defined as a frequency at which
746
751
the "reading" event is [=fire an event|fired=] at this object.
@@ -803,11 +808,23 @@ A [=sensor type=] has a [=permission request algorithm=].
803
808
A [=sensor type=] has a [=set/is empty|nonempty=] [=ordered set|set=] of associated
804
809
[=policy-controlled feature=] tokens referred to as <dfn export>sensor feature names</dfn> .
805
810
811
+ A [=sensor type=] may have an associated <dfn export>threshold check
812
+ algorithm</dfn> , which takes as arguments two separate [=sensor readings=] and
813
+ determines if they differ enough to cause a [=platform sensor=] 's [=latest
814
+ reading=] map to be updated.
815
+
816
+ A [=sensor type=] may have an associated <dfn export>reading quantization
817
+ algorithm</dfn> , which takes a [=sensor reading=] and returns a less accurate
818
+ [=sensor reading=] .
819
+
806
820
<h3 id="model-sensor">Sensor</h3>
807
821
808
- The current [=browsing context=] 's [=platform sensor=] has an associated [=ordered set|set=]
809
- of <dfn>activated sensor objects</dfn> , which is initially [=set/is empty|empty=] and an
810
- associated <dfn>latest reading</dfn> [=ordered map|map=] , which holds the latest available [=sensor readings=] .
822
+ The current [=browsing context=] 's [=platform sensor=] must have:
823
+ - An associated [=ordered set|set=] of <dfn>activated sensor objects</dfn> ,
824
+ which is initially [=set/is empty|empty=] ;
825
+ - An associated <dfn>latest reading</dfn> [=ordered map|map=] , which holds the
826
+ latest available [=sensor readings=] .
827
+ - An associated [=sensor type=] .
811
828
812
829
Note: User agents can share the [=latest reading=] [=ordered map|map=] and
813
830
the [=activated sensor objects=] [=ordered set|set=] between different
@@ -1393,6 +1410,11 @@ to {{SensorErrorEventInit}}.
1393
1410
: output
1394
1411
:: None
1395
1412
1413
+ 1. Let |type| be |sensor|'s associated [=sensor type=] .
1414
+ 1. If |type|'s [=threshold check algorithm=] is defined, then:
1415
+ 1. Let |result| be the result of invoking |type|'s [=threshold check algorithm=]
1416
+ with |reading| and |latest reading|.
1417
+ 1. If |result| is false, then abort these steps.
1396
1418
1. [=map/For each=] |key| → <var ignore> value</var> of [=latest reading=] .
1397
1419
1. [=map/Set=] [=latest reading=] [|key|] to the corresponding
1398
1420
value of |reading|.
@@ -1514,6 +1536,9 @@ to {{SensorErrorEventInit}}.
1514
1536
1515
1537
1. If |sensor_instance|.{{[[state]]}} is "activated",
1516
1538
1. Let |readings| be the [=latest reading=] of |sensor_instance|'s related [=platform sensor=] .
1539
+ 1. Let |type| be |sensor_instance|'s associated [=platform sensor=]' s associated [=sensor type=] .
1540
+ 1. If |type|'s [=reading quantization algorithm=] is defined, then:
1541
+ 1. Set |readings| to the result of invoking |type|'s [=reading quantization algorithm=] with |readings|.
1517
1542
1. If the [=extension specification=] defines a [=local coordinate system=] for |sensor_instance|,
1518
1543
1. Remap (see [[COORDINATES-TRANSFORMATION]] ) |readings| values to the
1519
1544
[=local coordinate system=] .
0 commit comments