diff --git a/fetch.bs b/fetch.bs index b4760f69f..b9c7ed60e 100644 --- a/fetch.bs +++ b/fetch.bs @@ -6705,40 +6705,90 @@ 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 body is null then throw a {{TypeError}}. + +

  • If request's + body's length is null, then throw a {{TypeError}}. +

  • Set request's service-workers mode to "none".

  • -

    If request's body is not null and request's - body's source is null, then throw a {{TypeError}}. +

    If request's body's source is null, then throw a + {{TypeError}}.

    This disallows sending deferred fetches with a live {{ReadableStream}}. -

  • Let totalScheduledDeferredBytesForOrigin be 0. +
  • +

    Let quotaRelevantTopLevelNavigables be an the + quota-relevant top-level navigables given request's client. + +

    In most cases this will list will contain a single {{Document}}. The exception would + be when the request comes from a {{SharedWorker}}, in which case all the documents that directly + or indirectly obtain this worker would have to check their quota.

  • -

    If request's body is not null then: +

    For each topLevelNavigable in + quotaRelevantTopLevelNavigables: + +

    This algorithm asserts that this deferred fetch doesn't exceed two quotas: one for + the top-level document (640kb), and one for the reporting origin (64kb). The larger quota ensures + that the top-level {{Document}} and its subresources don't continue using an unlimited amount of + bandwidth after being destroyed. The smaller quota ensures that a single reporting sink doesn't + reserve the whole quota to itself.

      -
    1. If request's - body's length is null, then throw a {{TypeError}}. +

    2. Let totalScheduledDeferredBytesForTopLevelDocument be + request's body's length. -

    3. Set totalScheduledDeferredBytesForOrigin to request's +

    4. Let totalScheduledDeferredBytesForOrigin be request's body's length. -

    -
  • -
  • For each deferred fetch record deferredRecord in - request's client's fetch group's - deferred fetch records: if deferredRecord's - request's body is not null and - deferredRecord's request's URL's - origin is same origin with request's URL's - origin, then increment totalScheduledDeferredBytesForOrigin by - deferredRecord's request's body's - length. +

  • Let participatingClients be an empty set. + +

  • For each navigable of topLevelNavigable's + active document's inclusive descendant navigables, + append navigable's active document to + participatingClients. + +

  • +

    For each {{WorkerGlobalScope}} worker: + +

      +
    1. For each owner of worker's owner set: if + participatingClients contains owner, then + append worker to participatingClients. +

    + +
  • +

    For each client of participatingClients: +

      +
    1. +

      For each deferred fetch record deferredRecord in + client's fetch group's + deferred fetch records:

      + +
        +
      1. Let length be deferredRecord's + request's body's + length. -

      2. If totalScheduledDeferredBytesForOrigin is greater than 64 kilobytes, then - throw a "{{QuotaExceededError}}" {{DOMException}}. +

      3. Increment totalScheduledDeferredBytesForTopLevelDocument by length. + +

      4. If totalScheduledDeferredBytesForTopLevelDocument is greater than 640 + kilobytes, then throw a "{{QuotaExceededError}}" {{DOMException}}. + +

      5. If deferredRecord's request's + URL's origin is same origin with + request's origin, then increment + totalScheduledDeferredBytesForOrigin by length. + +

      6. If totalScheduledDeferredBytesForOrigin is greater than 64 kilobytes, then + throw a "{{QuotaExceededError}}" {{DOMException}}. +

      +
    2. +
    +
  • +
  • Set request's keepalive to true. @@ -6771,6 +6821,30 @@ i.e. when a fetch group is terminated, or after +

    +

    To retrieve the quota-relevant top-level navigables given an +environment settings object client:

    + +
      +
    1. +

      If client is a {{Document}}, then: + +

        +
      1. If client is fully active then return + « client's inclusive ancestor navigables[0] ». + +

      2. Return « ». +

      + +
    2. Let topLevelNavigables be « ». + +

    3. For each owner in client's + owner set, extend + topLevelNavigables with owner's quota-relevant top-level navigables. + +

    4. Return topLevelNavigables. +

    +

    To process deferred fetches given a fetch group fetchGroup: