Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General specification maintenance #55

Merged
merged 5 commits into from
Sep 10, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 36 additions & 20 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,22 @@ attribute</a> for the {{change}} event type.
<div algorithm>
The <dfn method for=IdleDetector>requestPermission()</dfn> method steps are:

1. If [=this=]'s [=relevant global object=]'s [=associated Document=] is not
[=fully active=], return [=a promise rejected with=] a
"{{InvalidStateError}}" {{DOMException}}.
<wpt>
idle-detection-detached-frame.https.html
</wpt>
1. If the [=relevant global object=] of [=this=] does not have [=transient
activation=], return [=a promise rejected with=] a "{{NotAllowedError}}"
{{DOMException}}.
1. Let |result| be [=a new promise=].
1. [=In parallel=]:
1. Let |permissionState| be the result of [=requesting permission to use=]
<a permission>"idle-detection"</a>.
1. [=Resolve=] |result| with |permissionState|.
1. [=Queue a global task=] on the [=relevant global object=] of [=this=]
using the [=idle detection task source=] to [=resolve=] |result| with
|permissionState|.
1. Return |result|.

</div>
Expand All @@ -281,15 +289,21 @@ The <dfn method for=IdleDetector>requestPermission()</dfn> method steps are:

The <dfn method for=IdleDetector>start(|options|)</dfn> method steps are:

1. If the [=relevant global object=]'s [=associated Document=] is not [=allowed
to use=] <a permission>"idle-detection"</a>, return [=a promise rejected with=] a
"{{NotAllowedError}}" {{DOMException}}.
1. Let |document| be [=this=]'s [=relevant global object=]'s [=associated
Document=].
1. If |document| is not [=fully active=], return [=a promise rejected with=] a
"{{InvalidStateError}}" {{DOMException}}.
<wpt>
idle-detection-detached-frame.https.html
</wpt>
1. If |document| is not [=allowed to use=] <a permission>"idle-detection"</a>,
return [=a promise rejected with=] a "{{NotAllowedError}}" {{DOMException}}.
<wpt>
idle-detection-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html
idle-detection-allowed-by-feature-policy-attribute.https.sub.html
idle-detection-allowed-by-feature-policy.https.sub.html
idle-detection-default-feature-policy.https.sub.html
idle-detection-disabled-by-feature-policy.https.sub.html
idle-detection-allowed-by-permissions-policy-attribute-redirect-on-load.https.sub.html
idle-detection-allowed-by-permissions-policy-attribute.https.sub.html
idle-detection-allowed-by-permissions-policy.https.sub.html
idle-detection-default-permissions-policy.https.sub.html
idle-detection-disabled-by-permissions-policy.https.sub.html
</wpt>
1. If |this|.{{IdleDetector/[[state]]}} is not `"stopped"`,
return [=a promise rejected with=] an "{{InvalidStateError}}" {{DOMException}}.
Expand Down Expand Up @@ -318,16 +332,17 @@ The <dfn method for=IdleDetector>start(|options|)</dfn> method steps are:
1. [=In parallel=]:
reillyeon marked this conversation as resolved.
Show resolved Hide resolved
1. Let |permissionState| be the [=permission state=] of `"idle-detection"`.
<wpt>idle-permission.tentative.https.window.js</wpt>
1. If |permissionState| is `"denied"`, [=queue a task=] on the
[=idle detection task source=] to perform the following steps:
1. Set |this|.{{IdleDetector/[[state]]}} to `"stopped"`.
1. [=Reject=] |result| with a "{{NotAllowedError}}" {{DOMException}}.
1. Otherwise, [=queue a task=] on the [=idle detection task source=] to perform the
following steps, but [=abort when=] |this|.{{IdleDetector/[[state]]}}
becomes `"stopped"`.
1. Set |this|.{{IdleDetector/[[state]]}} to `"started"`.
1. Set |this|.{{IdleDetector/[[threshold]]}} to |options|["{{threshold}}"].
1. [=Resolve=] |result|.
1. [=Queue a global task=] on the [=relevant global object=] of [=this=]
using the [=idle detection task source=] to perform the following steps:
1. If |permissionState| is `"denied"`,
1. Set |this|.{{IdleDetector/[[state]]}} to `"stopped"`.
1. [=Reject=] |result| with a "{{NotAllowedError}}" {{DOMException}}.
1. Otherwise,
1. If |this|.{{IdleDetector/[[state]]}} is `"stopped"`, abort these
steps.
1. Set |this|.{{IdleDetector/[[state]]}} to `"started"`.
1. Set |this|.{{IdleDetector/[[threshold]]}} to |options|["{{threshold}}"].
1. [=Resolve=] |result|.
1. Return |result|.

</div>
Expand Down Expand Up @@ -442,6 +457,7 @@ conditions:

<wpt>
interceptor.https.html
page-visibility.https.html
</wpt>

# Security and privacy considerations # {#security-and-privacy}
Expand All @@ -453,7 +469,7 @@ conditions:
This interface exposes the state of global system properties and so care must be
taken to prevent them from being used as cross-origin communication or
identification channels. Similar concerns are present in specifications such as
[[DEVICE-ORIENTATION]] and [[GEOLOCATION-API]], which mitigate them by requiring
[[DEVICE-ORIENTATION]] and [[GEOLOCATION]], which mitigate them by requiring
a visible or focused context. This prevents multiple origins from observing the
global state at the same time. These mitigations are unfortunately inappropriate
here because the intent of this specification is precisely to allow a limited
Expand Down
Loading