diff --git a/index.bs b/index.bs index 8e4a3f2..1e1f1c1 100644 --- a/index.bs +++ b/index.bs @@ -306,20 +306,24 @@ The absolute attribute must re The requestPermission(absolute) method steps are: 1. Let global be the current global object. - 1. If this's relevant global object does not have transient activation, return a promise rejected with a "{{NotAllowedError}}" {{DOMException}}. + 1. Let hasTransientActivation be true if this's relevant global object has transient activation, and false otherwise. 1. Let result be a new promise in this's relevant Realm. 1. Run these steps in parallel: 1. If absolute is true: 1. Let permissions be « "accelerometer", "gyroscope", "magnetometer" ». 1. Otherwise: 1. Let permissions be « "accelerometer", "gyroscope" ». - 1. Let permissionState be "granted". + 1. For each name of permissions: + 1. If name's permission state is "{{PermissionState/prompt}}" and hasTransientActivation is false: + 1. Queue a global task on the device motion and orientation task source given global to reject result with a "{{NotAllowedError}}" {{DOMException}}. + 1. Return. + 1. Let permissionState be "{{PermissionState/granted}}". 1. For each name of permissions: Note: There is no algorithm for requesting multiple permissions at once. However, user agents are encouraged to bundle concurrent requests for different kinds of media into a single user-facing permission prompt. - 1. If the result of requesting permission to use name is "denied": - 1. Set permissionState to "denied". + 1. If the result of requesting permission to use name is not "{{PermissionState/granted}}": + 1. Set permissionState to "{{PermissionState/denied}}". 1. Break 1. Queue a global task on the device motion and orientation task source given global to resolve result with permissionState. 1. Return result. @@ -350,7 +354,7 @@ To fire an orientation event given a event name (a string) 1. Run these steps in parallel: 1. For each permission name in permissions: 1. Let state be the result of getting the current permission state with permission name and environment. - 1. If state is not "granted", return. + 1. If state is not "{{PermissionState/granted}}", return. 1. Queue a global task on the device motion and orientation task source given window to run the following steps: 1. Let z rotation be orientation's representation as intrinsic Tait-Bryan angles Z - X' - Y'' along the Z axis, or null if the implementation cannot provide an angle value. 1. If z rotation is not null, limit z rotation's precision to 0.1 degrees. @@ -529,16 +533,21 @@ The interval attribute must return The requestPermission() method steps are: 1. Let global be the current global object. - 1. If this's relevant global object does not have transient activation, return a promise rejected with a "{{NotAllowedError}}" {{DOMException}}. + 1. Let hasTransientActivation be true if this's relevant global object has transient activation, and false otherwise. 1. Let result be a new promise in this's relevant Realm. 1. Run these steps in parallel: - 1. Let permissionState be "granted". - 1. For each name of « "accelerometer", "gyroscope" »: + 1. Let permissions be « "accelerometer", "gyroscope" ». + 1. For each name of permissions: + 1. If name's permission state is "{{PermissionState/prompt}}" and hasTransientActivation is false: + 1. Queue a global task on the device motion and orientation task source given global to reject result with a "{{NotAllowedError}}" {{DOMException}}. + 1. Return. + 1. Let permissionState be "{{PermissionState/granted}}". + 1. For each name of permissions: Note: There is no algorithm for requesting multiple permissions at once. However, user agents are encouraged to bundle concurrent requests for different kinds of media into a single user-facing permission prompt. - 1. If the result of requesting permission to use name is "denied": - 1. Set permissionState to "denied". + 1. If the result of requesting permission to use name is not "{{PermissionState/granted}}": + 1. Set permissionState to "{{PermissionState/denied}}". 1. Break 1. Queue a global task on the device motion and orientation task source given global to resolve result with permissionState. 1. Return result. @@ -601,7 +610,7 @@ At an implementation-defined interval interval, the user agent 1. Run these steps in parallel: 1. For each permission name in « "accelerometer", "gyroscope" »: 1. Let state be the result of getting the current permission state with permission name and environment. - 1. If state is not "granted", return. + 1. If state is not "{{PermissionState/granted}}", return. 1. Queue a global task on the device motion and orientation task source given window to run the following steps: 1. Fire an event named devicemotion at window, using {{DeviceMotionEvent}}, with the {{DeviceMotionEvent/acceleration}} attribute initialized to acceleration, the {{DeviceMotionEvent/accelerationIncludingGravity}} attribute initialized to accelerationIncludingGravity, the {{DeviceMotionEvent/rotationRate}} attribute initialized to rotationRate, and the {{DeviceMotionEvent/interval}} attribute initialized to interval. @@ -1082,4 +1091,4 @@ This section summarizes substantial changes and notable editorial improvements t - Make security and privacy considerations normative - Add the ondeviceorientationabsolute event handler attribute into the IDL block (was only in prose) - Remove '?' from dictionary members of DeviceMotionEventInit -- Use [Exposed=Window] extended attribute \ No newline at end of file +- Use [Exposed=Window] extended attribute