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 @@

No-Vary-Search

-

Draft Community Group Report,

+

Draft Community Group Report,

This version: diff --git a/prefetch.html b/prefetch.html index 27ae3b2..589e7aa 100644 --- a/prefetch.html +++ b/prefetch.html @@ -588,7 +588,7 @@

Prefetch

-

Draft Community Group Report,

+

Draft Community Group Report,

This version: diff --git a/prerendering.html b/prerendering.html index 10f53a3..ee86546 100644 --- a/prerendering.html +++ b/prerendering.html @@ -751,7 +751,7 @@

Prerendering Revamped

-

Draft Community Group Report,

+

Draft Community Group Report,

This version: @@ -814,52 +814,47 @@

Table of Contents

  • 4 The `Supports-Loading-Mode` HTTP response header
  • - 5 Preventing nonsensical behaviors + 5 Preventing intrusive behaviors
      -
    1. 5.1 APIs for creating and navigating browsing contexts by name -
    -
  • - 6 Preventing intrusive behaviors -
      -
    1. 6.1 Downloading resources -
    2. 6.2 User prompts +
    3. 5.1 Downloading resources +
    4. 5.2 User prompts
    5. - 6.3 Delaying async API results + 5.3 Delaying async API results
        -
      1. 6.3.1 The [DelayWhilePrerendering] extended attribute -
      2. 6.3.2 Service Workers -
      3. 6.3.3 BroadcastChannel -
      4. 6.3.4 Geolocation API -
      5. 6.3.5 Web Serial API -
      6. 6.3.6 Notifications API -
      7. 6.3.7 Web MIDI API -
      8. 6.3.8 Idle Detection API -
      9. 6.3.9 Generic Sensor API -
      10. 6.3.10 Web NFC -
      11. 6.3.11 Battery Status API -
      12. 6.3.12 Screen Orientation API -
      13. 6.3.13 Gamepad -
      14. 6.3.14 Encrypted Media Extensions -
      15. 6.3.15 Media Autoplay -
      16. 6.3.16 Media Capture and Streams -
      17. 6.3.17 Web Audio API -
      18. 6.3.18 Audio Output Devices API -
      19. 6.3.19 Push API -
      20. 6.3.20 Background Fetch -
      21. 6.3.21 Storage API -
      22. 6.3.22 WebUSB API -
      23. 6.3.23 Web Bluetooth -
      24. 6.3.24 WebHID API -
      25. 6.3.25 WebXR Device API -
      26. 6.3.26 Credential Management -
      27. 6.3.27 Web Speech API -
      28. 6.3.28 Web Locks API -
      29. 6.3.29 Custom Scheme Handlers +
      30. 5.3.1 The [DelayWhilePrerendering] extended attribute +
      31. 5.3.2 Service Workers +
      32. 5.3.3 BroadcastChannel +
      33. 5.3.4 Geolocation API +
      34. 5.3.5 Web Serial API +
      35. 5.3.6 Notifications API +
      36. 5.3.7 Web MIDI API +
      37. 5.3.8 Idle Detection API +
      38. 5.3.9 Generic Sensor API +
      39. 5.3.10 Web NFC +
      40. 5.3.11 Battery Status API +
      41. 5.3.12 Screen Orientation API +
      42. 5.3.13 Gamepad +
      43. 5.3.14 Encrypted Media Extensions +
      44. 5.3.15 Media Autoplay +
      45. 5.3.16 Media Capture and Streams +
      46. 5.3.17 Web Audio API +
      47. 5.3.18 Audio Output Devices API +
      48. 5.3.19 Push API +
      49. 5.3.20 Background Fetch +
      50. 5.3.21 Storage API +
      51. 5.3.22 WebUSB API +
      52. 5.3.23 Web Bluetooth +
      53. 5.3.24 WebHID API +
      54. 5.3.25 WebXR Device API +
      55. 5.3.26 Credential Management +
      56. 5.3.27 Web Speech API +
      57. 5.3.28 Web Locks API +
      58. 5.3.29 Custom Scheme Handlers
      -
    6. 6.4 Implicitly restricted APIs +
    7. 5.4 Implicitly restricted APIs
    -
  • 7 Security considerations -
  • 8 Privacy considerations +
  • 6 Security considerations +
  • 7 Privacy considerations
  • Index
      @@ -1450,50 +1445,35 @@

      Return a list containing all elements of slmHeader that are tokens.

    -

    5. Preventing nonsensical behaviors

    -

    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.

    -

    5.1. APIs for creating and navigating browsing contexts by name

    -

    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:

    - -

    6. Preventing intrusive behaviors

    -

    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.

    -

    6.1. Downloading resources

    -

    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:

    +

    5. Preventing intrusive behaviors

    +

    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.

    +

    5.1. Downloading resources

    +

    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:

    1. -

      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.

    -

    6.2. User prompts

    +

    5.2. User prompts

    Modify the cannot show simple dialogs algorithm, given a Window window, by prepending the following step:
    1. -

      If window’s navigable is a prerendering navigable, then return true.

      +

      If window’s navigable is a prerendering navigable, then return true.

    Modify the print() method steps by prepending the following step:
    1. -

      If this's navigable is a prerendering navigable, then return.

      +

      If this's navigable is a prerendering navigable, then return.

    -

    6.3. Delaying async API results

    -

    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.

    -

    6.3.1. The [DelayWhilePrerendering] extended attribute

    -

    To 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.

    +

    5.3. Delaying async API results

    +

    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.

    +

    5.3.1. The [DelayWhilePrerendering] extended attribute

    +

    To 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.

    The method steps for any operation annotated with the [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:

    1. Let promise be a new promise, created in realm.

      @@ -1522,24 +1502,24 @@

      Otherwise, return the result of running the originally-specified steps for this operation, with the same this and arguments.

  • -

    6.3.2. Service Workers

    +

    5.3.2. Service Workers

    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.

    -

    6.3.3. BroadcastChannel

    +

    5.3.3. BroadcastChannel

    Add [DelayWhilePrerendering] to postMessage().

    -

    6.3.4. Geolocation API

    +

    5.3.4. Geolocation API

    Modify the getCurrentPosition() method steps by prepending the following step:
    1. -

      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.

    Modify the watchPosition() method steps by prepending the following step:
    1. -

      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:

      1. Let watchId be an implementation-defined unsigned long, and note it as a post-prerendering activation geolocation watch process ID.

        @@ -1552,7 +1532,7 @@

        clearWatch(watchId) method steps by prepending the following step:
        1. -

          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:

          1. 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 @@

    -

    6.3.5. Web Serial API

    +

    5.3.5. Web Serial API

    Add [DelayWhilePrerendering] to requestPort().

    TODO: the below could probably be done by generalizing [DelayWhilePrerendering] to use owner document while in dedicated workers.

    @@ -1572,39 +1552,39 @@

    a promise rejected with a "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.

  • -

    6.3.6. Notifications API

    +

    5.3.6. Notifications API

    Add [DelayWhilePrerendering] to requestPermission().

    Modify the Notification() constructor steps by replacing the step which goes in parallel with the following:
    1. -

      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.

    Modify the permission static getter steps by replacing them with the following:
    1. -

      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.

    2. Otherwise, get the notifications permission state and return it.

    -

    6.3.7. Web MIDI API

    +

    5.3.7. Web MIDI API

    Add [DelayWhilePrerendering] to requestMIDIAccess().

    -

    6.3.8. Idle Detection API

    +

    5.3.8. Idle Detection API

    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.

    -

    6.3.9. Generic Sensor API

    +

    5.3.9. Generic Sensor API

    Modify the start() method steps by inserting the following steps after the state is set to "activating":
    1. -

      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.

    2. 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.

      @@ -1612,24 +1592,24 @@

      Assert: this.[[state]] is "activating".

    -

    6.3.10. Web NFC

    +

    5.3.10. Web NFC

    Add [DelayWhilePrerendering] to write() and scan().

    -

    6.3.11. Battery Status API

    +

    5.3.11. Battery Status API

    Modify the getBattery() method steps by prepending the following step:
    1. -

      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]].

    -

    6.3.12. Screen Orientation API

    +

    5.3.12. Screen Orientation API

    Modify the apply orientation lock algorithm steps by overwriting the first few steps, before it goes in parallel, as follows:
    1. Let promise be a new promise.

    2. -

      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.

    3. If the user agent does not support locking the screen orientation, then reject promise with a "NotSupportedError" DOMException and return promise.

    4. @@ -1640,15 +1620,15 @@

      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.

      -

      6.3.13. Gamepad

      +

      5.3.13. Gamepad

      Modify the getGamepads() method steps by prepending the following step:
      1. -

        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.

      Modify the gamepadconnected section to indicate that every Document document’s post-prerendering activation steps list should gain the following steps:
        @@ -1656,20 +1636,20 @@

        If document is allowed to use the "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.

      -

      6.3.14. Encrypted Media Extensions

      +

      5.3.14. Encrypted Media Extensions

      Add [DelayWhilePrerendering] to requestMediaKeySystemAccess().

      -

      6.3.15. Media Autoplay

      +

      5.3.15. Media Autoplay

      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.

      -

      6.3.16. Media Capture and Streams

      +

      5.3.16. Media Capture and Streams

      Add [DelayWhilePrerendering] to getUserMedia(), getUserMedia() and enumerateDevices().

      Modify the MediaDevices section by prepending the following step to the device change notification steps:
      1. -

        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.

      -

      6.3.17. Web Audio API

      +

      5.3.17. Web Audio API

      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.

      @@ -1689,37 +1669,37 @@

      The 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.

      -

      6.3.18. Audio Output Devices API

      +

      5.3.18. Audio Output Devices API

      Add [DelayWhilePrerendering] to selectAudioOutput().

      -

      6.3.19. Push API

      +

      5.3.19. Push API

      Add [DelayWhilePrerendering] to subscribe().

      -

      6.3.20. Background Fetch

      +

      5.3.20. Background Fetch

      Add [DelayWhilePrerendering] to fetch().

      -

      6.3.21. Storage API

      +

      5.3.21. Storage API

      Add [DelayWhilePrerendering] to persist().

      -

      6.3.22. WebUSB API

      +

      5.3.22. WebUSB API

      Add [DelayWhilePrerendering] to getDevices() and requestDevice().

      -

      6.3.23. Web Bluetooth

      +

      5.3.23. Web Bluetooth

      Add [DelayWhilePrerendering] to getDevices() and requestDevice().

      -

      6.3.24. WebHID API

      +

      5.3.24. WebHID API

      Add [DelayWhilePrerendering] to getDevices() and requestDevice().

      -

      6.3.25. WebXR Device API

      +

      5.3.25. WebXR Device API

      Add [DelayWhilePrerendering] to requestSession().

      -

      6.3.26. Credential Management

      +

      5.3.26. Credential Management

      Add [DelayWhilePrerendering] to get(), store(), and create().

      -

      6.3.27. Web Speech API

      +

      5.3.27. Web Speech API

      Add [DelayWhilePrerendering] to speak(utterance), cancel(), pause(), and resume().

      Add [DelayWhilePrerendering] to start(), stop(), and abort().

      -

      6.3.28. Web Locks API

      +

      5.3.28. Web Locks API

      Add [DelayWhilePrerendering] to request(name, callback), request(name, options, callback), and query().

      -

      6.3.29. Custom Scheme Handlers

      +

      5.3.29. Custom Scheme Handlers

      Modify the registerProtocolHandler(scheme, url) method steps by overwriting the first few steps, before it goes in parallel, as follows:
      1. Let (normalizedScheme, normalizedURLString) be the result of running normalize protocol handler parameters with scheme, url, and this's relevant settings object.

      2. -

        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.

      @@ -1728,11 +1708,11 @@

    -

    6.4. Implicitly restricted APIs

    -

    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:

    +

    5.4. Implicitly restricted APIs

    +

    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:

    -

    7. Security considerations

    +

    6. Security considerations

    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.

    -

    8. Privacy considerations

    +

    7. Privacy considerations

    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 @@

    activationStart, in § 3.3
  • activation start time, in § 1.2
  • credentialed-prerender, in § 4 -
  • [DelayWhilePrerendering], in § 6.3.1 +
  • [DelayWhilePrerendering], in § 5.3.1
  • finalize activation, in § 1.2
  • find a matching complete prerender record, in § 2.1
  • get the supported loading modes, in § 4 @@ -1813,7 +1793,7 @@

    matches a URL, in § 1.2
  • No-Vary-Search hint, in § 1.2
  • onprerenderingchange, in § 1.1 -
  • post-prerendering activation geolocation watch process ID, in § 6.3.4 +
  • post-prerendering activation geolocation watch process ID, in § 5.3.4
  • post-prerendering activation steps list