diff --git a/source b/source index 601171fa244..5e80fc32647 100644 --- a/source +++ b/source @@ -66070,11 +66070,12 @@ interface HTMLScriptElement : HTMLElement {
The second core attribute is the src attribute. It must only be specified for classic scripts and JavaScript module scripts, and denotes that instead of using the element's
- child text content as the script content, the script will be fetched from the
- specified URL. If src is specified, it must be
- a valid non-empty URL potentially surrounded by spaces.
src is specified, it must be a valid non-empty URL
+ potentially surrounded by spaces.
Which other attributes may be specified on a given script element is determined by
the following table:
If el's type is "importmap" or "speculationrules", then queue an
- element task on the DOM manipulation task source given el to
- fire an event named error at el, and return.
error at el, and
+ return.
- External import maps and speculation rules are not currently supported. See WICG/import-maps issue #235 and WICG/nav-speculation issue #348 - for discussions on adding support.
+External import maps are not currently supported. See WICG/import-maps issue #235 for + discussions on adding support.
Let src be the value of el's Fetch an external module script graph given url, settings
object, options, and onComplete.
speculationrules"Fetch speculation rules given + url, el's node document, options, and the + following steps given speculationRulesText:
+ +Let result be the result of parsing speculationRulesText given el's node + document.
Run onComplete given result.
For performance reasons, user agents may start fetching the classic script or module graph @@ -112625,7 +112650,7 @@ new PaymentRequest(…); // Allowed to use are delivered as JSON documents, via either:
inline script elements with their type
+
script elements with their type
attribute set to "speculationrules"; or
resources fetched from a URL specified in the `Speculation-Rules` HTTP
@@ -114366,37 +114391,15 @@ new PaymentRequest(…); // Allowed to use
steps:
Let request be a new request whose
- URL is url, destination is "speculationrules", and mode is
- "cors".
Fetch request with the following processResponseConsumeBody steps given response response and null, failure, or a - byte sequence bodyBytes:
+Fetch speculation rules given + url, document, and the following steps given + speculationRulesText:
If bodyBytes is null or failure, then abort these steps.
If response's status is - not an ok status, then abort these steps.
If the result of extracting a MIME type
- from response's header list
- does not have an essence of
- "application/speculationrules+json", then abort these steps.
Let bodyText be the result of UTF-8 - decoding bodyBytes.
Let ruleSet be the result of parsing a speculation rule set string given bodyText, - document, and response's URL. If this throws an exception, then abort these - steps.
Let ruleSet be the result of parsing speculationRulesText given document + and url.
Append ruleSet to document's speculation rule @@ -117366,6 +117369,77 @@ document.querySelector("button").addEventListener("click", bound);
To fetch speculation rules, given a URL url,
+ Document document, an optional script fetch options-or-null
+ options (default null), and an algorithm onComplete, run these steps.
+ onComplete must be an algorithm accepting a string.
Let request be a new request, with
+ +speculationrules"cors"If options is not null, then:
+ +Set request's credentials + mode to options's credentials mode.
Set request's integrity + metadata to options's integrity metadata.
Set request's referrer + policy to options's referrer policy.
Set request's priority to + options's fetch + priority.
Fetch request with the following processResponseConsumeBody steps given + response and bodyBytes:
+ +If bodyBytes is null or failure, then run onComplete given the + empty string, and return.
If response's status is not an + ok status, then run onComplete given the empty string, and + return.
If the result of extracting a MIME type from
+ response's header list does not
+ have an essence of
+ "application/speculationrules+json", then run onComplete given the
+ empty string, and return.
Let speculationRulesText be the result of UTF-8 + decoding bodyBytes.
Run onComplete given speculationRulesText.