Repository navigation
(WIP) Remove loadpolicy attribute - #17
Conversation
|
@yoavweiss any thoughts on the empty context? How should we handle this? Seems like allowing empty value would be equivalent to allowing @annevk what kind of fetches would result in empty context today? |
Yeah, I think we should ban an empty context (and I'm assuming that an invalid |
|
There is no fetch that uses the empty string (and that must remain so). It is only used for synthetic Does this |
|
@annevk ah, thanks. And no, it does not, see note at the bottom of: https://rawgit.com/w3c/preload/drop-loadpolicy/index.html#initializing-fetch-settings @yoavweiss kinda, sorta? This is what we have currently:
|
|
If you don't enforce I think this is a bad idea. There's no default settings defined in Fetch for request contexts. Those are set by the request contexts themselves. All request contexts are for is CSP, Mixed Content, nosniff, and service workers. By doing this you're forking their semantics quite badly. |
|
Hmm, on top of context semantics, we should also think of how CSP would be enforced for preload requests. /cc @mikewest |
|
To be clear, I'm opposed to abuse of request contexts in this way. You are tacking semantics on them that they just don't have and undermining the semantics they are supposed to have. Bad bad bad. |
|
Hmm, ok, so here's what I was thinking:
Does that sound reasonable? As a whole separate concern, If the concern is that reusing the Fetch request context's is confusing their semantics, should we define our own list within preload? I'd expect it to be a near duplicate, but perhaps it affords us more flexibility as well. My only hesitation here is that I'd much prefer to reuse some existing primitives, to avoid having to curate yet another ~type/~context list. Any tips? As background, see our earlier discussion on this: igrigorik/resource-hints#6 (comment) ... later, fetch-settings got renamed to "as" via igrigorik/resource-hints#21, and that's how we got where we are today. |
|
The part above the horizontal line seems reasonable to me. For the second half, it would make some sense if Fetch did the initialization of these context-specific settings based on the context, but currently it doesn't and it's not clear to me that Fetch has the necessary information. E.g. features such as client hints really need to be decided and set by the However, based on your proposal it seems that you think you can determine all these things based on a single string value without knowing anything about the environment? If that is truly the case we could revisit the architecture and use context for even more things in Fetch (and then reconsider how Another thought I have is that maybe before we communicate fetch options to |
👍 ... opened whatwg/fetch#36.
Sure, let's step back for a second... The general question here is: how do I use fetch() to fetch a resource with appropriate fetch settings? For example, when the browser initiates a fetch via Today,
Coming back to our conversation from way back when (igrigorik/resource-hints#6 (comment)), we had: <link rel="preload" href="/some/image.jpg"
params="{destinationContext: 'image', headers: {'Accept': 'image/jpeg'}}" />
Same options hash could then, perhaps, be supported by fetch(url, options?).
|
|
(Sorry for being potentially repetitive, just trying to make sure we're on the same line.) Fetch the specification controls all fetches within the platform, whether The main problem with |
|
"We'd need to add it to the fetch context table and map it to.. connect-src. After all, CSP is, in effect, a declarative fetch. With that in place, preload fetches are subject to CSP." I think you meant "After all, preload is, in effect, a declarative fetch. With that in place, preload fetches are subject to CSP." Everything is a declarative fetch except for fetch(), XHR, and websockets. But, we don't map them all to connect-src for CSP, for good reason. Please remember the reasons described in #2 for why defaulting to connect-src is bad. |
|
I agree that Regardless of the preload, however, we ought to be checking the resource before we embed it into the page in some context. I think this should fall out of tying CSP to Fetch more clearly. That is, preload just fills the cache, and |
|
@mikewest @briansmith @annevk thanks for your comments! FWIW, I think what we're discussing here goes well beyond rel=preload... I think if we solve this higher up (in Fetch), then preload behavior will fall out directly. With that in mind, opened: whatwg/fetch#43 |
|
This generally looks good to me for merge. Per the call today, please clarify the dependency on fetch and we can lock that down in future. |
|
Merging this, will address "as" in a separate pull. |
Preview: https://rawgit.com/w3c/preload/drop-loadpolicy/index.html
Continuation of w3c/resource-hints#27.
loadpolicyattributeTODO's and open questions:
asbeing a required attribute. /cc @yoavweiss