Skip to content

Commit 39442a2

Browse files
author
Raphael Kubo da Costa
authored
Check visibility state in algorithms that fire events (#140)
The requirement to only fire events on documents whose visibility state is "visible" was already in the normative Security and Privacy section, but it was not integrated into the algorithms that fire said events. Related to #33.
1 parent 36b567e commit 39442a2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.bs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,13 +373,14 @@ Note: Implementations must take [[#automation]] into account to determine whethe
373373
<div algorithm="deviceorientation firing steps">
374374
Whenever a <a>significant change in orientation</a> occurs, the user agent must execute the following steps on a <a for="/">navigable</a>'s <a for="navigable">active window</a> <var>window</var>:
375375

376+
1. Let <var>document</var> be <var>window</var>'s <a>associated Document</a>.
377+
1. If <var>document</var>'s <a>visibility state</a> is not "<code>visible</code>", return.
376378
1. If the implementation cannot provide <a>relative orientation</a> or the resulting <a>absolute orientation</a> data is more accurate:
377379
1. Let <var>absolute</var> be true.
378380
1. Let <var>policies</var> be « "<a data-lt="accelerometer-feature"><code>accelerometer</code></a>", "<a data-lt="gyroscope-feature"><code>gyroscope</code></a>", "<a data-lt="magnetometer-feature"><code>magnetometer</code></a>" ».
379381
1. Otherwise:
380382
1. Let <var>absolute</var> be false.
381383
1. Let <var>policies</var> be « "<a data-lt="accelerometer-feature"><code>accelerometer</code></a>", "<a data-lt="gyroscope-feature"><code>gyroscope</code></a>" ».
382-
1. Let <var>document</var> be <var>window</var>'s <a>associated Document</a>.
383384
1. <a for="list">For each</a> <var>policy</var> of <var>policies</var>:
384385
1. If <var>document</var> is not <a>allowed to use</a> the <a>policy-controlled feature</a> named <var>policy</var>, return.
385386
1. Invoke <a>fire an orientation event</a> with <a event for="Window"><code>deviceorientation</code></a>, <var>window</var>, and <var>absolute</var>.
@@ -558,6 +559,7 @@ The <dfn method for="DeviceMotionEvent">requestPermission()</dfn> method steps a
558559
At an <a>implementation-defined</a> interval <var>interval</var>, the user agent must execute the following steps on a <a for="/">navigable</a>'s <a for="navigable">active window</a> <var>window</var>:
559560

560561
1. Let <var>document</var> be <var>window</var>'s <a>associated Document</a>.
562+
1. If <var>document</var>'s <a>visibility state</a> is not "<code>visible</code>", return.
561563
1. <a for="list">For each</a> <var>policy</var> of « "<a data-lt="accelerometer-feature"><code>accelerometer</code></a>", "<a data-lt="gyroscope-feature"><code>gyroscope</code></a>" »:
562564
1. If <var>document</var> is not <a>allowed to use</a> the <a>policy-controlled feature</a> named <var>policy</var>, return.
563565
1. Let <var>topLevelTraversable</var> be <var>window</var>'s <a for=Window>navigable</a>'s <a for=navigable>top-level traversable</a>.

0 commit comments

Comments
 (0)