From 68fa20032b464b93510cc77f883a6729ecbd65d6 Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Fri, 10 Nov 2023 18:36:35 +0100 Subject: [PATCH 1/2] Add Permissions Policy integration This substantive change makes the firing of the events defined in this specification dependent on a few different policy-controlled features: "accelerometer", "gyroscope", and "magnetometer. Both Blink and WebKit already integrate their implementations with the Permissions Policy spec and use the same tokens, although a bit differently: - Both require "accelerometer" and "gyroscope" for the devicemotion event. - Blink requires "accelerometer" and "gyroscope" to provide relative orientation data for the deviceorientation event, and additionally the "magnetometer" feature to fall back to absolute orientation data. WebKit always requires the three tokens for the deviceorientation event. - Blink requires "accelerometer", "gyroscope", and "magnetometer" for the deviceorientationabsolute event, whereas WebKit does not implement this event. We have opted to codify Blink's behavior in the specification, as since relative orientation data does not require a magnetometer sensor, the event should not require the corresponding token either. Fixes #64. --- index.bs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/index.bs b/index.bs index d7ef951..7078970 100644 --- a/index.bs +++ b/index.bs @@ -213,6 +213,24 @@ The rotation rate 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} +============================== + +This specification defines the following policy-controlled features: + + - "accelerometer", whose default allowlist is "self". + - "gyroscope", whose default allowlist is "self". + - "magnetometer", whose default allowlist is "self". + +
+Note: Usage of the policy-controlled features above by this specification is as follows: + + - The deviceorientation event requires the "accelerometer" and "gyroscope" features when providing relative orientation data. For the implementation to fall back to absolute orientation data, the "magnetometer" feature is also used. + - The deviceorientationabsolute event requires the "accelerometer", "gyroscope" and "magnetometer" feature. + - The devicemotion event requires the "accelerometer" and "gyroscope". + +
+ Permissions API integration {#permissions-api-integration} =========================== @@ -331,8 +349,13 @@ Whenever a significant change in orientation occurs, the user agent must 1. If the implementation cannot provide relative orientation or the resulting absolute orientation data is more accurate: 1. Let absolute be true. + 1. Let policies be « "accelerometer", "gyroscope", "magnetometer" ». 1. Otherwise: 1. Let absolute be false. + 1. Let policies be « "accelerometer", "gyroscope" ». + 1. Let document be window's associated Document. + 1. For each policy of policies: + 1. If document is not allowed to use the policy-controlled feature named policy, return. 1. Invoke fire an orientation event with deviceorientation, window, and absolute. @@ -503,6 +526,9 @@ The requestPermission() method steps a
At an implementation-defined interval interval, the user agent must execute the following steps on a navigable's active window window: + 1. Let document be window's associated Document. + 1. For each policy of « "accelerometer", "gyroscope" »: + 1. If document is not allowed to use the policy-controlled feature named policy, return. 1. Let acceleration be null. 1. Let accelerationIncludingGravity be null. 1. Let rotationRate be null. From f87717bc3673876974e18c4fa63cec8fbaaf4fbf Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Tue, 28 Nov 2023 12:07:08 +0100 Subject: [PATCH 2/2] Export definitions here --- index.bs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.bs b/index.bs index 7078970..b41dbd8 100644 --- a/index.bs +++ b/index.bs @@ -218,9 +218,9 @@ Permissions Policy integration {#permissions-policy-integration} This specification defines the following policy-controlled features: - - "accelerometer", whose default allowlist is "self". - - "gyroscope", whose default allowlist is "self". - - "magnetometer", whose default allowlist is "self". + - "accelerometer", whose default allowlist is "self". + - "gyroscope", whose default allowlist is "self". + - "magnetometer", whose default allowlist is "self".
Note: Usage of the policy-controlled features above by this specification is as follows: