From 0ab9cc060d108b47500949e4f9645db7315792b1 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Tue, 6 Sep 2022 12:41:16 +0300 Subject: [PATCH 01/10] Accept header for prefetch --- fetch.bs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fetch.bs b/fetch.bs index 75bcc7146..c91ce16c1 100644 --- a/fetch.bs +++ b/fetch.bs @@ -4189,6 +4189,12 @@ the request.
  1. Let value be `*/*`. +

  2. Let documentAccept be + `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8`. + +

  3. If request's initiator is "prefetch", then set + value to documentAccept. +

  4. A user agent should set value to the first matching statement, if any, switching on request's destination: @@ -4198,7 +4204,7 @@ the request.

    "document"
    "frame"
    "iframe" -
    `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8` +
    documentAccept
    "image"
    `image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5` From b15a255465bb5481f028f463195dd3738f281c91 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Wed, 7 Sep 2022 07:52:17 +0300 Subject: [PATCH 02/10] Move document Accept to constant --- fetch.bs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fetch.bs b/fetch.bs index c91ce16c1..efaaed891 100644 --- a/fetch.bs +++ b/fetch.bs @@ -2571,6 +2571,9 @@ manually. [[!HTML]]
  5. Return potentialDestination.

+

The Document `Accept` header value is +`text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8`. +

Authentication entries

@@ -4189,11 +4192,9 @@ the request.
  1. Let value be `*/*`. -

  2. Let documentAccept be - `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8`.

  3. If request's initiator is "prefetch", then set - value to documentAccept. + value to document `Accept` header value.

  4. A user agent should set value to the first matching statement, if any, switching @@ -4204,7 +4205,7 @@ the request.

    "document"
    "frame"
    "iframe" -
    documentAccept +
    document `Accept` header value
    "image"
    `image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5` From 4fd1997c4d04173884b4d0f510d917a20758987d Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Tue, 27 Sep 2022 12:59:22 +0300 Subject: [PATCH 03/10] nit --- fetch.bs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fetch.bs b/fetch.bs index efaaed891..051169e2a 100644 --- a/fetch.bs +++ b/fetch.bs @@ -1296,6 +1296,8 @@ downloads. This format of range header value can be set using add a range hea implementation-defined header value for the `User-Agent` header. +

    The Document `Accept` header value is +`text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8`.

    Statuses

    @@ -2571,9 +2573,6 @@ manually. [[!HTML]]
  5. Return potentialDestination.

-

The Document `Accept` header value is -`text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8`. -

Authentication entries

@@ -4194,18 +4193,18 @@ the request.
  • If request's initiator is "prefetch", then set - value to document `Accept` header value. + value to document `Accept` header value.

  • -

    A user agent should set value to the first matching statement, if any, switching - on request's destination: +

    Otherwise, user agent should set value to the first matching statement, if any, + switching on request's destination:

    "document"
    "frame"
    "iframe" -
    document `Accept` header value +
    document `Accept` header value
    "image"
    `image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5` From a159aee33325c7f39f366519f1abb9dd3814dc3f Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Tue, 29 Nov 2022 11:35:01 +0200 Subject: [PATCH 04/10] Make sec-purpose:prefetch cors-safelisted --- fetch.bs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fetch.bs b/fetch.bs index 051169e2a..90a919792 100644 --- a/fetch.bs +++ b/fetch.bs @@ -981,6 +981,9 @@ fetch("https://victim.example/naïve-endpoint", {

    As web browsers have historically not emitted ranges such as `bytes=-500` this algorithm does not safelist them. +

    `sec-purpose` +
    +

    If value is `prefetch`, return true. Otherwise return false.

    Otherwise

    Return false. From f9aef61551054405830437a96a992b521187daef Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Wed, 30 Nov 2022 18:40:40 +0200 Subject: [PATCH 05/10] Remove cors thingy --- fetch.bs | 3 --- 1 file changed, 3 deletions(-) diff --git a/fetch.bs b/fetch.bs index 90a919792..051169e2a 100644 --- a/fetch.bs +++ b/fetch.bs @@ -981,9 +981,6 @@ fetch("https://victim.example/naïve-endpoint", {

    As web browsers have historically not emitted ranges such as `bytes=-500` this algorithm does not safelist them. -

    `sec-purpose` -
    -

    If value is `prefetch`, return true. Otherwise return false.

    Otherwise

    Return false. From 4c9a53e175d237d4a283b3bfd9f81e9058c1ac15 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Fri, 13 Jan 2023 14:33:08 +0200 Subject: [PATCH 06/10] Update fetch.bs Co-authored-by: Anne van Kesteren --- fetch.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch.bs b/fetch.bs index 051169e2a..f4ab85d8d 100644 --- a/fetch.bs +++ b/fetch.bs @@ -1296,7 +1296,7 @@ downloads. This format of range header value can be set using add a range hea implementation-defined header value for the `User-Agent` header. -

    The Document `Accept` header value is +

    The document `Accept` header value is `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8`.

    Statuses

    From bd07f157e94352bf2b3aa61ed5008fa7f79931dc Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Fri, 13 Jan 2023 14:33:15 +0200 Subject: [PATCH 07/10] Update fetch.bs Co-authored-by: Anne van Kesteren --- fetch.bs | 1 + 1 file changed, 1 insertion(+) diff --git a/fetch.bs b/fetch.bs index f4ab85d8d..ca6a18261 100644 --- a/fetch.bs +++ b/fetch.bs @@ -1299,6 +1299,7 @@ downloads. This format of range header value can be set using add a range hea

    The document `Accept` header value is `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8`. +

    Statuses

    A status is an integer in the range 0 to 999, inclusive. From 36d562347794c9ac67162a1514091db86da41d41 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Fri, 13 Jan 2023 14:33:21 +0200 Subject: [PATCH 08/10] Update fetch.bs Co-authored-by: Anne van Kesteren --- fetch.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fetch.bs b/fetch.bs index ca6a18261..ff2c6b667 100644 --- a/fetch.bs +++ b/fetch.bs @@ -4197,8 +4197,8 @@ the request. value to document `Accept` header value.

  • -

    Otherwise, user agent should set value to the first matching statement, if any, - switching on request's destination: +

    Otherwise, the user agent should set value to the first matching statement, if + any, switching on request's destination:

    From a0055520c2abd962bcf4f939618c7381386314da Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Fri, 13 Jan 2023 14:34:33 +0200 Subject: [PATCH 09/10] Remove newline --- fetch.bs | 1 - 1 file changed, 1 deletion(-) diff --git a/fetch.bs b/fetch.bs index ff2c6b667..b4457ab19 100644 --- a/fetch.bs +++ b/fetch.bs @@ -4192,7 +4192,6 @@ the request.
    1. Let value be `*/*`. -

    2. If request's initiator is "prefetch", then set value to document `Accept` header value. From 02e6fe09980724494a2529ec76134af443319e59 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Mon, 16 Jan 2023 14:19:23 +0100 Subject: [PATCH 10/10] address nits --- fetch.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fetch.bs b/fetch.bs index b4457ab19..92a2d3562 100644 --- a/fetch.bs +++ b/fetch.bs @@ -4193,7 +4193,7 @@ the request.

    3. Let value be `*/*`.

    4. If request's initiator is "prefetch", then set - value to document `Accept` header value. + value to the document `Accept` header value.

    5. Otherwise, the user agent should set value to the first matching statement, if @@ -4204,7 +4204,7 @@ the request.

      "document"
      "frame"
      "iframe" -
      document `Accept` header value +
      the document `Accept` header value
      "image"
      `image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5`