Skip to content

Commit 60756e1

Browse files
authored
Merge pull request #429 from rakuco/add-privacy-terms-and-enhancements
Declare quantization and threshold check algorithms for extension to the spec
2 parents 9881fa8 + d6f55ec commit 60756e1

File tree

1 file changed

+43
-18
lines changed

1 file changed

+43
-18
lines changed

index.bs

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,20 @@ might also help mitigate certain threats,
512512
thus user agents should not provide
513513
unnecessarily verbose readouts of sensors data.
514514

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+
515529
Note: Inaccuracies will further increase for operations carried out on the
516530
[=sensor readings=], or time deltas calculated from the [=reading timestamp|timestamps=].
517531
So, this mitigation strategy can affect certain use cases.
@@ -711,19 +725,6 @@ define ways to uniquely identify each one.
711725
</pre>
712726
</div>
713727

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-
727728
## Sampling Frequency and Reporting Frequency ## {#concepts-sampling-and-reporting-frequencies}
728729

729730
For the purpose of this specification, <dfn>sampling frequency</dfn> for a [=platform sensor=] is
@@ -739,8 +740,12 @@ can support it.
739740
The [=sampling frequency=] differs from the [=requested sampling frequency=] in the following cases:
740741
- the [=requested sampling frequency=] exceeds upper or lower [=sampling frequency=] bounds
741742
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.
744749

745750
The <dfn>reporting frequency</dfn> for a concrete {{Sensor}} object is defined as a frequency at which
746751
the "reading" event is [=fire an event|fired=] at this object.
@@ -803,11 +808,23 @@ A [=sensor type=] has a [=permission request algorithm=].
803808
A [=sensor type=] has a [=set/is empty|nonempty=] [=ordered set|set=] of associated
804809
[=policy-controlled feature=] tokens referred to as <dfn export>sensor feature names</dfn>.
805810

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+
806820
<h3 id="model-sensor">Sensor</h3>
807821

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=].
811828

812829
Note: User agents can share the [=latest reading=] [=ordered map|map=] and
813830
the [=activated sensor objects=] [=ordered set|set=] between different
@@ -1393,6 +1410,11 @@ to {{SensorErrorEventInit}}.
13931410
: output
13941411
:: None
13951412

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.
13961418
1. [=map/For each=] |key| → <var ignore>value</var> of [=latest reading=].
13971419
1. [=map/Set=] [=latest reading=][|key|] to the corresponding
13981420
value of |reading|.
@@ -1514,6 +1536,9 @@ to {{SensorErrorEventInit}}.
15141536

15151537
1. If |sensor_instance|.{{[[state]]}} is "activated",
15161538
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|.
15171542
1. If the [=extension specification=] defines a [=local coordinate system=] for |sensor_instance|,
15181543
1. Remap (see [[COORDINATES-TRANSFORMATION]]) |readings| values to the
15191544
[=local coordinate system=].

0 commit comments

Comments
 (0)