diff --git a/index.html b/index.html index d382d0c..fe31fda 100644 --- a/index.html +++ b/index.html @@ -52,7 +52,6 @@ xref: { profile: "web-platform", specs: [ - "permissions", "permissions-policy", ] } @@ -162,63 +161,6 @@

-
-

- Permissions and user prompts -

-

- The [[PERMISSIONS]] API provides a uniform way for websites to request - permissions from users and query which permissions they have. -

-

- A user agent can deny a wake lock of a - particular wake lock type for a particular {{Document}} by any - implementation-specific reason, such as platform setting or user - preference. -

-

- It is RECOMMENDED that a user agent show some form of unobtrusive - notification that informs the user when a wake lock is active, as well - as provides the user with the means to [=screen wake lock permission - revocation algorithm|block=] the ongoing operation, or simply dismiss - the notification. -

-
-

- The `"screen-wake-lock"` powerful feature -

-

- The `"screen-wake-lock"` powerful feature enables the - capability defined by this specification. -

-
-
-

- Permission algorithms -

-

- The `"screen-wake-lock"` powerful feature defines a [=powerful - feature/permission revocation algorithm=]. To invoke the Screen - Wake Lock permission revocation algorithm, run these steps: -

-
    -
  1. Let |document:Document| be the [=current global object=]'s - [=associated Document=]. -
  2. -
  3. Let |lockList| be - |document|.{{Document/[[ActiveLocks]]}}["`screen`"]. -
  4. -
  5. [=list/For each=] |lock:WakeLockSentinel| in |lockList|: -
      -
    1. Run release a wake lock with |document|, |lock|, and - {{WakeLockType/"screen"}}. -
    2. -
    -
  6. -
-
-

Concepts @@ -309,11 +251,19 @@

The request() method

- The request(|type:WakeLockType|) method steps are: + The `request(|type:WakeLockType|)` method steps are:

  1. Let |document:Document| be [=this=]'s [=relevant global - object=]'s [=associated Document=]. + object=]'s [=associated `Document`=]. +
  2. +
  3. If the |document|'s [=Document/browsing context=] is `null`, + return [=a promise rejected with=] {{"NotAllowedError"}} + {{DOMException}}. +
  4. +
  5. If + |document| is not [=Document/fully active=], return [=a promise + rejected with=] with a {{"NotAllowedError"}} {{DOMException}}.
  6. If |document| is not [=allowed to use=] the [=policy-controlled @@ -325,80 +275,33 @@

    |document|, return [=a promise rejected with=] a {{"NotAllowedError"}} {{DOMException}}.

  7. -
  8. If the |document|'s [=Document/browsing context=] is `null`, - return [=a promise rejected with=] {{"NotAllowedError"}} - {{DOMException}}. -
  9. -
  10. If - |document| is not [=Document/fully active=], return [=a promise - rejected with=] with a {{"NotAllowedError"}} {{DOMException}}. -
  11. If |document|'s [=Document/visibility state=] is "`hidden`", return [=a promise rejected with=] {{"NotAllowedError"}} {{DOMException}}.
  12. Let |promise:Promise| be [=a new promise=].
  13. -
  14. Run the following steps in parallel: +
  15. [=In parallel=]:
      -
    1. Let |state:PermissionState| be the result of requesting - permission to use "`screen-wake-lock`". +
    2. Attempt to [=acquire a wake lock=] of type + {{WakeLockType/"screen"}}. +
    3. -
    4. If |state| is - {{PermissionState/"denied"}}, then: -
        -
      1. - Queue a global task on the screen wake lock task - source given |document|'s relevant global object - to reject |promise| with a {{"NotAllowedError"}} - {{DOMException}}. -
      2. -
      3. Abort these steps. -
      4. -
      +
    5. Let |lock:WakeLockSentinel| be a newly created + {{WakeLockSentinel}} instance with its {{WakeLockSentinel/type}} + attribute set to |type|.
    6. -
    7. - Queue a global task on the screen wake lock task - source given |document|'s relevant global object to - run these steps: -
        -
      1. If |document|'s [=Document/visibility state=] is - "`hidden`", then: -
          -
        1. Reject |promise| with a {{"NotAllowedError"}} - {{DOMException}}. -
        2. -
        3. Abort these steps. -
        4. -
        -
      2. -
      3. If |document|.{{Document/[[ActiveLocks]]}}["`screen`"] - [=list/is empty=], then invoke the following steps in - parallel: -
          -
        1. Invoke acquire a wake lock with - {{WakeLockType/"screen"}}. - -
        2. -
        -
      4. -
      5. Let |lock:WakeLockSentinel| be a new {{WakeLockSentinel}} - object with its {{WakeLockSentinel/type}} attribute set to - |type|. -
      6. -
      7. [=List/Append=] |lock| to - |document|.{{Document/[[ActiveLocks]]}}["`screen`"]. -
      8. -
      9. Resolve |promise| with |lock|. -
      10. -
      +
    8. [=List/Append=] |lock| to + |document|.{{Document/[[ActiveLocks]]}}["`screen`"]. +
    9. +
    10. [=Queue a global task=] to [=resolve=] |promise| with |lock|.
  16. @@ -598,8 +501,8 @@

    MUST treat wake lock acquisition as advisory-only.

    - Conversely, the user agent releases the wake lock by requesting the + Conversely, the user agent can release the wake lock by requesting the underlying operating system to no longer apply the wake lock. The lock is considered released only when the request to the operating system succeeds. @@ -721,20 +624,22 @@

  17. Remove |lock| from |document|.{{Document/[[ActiveLocks]]}}[|type|].
  18. +
  19. [=Queue a task=] on the [=screen wake lock task source=] to: +
      +
    1. Set |lock|'s {{WakeLockSentinel/[[Released]]}} to `true`. +
    2. +
    3. [=Fire an event=] named "`release`" at |lock|. +
    4. +
    +
  20. If |document|.{{Document/[[ActiveLocks]]}}[|type|] [=list/is empty=], then run the following steps in parallel:
      -
    1. Ask the underlying operating system to release the wake lock - of type |type| and let |success:boolean| be `true` if the - operation succeeded, or else `false`. +
    2. Ask the underlying operating system to [=release the wake + lock=].
    3. -
    4. If |success| is `true` and |type| is `"screen"` run the - following: -
        -
      1. Reset the platform-specific inactivity timer after which - the screen is actually turned off. -
      2. -
      +
    5. If the operation succeeds, reset the platform-specific + inactivity timer after which the screen is actually turned off.
  21. -
  22. Set |lock|'s {{WakeLockSentinel/[[Released]]}} to `true`. -
  23. -
  24. - Fire an event named "`release`" at |lock|. -
@@ -777,6 +677,13 @@

application is having a negative energy impact on the device, and allow them to take action if so desired.

+

+ A user agent MAY deny a wake lock of a + particular wake lock type for a particular {{Document}} by any + implementation-specific reason, such as platform setting or user + preference. +