You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Update prefetch link once the spec and implementations are finalized #23553
Yes, though "When consuming prefetch, Vary: Accept should be ignored" is unnecessary if the accept header is the same as navigation. That's what we ended up doing in chrome and WPT (Send the same accept header as nav, but don't treat it in a special way when invalidating cache)
Given a request request and a policy policy, this algorithm returns the default directive if the resource-hint request violates all the policies, and "Does Not Violate" otherwise.
So in other words you run the test against all the policies and only fail if all of them fail. Is that right?
Further, that means if default-src is not specified (everything is allowed) you will succeed. And if default-src is permissive, the fact that others are not does not matter.
This test indicates that "Prefetch should include Sec-Purpose=prefetch and Sec-Fetch-Dest=empty headers"
So does as in a link map to the destination the value set by Sec-Fetch-Dest? So the above means that irrespective of the data type you'd just not specify the destination.
same origin document prefetch without 'as' should be consumed
same-site different-origin document prefetch without 'as' should be consumed
different-site document prefetch without 'as' should not be consumed
different-site document prefetch with 'as=document' should not be consumed
This confuses me if the Sec-Fetch-Dest passes the data from link as and that must be empty. It seems to indicate that that same site prefetch of a document doesn't need as (always succeeds), but cross-site document prefetches of documents do not.
I'm probably asking a stupid question here sorry, but what are the rules for "as", and are there special rules for document/cross-site and so on.
Given a request request and a policy policy, this algorithm returns the default directive if the resource-hint request violates all the policies, and "Does Not Violate" otherwise.
So in other words you run the test against all the policies and only fail if all of them fail. Is that right?
Yes. The idea is that your prefetch could be any type of resource. So if any type of resource is allowed to be fetched from this URL, you can also prefetch this URL.
Further, that means if default-src is not specified (everything is allowed) you will succeed. And if default-src is permissive, the fact that others are not does not matter.
This test indicates that "Prefetch should include Sec-Purpose=prefetch and Sec-Fetch-Dest=empty headers"
So does as in a link map to the destination the value set by Sec-Fetch-Dest? So the above means that irrespective of the data type you'd just not specify the destination.
It does in <link rel=preload>. There is no as in prefetch.
same origin document prefetch without 'as' should be consumed
same-site different-origin document prefetch without 'as' should be consumed
different-site document prefetch without 'as' should not be consumed
different-site document prefetch with 'as=document' should not be consumed
This confuses me if the Sec-Fetch-Dest passes the data from link as and that must be empty. It seems to indicate that that same site prefetch doesn't need as, but cross-site document prefetches do.
I'm probably asking a stupid question here sorry, but what are the rules for "as", and are there special rules for document/cross-site and so on.
The as=document is some non-standard thing in chromium that we will remove in the future. These tests show the desired results: that as=document doesn't do anything special. they currently fail on chromium because of the special behavior.
Activity
hamishwillee commentedon Jun 19, 2023
FYI, FF supports
Sec-Purpose: prefetchfrom FF115 so I will be trying to document that shortly in #27171.@noamr It would be good to have help writing a vendor neutral version of https://developer.mozilla.org/en-US/docs/Glossary/Prefetch if you have advice.
I also found this doc, which I think should be deleted: https://developer.mozilla.org/en-US/docs/Web/HTTP/Link_prefetching_FAQ
noamr commentedon Jun 19, 2023
Amazing.
Yes it would be great! I suggest starting with the spec, and ask if anything is missing/needs clarifying?
hamishwillee commentedon Jun 19, 2023
@noamr Thanks. I also found your comment here useful https://bugzilla.mozilla.org/show_bug.cgi?id=1788167 as that seems to summarize where browsers/servers should end up.
noamr commentedon Jun 19, 2023
Yes, though "When consuming prefetch, Vary: Accept should be ignored" is unnecessary if the accept header is the same as navigation. That's what we ended up doing in chrome and WPT (Send the same accept header as nav, but don't treat it in a special way when invalidating cache)
hamishwillee commentedon Jun 20, 2023
@noamr Can you confirm my understanding of the CORS-mode behaviour - specifically what does this mean?:
Looking at the spec https://w3c.github.io/webappsec-csp/#does-request-violate-policy ...
Given a request request and a policy policy, this algorithm returns the default directive if the resource-hint request violates all the policies, and "Does Not Violate" otherwise.
So in other words you run the test against all the policies and only fail if all of them fail. Is that right?
Further, that means if default-src is not specified (everything is allowed) you will succeed. And if default-src is permissive, the fact that others are not does not matter.
And presumably same-site requests just work?
hamishwillee commentedon Jun 20, 2023
Also,
This test indicates that "Prefetch should include Sec-Purpose=prefetch and Sec-Fetch-Dest=empty headers"
So does
asin a link map to the destination the value set bySec-Fetch-Dest? So the above means that irrespective of the data type you'd just not specify the destination.But then in this test we have:
This confuses me if the
Sec-Fetch-Destpasses the data from linkasand that must be empty. It seems to indicate that that same site prefetch of a document doesn't needas(always succeeds), but cross-site document prefetches of documents do not.I'm probably asking a stupid question here sorry, but what are the rules for "as", and are there special rules for document/cross-site and so on.
noamr commentedon Jun 20, 2023
Yes. The idea is that your prefetch could be any type of resource. So if any type of resource is allowed to be fetched from this URL, you can also prefetch this URL.
Correct.
No, you can also prevent same-site in CSP.
noamr commentedon Jun 20, 2023
It does in
<link rel=preload>. There is noasin prefetch.The
as=documentis some non-standard thing in chromium that we will remove in the future. These tests show the desired results: thatas=documentdoesn't do anything special. they currently fail on chromium because of the special behavior.Josh-Cena commentedon Jul 4, 2023
@noamr Do you think this could be closed by #27589?
noamr commentedon Jul 4, 2023
Yes!
Josh-Cena commentedon Jul 4, 2023
Wow, thanks for the prompt response 😄
hamishwillee commentedon Jul 7, 2023
@noamr ... and thanks for all your support on getting the fixes in.