Skip to content

Commit

Permalink
Editorial: rewrite permissions section
Browse files Browse the repository at this point in the history
The permission sections was confusing features and permissions.

APIs can be classified into powerful features, but only the permissions matter.
  • Loading branch information
marcoscaceres committed May 2, 2024
1 parent 37c29da commit fedd55e
Showing 1 changed file with 9 additions and 32 deletions.
41 changes: 9 additions & 32 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -227,48 +227,25 @@ The <dfn>rotation rate</dfn> measures the rate at which the device rotates about

Note: [[MOTION-SENSORS]] and [[GYROSCOPE]] both contain a more detailed discussion of gyroscopes, rotation rates and measurements.

Permissions Policy integration {#permissions-policy-integration}
Permissions {#permissions-integration}
==============================

<div class="issue">
This integration is [=at risk=] due to a lack of test coverage in Web Platform Tests.
</div>

This specification defines the following <a>policy-controlled features</a>:
This specification is classified as a [=powerful feature=] and, as such, it defines the following [=permissions=] and [=default allowlists=]:

- "<code><dfn export data-lt="accelerometer-feature">accelerometer</dfn></code>", whose <a>default allowlist</a> is "<code>self</code>".
- "<code><dfn export data-lt="gyroscope-feature">gyroscope</dfn></code>", whose <a>default allowlist</a> is "<code>self</code>".
- "<code><dfn export data-lt="magnetometer-feature">magnetometer</dfn></code>", whose <a>default allowlist</a> is "<code>self</code>".
- <dfn permission export>"accelerometer"</dfn>, whose [=default allowlist=] is [=default allowlist/'self'=].
- <dfn permission export>"gyroscope"</dfn>, whose [=default allowlist=] is [=default allowlist/'self'=].
- <dfn permission export>"magnetometer"</dfn>, whose [=default allowlist=] is [=default allowlist/'self'=].

<div class="note">
<span class="marker">Note:</span> Usage of the <a>policy-controlled features</a> above by this specification is as follows:

- The <a event for="Window"><code>deviceorientation</code></a> event requires the "<a data-lt="accelerometer-feature"><code>accelerometer</code></a>" and "<a data-lt="gyroscope-feature"><code>gyroscope</code></a>" features when providing <a>relative orientation</a> data. For the implementation to fall back to <a>absolute orientation</a> data, the "<a data-lt="magnetometer-feature"><code>magnetometer</code></a>" feature is also used.
- The <a event for="Window"><code>deviceorientationabsolute</code></a> event requires the "<a data-lt="accelerometer-feature"><code>accelerometer</code></a>", "<a data-lt="gyroscope-feature"><code>gyroscope</code></a>" and "<a data-lt="magnetometer-feature"><code>magnetometer</code></a>" features.
- The <a event for="Window"><code>devicemotion</code></a> event requires the "<a data-lt="accelerometer-feature"><code>accelerometer</code></a>" and "<a data-lt="gyroscope-feature"><code>gyroscope</code></a>" features.

</div>

Permissions API integration {#permissions-api-integration}
===========================

<div class="issue">
This integration is [=at risk=] due to the low pass rate of the <a href="https://wpt.fyi/results/orientation-event/motion/requestPermission.https.window.html"><code>DeviceMotionEvent.requestPermission()</code></a> and <a href="https://wpt.fyi/results/orientation-event/orientation/requestPermission.https.window.html"><code>DeviceOrientationEvent.requestPermission()</code></a> tests.
</div>

This specification defines the following <a>default powerful features</a>:

* "<dfn permission export><code>accelerometer</code></dfn>"
* "<dfn permission export><code>gyroscope</code></dfn>"
* "<dfn permission export><code>magnetometer</code></dfn>"

<div class="note">
<span class="marker">Note:</span> Usage of the <a>powerful features</a> above by this specification is as follows:

- The <a event for="Window"><code>deviceorientation</code></a> event requires "<a permission><code>accelerometer</code></a>" and "<a permission><code>gyroscope</code></a>" when providing <a>relative orientation</a> data. For the implementation to fall back to <a>absolute orientation</a> data, "<a permission><code>magnetometer</code></a>" is also required.
- The <a event for="Window"><code>deviceorientationabsolute</code></a> event requires "<a permission><code>accelerometer</code></a>", "<a permission><code>gyroscope</code></a>" and "<a permission><code>magnetometer</code></a>".
- The <a event for="Window"><code>devicemotion</code></a> event requires "<a permission><code>accelerometer</code></a>" and "<a permission><code>gyroscope</code></a>".
<span class="marker">Note:</span> Which events get [=dispatched=] depends on which [=permissions=] have been [=permission/granted=]:

- When providing <a>relative orientation</a> data, the <a event for="Window">deviceorientation</a> events are only [=dispatch=] if the "<a permission>accelerometer</a>", <a permission>"gyroscope"</a> are [=permission/granted=]. For the implementation to fall back to <a>absolute orientation</a> data, "<a permission>magnetometer</a>" needs to also be [=permission/granted=].
- The <a event for="Window">deviceorientationabsolute</a> events are only [=dispatch=] if the "<a permission>accelerometer</a>", <a permission>"gyroscope"</a>, and "<a permission>magnetometer</a>" are [=permission/granted=].
- The <a event for="Window">devicemotion</a> events are only [=dispatch=] if the "<a permission>accelerometer</a>" and <a permission>"gyroscope"</a> are [=permission/granted=].
</div>

Task Source {#taks-source}
Expand Down

0 comments on commit fedd55e

Please sign in to comment.