From 19d3bd23526a49739f6d2388d9bf043140fd9ff9 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Thu, 5 Sep 2024 10:34:39 +0100 Subject: [PATCH] Allow 16kb (UA-specific) even for 3p contexts --- fetch.bs | 61 ++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 19 deletions(-) diff --git a/fetch.bs b/fetch.bs index 90430664a..e7bc2fd7d 100644 --- a/fetch.bs +++ b/fetch.bs @@ -2726,11 +2726,12 @@ a list of fetch records. a list of deferred fetch records.

A fetch group has an associated boolean -is eligible for deferred fetching. +is eligible for full-quota deferred fetching. To initialize a fetch group for a given environment settings object -settings, set its is eligible for deferred fetching to the -result of calling check deferred fetching eligibility given settings. +settings, set its is eligible for full-quota deferred fetching +to the result of calling check full-quota deferred fetching eligibility given +settings.

A fetch record is a [=struct=]. It has the following items: @@ -6723,10 +6724,6 @@ i.e., when a fetch group is terminated, or after

  • If request's URL is not a potentially trustworthy url, then throw a "{{SecurityError}}" {{DOMException}}. -

  • If request's client's fetch group - is eligible for deferred fetching is false, then throw a - "{{NotAllowedError}}" {{DOMException}}. -

  • Let totalRequestLength be the [=string/length=] of request's URL, serialized with [=URL serializer/exclude fragment=] set to true. @@ -6800,6 +6797,16 @@ amount of bandwidth after being destroyed. The smaller quota ensures that a sing doesn't reserve the whole quota to itself.

      +
    1. +

      If request's client's fetch group + is eligible for full-quota deferred fetching is false, the user agent may + return 0. + +

      This allows implementations to prevent 3rd party environments from taking up + non-abortable bandwidth without the consent of the top-level document. Without this constraint, + those environments can still take up a small amount of bandwidth (16 kibibytes) for deferred + fetching. +

    2. Let closestSameOriginInclusiveAncestor be document's node navigable. @@ -6812,11 +6819,22 @@ doesn't reserve the whole quota to itself.

    3. Let directRelativeSameOriginNavigables be the inclusive direct same origin descendants of closestSameOriginInclusiveAncestor. -

    4. Let remainingTotalQuota be 640 kibibytes if - directRelativeSameOriginNavigables includes document's - node navigable's top-level traversable, and 64 kibibytes otherwise. +

    5. +

      Let remainingTotalQuota be the result of the first matching statement: + +

      +
      directRelativeSameOriginNavigables includes document's + node navigable's top-level traversable +
      640 kibibytes -
    6. Let remainingQuotaForOrigin be 64 kibibytes. +

      request's client's fetch group + is eligible for full-quota deferred fetching is true +
      64 kibibytes + + +
      Otherwise +
      16 kibibytes +
    7. For each navigable in @@ -6852,7 +6870,8 @@ doesn't reserve the whole quota to itself.

    8. If childNavigable's active document's origin is not same origin with navigable's active document's origin and childNavigable's active document's - fetch group's is eligible for deferred fetching is true, + fetch group's + is eligible for full-quota deferred fetching is true, then decrement remainingTotalQuota by 64 kibibytes.

  • @@ -6887,8 +6906,8 @@ doesn't reserve the whole quota to itself.
    -To check deferred fetching eligibility given an environment settings object -settings: +To check full-quota deferred fetching eligibility given an +environment settings object settings:
    1. If settings is not a Document, return false. @@ -6896,12 +6915,16 @@ To check deferred fetching eligibility given an environment settin

    2. If the result of calling [$Is feature enabled in document for origin?$] given settings is Disabled, return false. -

    3. If settings's node navigable's parent is a - navigable whose active document's fetch group's - is eligible for deferred fetching is true, then return true. +

    4. Let parentDocument be settings's node navigable's + parent's active document. + +

    5. If parentDocument is null, then return true. + +

    6. If parentDocument's origin is same origin with + settings's origin then return true. -

    7. If the available deferred fetching quota given settings and null is less - than 64 kibibytes, return false. +

    8. If the available deferred fetching quota given parentDocument and null is + less than 64 kibibytes, return false.

    9. Return true.