CSS and JSON modules will be fetched using a specific fetch destination (either "css" or "json") rather than a generic "script", that is normally used for JavaScript modules. This has the following effects: - the `Accept` HTTP header in the request will describe the expected mime type (`text/css,*/*;q=0.1` or `application/json,*/*;q=0.5`) - those modules will respect the style-src or connect-src Content Security Policies, rather than using JavaScript's script-src - When inspecting the request's destination (either through a service worker or through the `Sec-Fetch-Destination` HTTP header) it will be reported as `"css"` or `"json"`, rather than empty.
None
This feature better aligns usage of CSP directives to user expectations (e.g. using style-src for CSS)
Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?
None
None
- https://wpt.fyi/results/fetch/api/request/destination/fetch-destination.https.html - https://wpt.fyi/results/content-security-policy/connect-src/connect-src-json-import-allowed.sub.html - https://wpt.fyi/results/content-security-policy/connect-src/connect-src-json-import-blocked.sub.html - https://wpt.fyi/results/content-security-policy/style-src/import-style-allowed.sub.html - https://wpt.fyi/results/content-security-policy/style-src/import-style-blocked.sub.html
No milestones specified
Hello,For those looking for the spec diff relative to this change, you can find it in the HTML and Fetch PRs that introduced it: https://github.com/whatwg/html/pull/9486, https://github.com/whatwg/fetch/pull/1691---Nicolò RibaudoOn Monday, January 8, 2024 at 2:20:43 PM UTC+1 Nicolò Ribaudo wrote:
Explainer None
Specification https://html.spec.whatwg.org/#fetch-a-single-module-script
SummaryCSS and JSON modules will be fetched using a specific fetch destination (either "css" or "json") rather than a generic "script", that is normally used for JavaScript modules. This has the following effects: - the `Accept` HTTP header in the request will describe the expected mime type (`text/css,*/*;q=0.1` or `application/json,*/*;q=0.5`) - those modules will respect the style-src or connect-src Content Security Policies, rather than using JavaScript's script-src - When inspecting the request's destination (either through a service worker or through the `Sec-Fetch-Destination` HTTP header) it will be reported as `"css"` or `"json"`, rather than empty.
Yes I made a mistake in the description. The destination for CSS modules is indeed "style", and not "css". Thanks for catching it!
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAOmohSKQe-EffvK%2BT82kJTCezVayDOjKN02f7e_f74NbujWCjQ%40mail.gmail.com.
LGTM3
/Daniel
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAARdPYf4H_Nixn1CcCN7cGaU3oXsp9re_pP%2Bsdzq%3Diwk0GRsSg%40mail.gmail.com.