From 6b6ec06127a50436fd40a49a1863a8a96bee5f82 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Fri, 14 Nov 2025 15:40:06 +0000 Subject: [PATCH 1/5] Bypass blob URL partitioning for top-level self fetches Implements the fetch spec sid of bypassing partitioning when a top-level blob URL document attempts to fetch itself. For more info see: https://github.com/w3c/FileAPI/issues/210 --- fetch.bs | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/fetch.bs b/fetch.bs index 8d19ae84d..b52a6a787 100755 --- a/fetch.bs +++ b/fetch.bs @@ -5363,14 +5363,41 @@ returning a response directly, or allowing the request to proceed by returning n
  • Let isTopLevelNavigation be true if request's destination is "document"; otherwise, false. -

  • If isTopLevelNavigation is false and requestEnvironment is null, - then return a network error. +

  • Let isTopLevelSelfFetch be false. + +

  • If request's client is non-null: +

      +
    1. Let global be request's client's + global object. + +

    2. +

      If all of the following conditions are true: + +

        +
      • global is a {{Window}} object; + +

      • global's navigable is not null; -

      • Let navigationOrEnvironment be the string "navigation" if - isTopLevelNavigation is true; otherwise, requestEnvironment. +

      • global's navigable's parent + is null; and + +

      • requestEnvironment's creation URL + equals request's current URL, +

      + +

      then set isTopLevelSelfFetch to false. + +

    3. Let stringOrEnvironment be requestEnvironment. + +

    4. If isTopLevelNavigation is true, then set stringOrEnvironment + to the string "navigation". + +

    5. Otherwise, if isTopLevelSelfFetch is true, then set + stringOrEnvironment to the string "top-level-self-fetch". +

  • Let blob be the result of obtaining a blob object given - blobURLEntry and navigationOrEnvironment. + blobURLEntry and stringOrEnvironment.

  • If blob is not a {{Blob}} object, then return a network error. From 30c735affc58e2d14f097ae1e0f423f5883bb4ba Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Wed, 19 Nov 2025 17:05:44 -0500 Subject: [PATCH 2/5] Apply suggestions from code review Co-authored-by: Anne van Kesteren --- fetch.bs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fetch.bs b/fetch.bs index b52a6a787..eef015c06 100755 --- a/fetch.bs +++ b/fetch.bs @@ -5365,7 +5365,9 @@ returning a response directly, or allowing the request to proceed by returning n

  • Let isTopLevelSelfFetch be false. -

  • If request's client is non-null: +

  • +

    If request's client is non-null: +

    1. Let global be request's client's global object. @@ -5390,10 +5392,10 @@ returning a response directly, or allowing the request to proceed by returning n

    2. Let stringOrEnvironment be requestEnvironment.

    3. If isTopLevelNavigation is true, then set stringOrEnvironment - to the string "navigation". + to "navigation".

    4. Otherwise, if isTopLevelSelfFetch is true, then set - stringOrEnvironment to the string "top-level-self-fetch". + stringOrEnvironment to "top-level-self-fetch".

  • Let blob be the result of obtaining a blob object given From bf7b57943ed5e29d3ba46a966ad2b0363cea33b3 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Wed, 19 Nov 2025 23:25:09 +0000 Subject: [PATCH 3/5] Address review feedback --- fetch.bs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fetch.bs b/fetch.bs index eef015c06..6d084dd91 100755 --- a/fetch.bs +++ b/fetch.bs @@ -5375,19 +5375,19 @@ returning a response directly, or allowing the request to proceed by returning n

  • If all of the following conditions are true: -

    -

    then set isTopLevelSelfFetch to false. +

    then set isTopLevelSelfFetch to true.

  • Let stringOrEnvironment be requestEnvironment. From c35c3dd1f07bed1858c14ef777d65274b84cd36c Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Tue, 25 Nov 2025 16:31:43 +0000 Subject: [PATCH 4/5] Define `stringOrEnvironment` more broadly --- fetch.bs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fetch.bs b/fetch.bs index 6d084dd91..1a1e27433 100755 --- a/fetch.bs +++ b/fetch.bs @@ -5388,15 +5388,15 @@ returning a response directly, or allowing the request to proceed by returning n

    then set isTopLevelSelfFetch to true. + -

  • Let stringOrEnvironment be requestEnvironment. +

  • Let stringOrEnvironment be requestEnvironment. -

  • If isTopLevelNavigation is true, then set stringOrEnvironment - to "navigation". +

  • If isTopLevelNavigation is true, then set stringOrEnvironment + to "navigation". -

  • Otherwise, if isTopLevelSelfFetch is true, then set - stringOrEnvironment to "top-level-self-fetch". - +

  • Otherwise, if isTopLevelSelfFetch is true, then set + stringOrEnvironment to "top-level-self-fetch".

  • Let blob be the result of obtaining a blob object given blobURLEntry and stringOrEnvironment. From f6f27e71f8d017fee77102af5ba8e26a1411caa2 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Thu, 27 Nov 2025 08:33:49 +0100 Subject: [PATCH 5/5] slight refactor --- fetch.bs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/fetch.bs b/fetch.bs index 1a1e27433..d4f9e3e18 100755 --- a/fetch.bs +++ b/fetch.bs @@ -5360,9 +5360,6 @@ returning a response directly, or allowing the request to proceed by returning n

  • Let requestEnvironment be the result of determining the environment given request. -

  • Let isTopLevelNavigation be true if request's - destination is "document"; otherwise, false. -

  • Let isTopLevelSelfFetch be false.

  • @@ -5390,13 +5387,18 @@ returning a response directly, or allowing the request to proceed by returning n

    then set isTopLevelSelfFetch to true. -

  • Let stringOrEnvironment be requestEnvironment. +

  • +

    Let stringOrEnvironment be the result of these steps: -

  • If isTopLevelNavigation is true, then set stringOrEnvironment - to "navigation". +

      +
    1. If request's destination is "document", + then return "top-level-navigation". -

    2. Otherwise, if isTopLevelSelfFetch is true, then set - stringOrEnvironment to "top-level-self-fetch". +

    3. If isTopLevelSelfFetch is true, then return + "top-level-self-fetch". + +

    4. Return requestEnvironment. +

  • Let blob be the result of obtaining a blob object given blobURLEntry and stringOrEnvironment.