diff --git a/no-vary-search.html b/no-vary-search.html index dc6b748..c1b2e59 100644 --- a/no-vary-search.html +++ b/no-vary-search.html @@ -727,7 +727,7 @@
Supports-Loading-Mode
` HTTP response header
[DelayWhilePrerendering]
extended attribute
- [DelayWhilePrerendering]
extended attribute
+ Some behaviors might make sense in most navigables, but do not make sense in prerendering navigables. This section enumerates specification patches to enforce such restrictions.
-Modify the definition of script-closable to prevent window closing while in a prerendering navigable:
-A navigable is script-closable if either of the following is true:
-it is an auxiliary browsing context that was created by script (as opposed to by an action of the user); or
-- it is a top-level traversable - that is not a prerendering traversable - and whose session history entries's size is 1. -
-Various behaviors are disallowed in prerendering navigables because they would be intrusive to the user, since the prerendered content is not being actively interacted with.
-Modify the download the hyperlink algorithm to ensure that downloads inside prerendering navigable are delayed until activation, by inserting the following before the step which goes in parallel:
+Various behaviors are disallowed in prerendering navigables because they would be intrusive to the user, since the prerendered content is not being actively interacted with.
+Modify the download the hyperlink algorithm to ensure that downloads inside prerendering navigable are delayed until activation, by inserting the following before the step which goes in parallel:
If subject’s node navigable is a prerendering navigable, then append the following step to subject’s post-prerendering activation steps list and return.
+If subject’s node navigable is a prerendering navigable, then append the following step to subject’s post-prerendering activation steps list and return.
Window
window, by prepending the following step:
If window’s navigable is a prerendering navigable, then return true.
+If window’s navigable is a prerendering navigable, then return true.
print()
method steps by prepending the following step:
If this's navigable is a prerendering navigable, then return.
+If this's navigable is a prerendering navigable, then return.
Many specifications need to be patched so that, if a given algorithm invoked in a prerendering navigable, most of its work is deferred until the navigable’s top-level traversable is activated. This is tricky to do uniformly, as many of these specifications do not have great hygeine around using the event loop. Nevertheless, the following sections give our best attempt.
-[DelayWhilePrerendering]
extended attributeTo abstract away some of the boilerplate involved in delaying the action of asynchronous methods until activation, we introduce the [DelayWhilePrerendering]
Web IDL extended attribute. It indicates that when a given method is called in a prerendering navigable, it will immediately return a pending promise and do nothing else. Only upon activation will the usual method steps take place, with their result being used to resolve or reject the previously-returned promise.
Many specifications need to be patched so that, if a given algorithm invoked in a prerendering navigable, most of its work is deferred until the navigable’s top-level traversable is activated. This is tricky to do uniformly, as many of these specifications do not have great hygeine around using the event loop. Nevertheless, the following sections give our best attempt.
+[DelayWhilePrerendering]
extended attributeTo abstract away some of the boilerplate involved in delaying the action of asynchronous methods until activation, we introduce the [DelayWhilePrerendering]
Web IDL extended attribute. It indicates that when a given method is called in a prerendering navigable, it will immediately return a pending promise and do nothing else. Only upon activation will the usual method steps take place, with their result being used to resolve or reject the previously-returned promise.
The [DelayWhilePrerendering]
extended attribute must take no arguments, and must only appear on a regular or static operation whose return type is a promise type or undefined
, and whose exposure set contains only Window
.
[DelayWhilePrerendering]
extended attribute are replaced with the following:
@@ -1503,7 +1483,7 @@ If the operation in question is a regular operation, then set realm to the relevant realm of this.
If realm’s global object's navigable is a prerendering navigable, then:
+If realm’s global object's navigable is a prerendering navigable, then:
Let promise be a new promise, created in realm.
@@ -1522,24 +1502,24 @@Add [DelayWhilePrerendering]
to update()
, unregister()
, register(scriptURL, options)
, postMessage(message, transfer)
, and postMessage(message, options)
.
This allows prerendered page to take advantage of existing service workers, but not have any effect on the state of service worker registrations.
-Add [DelayWhilePrerendering]
to postMessage()
.
getCurrentPosition()
method steps by prepending the following step:
If this's relevant global object's navigable is a prerendering navigable, then append the following steps to this's post-prerendering activation steps list and return.
+If this's relevant global object's navigable is a prerendering navigable, then append the following steps to this's post-prerendering activation steps list and return.
watchPosition()
method steps by prepending the following step:
If this's relevant global object's navigable is a prerendering navigable, then:
+If this's relevant global object's navigable is a prerendering navigable, then:
Let watchId be an implementation-defined unsigned long
, and note it as a post-prerendering activation geolocation watch process ID.
If this's relevant global object's navigable is a prerendering navigable, then:
+If this's relevant global object's navigable is a prerendering navigable, then:
If watchId is a post-prerendering activation geolocation watch process ID, then remove its corresponding steps from this's post-prerendering activation steps list.
@@ -1561,7 +1541,7 @@Add [DelayWhilePrerendering]
to requestPort()
.
TODO: the below could probably be done by generalizing [DelayWhilePrerendering]
to use owner document while in dedicated workers.
SecurityError
" DOMException
.
If document’s node navigable is a prerendering navigable, then append the following steps to document’s post-prerendering activation steps list and return promise.
+If document’s node navigable is a prerendering navigable, then append the following steps to document’s post-prerendering activation steps list and return promise.
Add [DelayWhilePrerendering]
to requestPermission()
.
Notification()
constructor steps by replacing the step which goes in parallel with the following:
If this's relevant global object's navigable is a prerendering navigable, then append these steps to this's post-prerendering activation steps list. Otherwise, run these steps in parallel.
+If this's relevant global object's navigable is a prerendering navigable, then append these steps to this's post-prerendering activation steps list. Otherwise, run these steps in parallel.
permission
static getter steps by replacing them with the following:
If the current global object's navigable is a prerendering navigable, then return "default
".
This allows implementations to avoid looking up the actual permission state, which might not be synchronously accessible especially in the case of prerendering navigables. Web developers can then call Notification.requestPermission()
, which per the above modifications will only actually do anything after activation. At that time we might discover that the permission is "granted
" or "denied
", so the browser might not actually ask the user like would normally be the case with "default
". But that’s OK: it’s not observable to web developer code.
If the current global object's navigable is a prerendering navigable, then return "default
".
This allows implementations to avoid looking up the actual permission state, which might not be synchronously accessible especially in the case of prerendering navigables. Web developers can then call Notification.requestPermission()
, which per the above modifications will only actually do anything after activation. At that time we might discover that the permission is "granted
" or "denied
", so the browser might not actually ask the user like would normally be the case with "default
". But that’s OK: it’s not observable to web developer code.
Otherwise, get the notifications permission state and return it.
Add [DelayWhilePrerendering]
to requestMIDIAccess()
.
Add [DelayWhilePrerendering]
to start()
.
The other interesting method, IdleDetector.requestPermission()
, is gated on transient activation. However, even if permission was previously granted for the origin in question, we delay starting any idle detectors while prerendering.
start()
method steps by inserting the following steps after the state is set to "activating
":
If this's relevant global object's navigable is a prerendering navigable, then append the following steps to this's post-prerendering activation steps list and return.
+If this's relevant global object's navigable is a prerendering navigable, then append the following steps to this's post-prerendering activation steps list and return.
If this.[[state]]
is "idle
", then return.
This ensures that if this portion of the algorithm was delayed due to prerendering, and in the meantime stop()
was called, we do nothing upon activating the prerender.
[[state]]
is "activating
".
Add [DelayWhilePrerendering]
to write()
and scan()
.
getBattery()
method steps by prepending the following step:
If this's relevant global object's navigable is a prerendering navigable, then append the following steps to this's post-prerendering activation steps list and return this.[[BatteryPromise]].
+If this's relevant global object's navigable is a prerendering navigable, then append the following steps to this's post-prerendering activation steps list and return this.[[BatteryPromise]].
Let promise be a new promise.
If this's relevant global object's navigable is a prerendering navigable, then append the following steps to this's post-prerendering activation steps list and return promise.
+If this's relevant global object's navigable is a prerendering navigable, then append the following steps to this's post-prerendering activation steps list and return promise.
If the user agent does not support locking the screen orientation, then reject promise with a "NotSupportedError
" DOMException
and return promise.
Add [DelayWhilePrerendering]
to unlock()
.
This latter modification is necessary to ensure that code that calls screen.orientation.lock()
followed by screen.orientation.unlock()
produces the expected results.
getGamepads()
method steps by prepending the following step:
If this's relevant global object's navigable is a prerendering navigable, then return an empty sequence.
+If this's relevant global object's navigable is a prerendering navigable, then return an empty sequence.
Modify the discussion of the gamepadconnected
and gamepaddisconnected
events to specify that the user agent must not dispatch these events if the Window
object’s navigable is a prerendering navigable.
Modify the discussion of the gamepadconnected
and gamepaddisconnected
events to specify that the user agent must not dispatch these events if the Window
object’s navigable is a prerendering navigable.
gamepadconnected
section to indicate that every Document
document’s post-prerendering activation steps list should gain the following steps:
gamepad
" feature, and document’s relevant settings object is a secure context, and any gamepads are connected, then for each connected gamepad, fire an event named gamepadconnected
at document’s relevant global object using GamepadEvent
, with its gamepad
attribute initialized to a new Gamepad
object representing the connected gamepad.
Add [DelayWhilePrerendering]
to requestMediaKeySystemAccess()
.
Modify the playing the media resource section to indicate that the the current playback position of a HTMLMediaElement
must increase monotonically only when the Document
is not prerendering
.
Add [DelayWhilePrerendering]
to getUserMedia()
, getUserMedia()
and enumerateDevices()
.
MediaDevices
section by prepending the following step to the device change notification steps:
If this's relevant global object's navigable is a prerendering navigable, then return.
+If this's relevant global object's navigable is a prerendering navigable, then return.
The concept, allowed to start, is used in the spec, but details are left implementation-defined.
To restrict auto playback while prerendering, add the following rule in the AudioContext
interface section.
The AudioContext
is never allowed to start while prerendering.
AudioScheduledSourceNode
interface has a start(when)
method and the AudioBufferSourceNode
interface has a start(when, offset, duration)
method that might affect [[control thread state]].
But they don’t as the context is not allowed to start and it prevents the algorithm from setting the [[control thread state]].
This would not matter because the node can automatically start when the context starts.
- Add [DelayWhilePrerendering]
to selectAudioOutput()
.
Add [DelayWhilePrerendering]
to subscribe()
.
Add [DelayWhilePrerendering]
to fetch()
.
Add [DelayWhilePrerendering]
to persist()
.
Add [DelayWhilePrerendering]
to getDevices()
and requestDevice()
.
Add [DelayWhilePrerendering]
to getDevices()
and requestDevice()
.
Add [DelayWhilePrerendering]
to getDevices()
and requestDevice()
.
Add [DelayWhilePrerendering]
to requestSession()
.
Add [DelayWhilePrerendering]
to get()
, store()
, and create()
.
Add [DelayWhilePrerendering]
to speak(utterance)
, cancel()
, pause()
, and resume()
.
Add [DelayWhilePrerendering]
to start()
, stop()
, and abort()
.
Add [DelayWhilePrerendering]
to request(name, callback)
, request(name, options, callback)
, and query()
.
registerProtocolHandler(scheme, url)
method steps by overwriting the first few steps, before it goes in parallel, as follows:
Let (normalizedScheme, normalizedURLString) be the result of running normalize protocol handler parameters with scheme, url, and this's relevant settings object.
If this's relevant global object's navigable is a prerendering navigable, then append the following steps to this's post-prerendering activation steps list and return.
+If this's relevant global object's navigable is a prerendering navigable, then append the following steps to this's post-prerendering activation steps list and return.
If this's relevant global object's navigable is a prerendering navigable, then append the following steps to this's post-prerendering activation steps list and return.
+If this's relevant global object's navigable is a prerendering navigable, then append the following steps to this's post-prerendering activation steps list and return.
Some APIs do not need modifications because they will automatically fail or no-op without a property that a prerendering navigable, its active window, or its active document will never have. These properties include:
+Some APIs do not need modifications because they will automatically fail or no-op without a property that a prerendering navigable, its active window, or its active document will never have. These properties include:
transient activation or sticky activation
@@ -1787,11 +1767,11 @@Request Picture-in-Picture as invoked due to video.requestPictureInPicture()
requires either transient activation, or the visibility state to have been "visible
". [PICTURE-IN-PICTURE]
See Security considerations (Speculation Rules).
For the integration of this spec with No-Vary-Search, see No-Vary-Search Security considerations.
Add security considerations that are specific to prerendering. See issue #319.
-See Privacy considerations (Speculation Rules).
For the integration of this spec with No-Vary-Search, see No-Vary-Search Privacy considerations.
Add privacy considerations that are specific to prerendering. See issue #319.
@@ -1804,7 +1784,7 @@