-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add tests for how styles fetch resources from the network #31344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There are no reviewers for this pull request. Please reach out on W3C's irc server (irc.w3.org, port 6665) on channel #testing (web client) to get help with this. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM % comment on using Fetch-Metadata
Is it worthwhile to cover more image types? (e.g. border images)
const echo = get_resource_echo_url(uid, url) | ||
const style = ` | ||
@font-face { font-family: "SomeFont"; src: url(${echo}); } | ||
` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: spurious newline..
promise_test(async t => { | ||
const uid = "{{uuid()}}"; | ||
const result = await load_image({uid, url: image_url, prop: 'background'}, t) | ||
assert_false(Reflect.has(result, 'origin')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to use https://www.w3.org/TR/fetch-metadata/#sec-fetch-mode-header to verify that the mode is no-cors. (on top of or instead of origin
as a CORS proxy)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to use https://www.w3.org/TR/fetch-metadata/#sec-fetch-mode-header to verify that the mode is no-cors. (on top of or instead of
origin
as a CORS proxy)
I think Safari doesn't send that though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use them when available as a second layer? They can provide extra info (e.g. for CORS fetches, indicate if it's same-origin
, use-credentials
or omit
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can perform an equivalent fetch() and see that we sent the same headers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, although I'm not sure it'd be functionaly different from a "if we have Sec-Fetch-Mode headers, make sure their value is X"
Removed referer for now as it's unclear what it should be.
I can add |
…rm-tests#31344) * Add tests for how styles fetch resources from the network * Lint * Using sec-fetch-mode when available. Removed referer for now as it's unclear what it should be.
…rm-tests#31344) * Add tests for how styles fetch resources from the network * Lint * Using sec-fetch-mode when available. Removed referer for now as it's unclear what it should be.
Ensure that Origin/Referer headers are sent according to specification with different scenarios.
See w3c/csswg-drafts#6715