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
The use of JSON scares me from an implementation point of view.
Since this is a mechanism for talking to the preloader, and the preloader is implemented off-main-thread in at least Gecko and Blink (not sure about IE), it probably has no access to existing JSON parsers. I also don't think either of them uses the Fetch object underneath.
I didn't study this in detail for Blink, but I suspect that using JSON would require creating a thread-safe JSON parser, which will likely complicate implementation.
So, if we have alternatives to using JSON here, they may be better for quick adoption.
At the moment the primary thing we need to communicate is destinationContext, so we could pull it out into a separate attribute. However, thinking a bit ahead, it does seem like there would be cases where you'd want to (declaratively) specify some extra request headers, override default request priorities, and so on. Exposing attributes for all of those would be a painful exercise... on the other hand, a JSON hash is something that can be easily extended in the future.
It might be worth while to get @abarth's opinion on this, but I think it'd be a good idea to split the destinationContext to a separate attribute, so that an initial implementation will be relatively simple, and add the extra complexity of a JSON based attribute later on, if neccessary.
Let's see what the feedback is... It's easy enough to change it back to a dedicated attribute and then expose the JSON variant later once Fetch is further along.
@bizzbyster no, initiatorType should be left as is. We need to know who initiated the fetch - see #19. That said, as doc'ed in that bug, there is a chance we'll need a new attribute to expose if the resource was matched against a speculative fetch.
The system I am building is using Resource Timing API feedback to auto-generate preload resource hints. I therefore need some way to get the destinationContext value (Script, Image, etc.) from the Resource Timing API. If not initiatorType, what do you suggest?
@bizzbyster I'm suggesting that we need a new attribute on NavTiming/ResourceTiming to expose this data - see #19 and lets continue that discussion there.
Sounds good okay. That other thread just seemed more about indicating if a hint was "used" or not. As opposed to making sure we're able to get the initiatorType and destinationContext in the RT/NT API.
Activity
igrigorik commentedon Aug 21, 2014
The paint is fresh on this one. The idea is to pass that as an initialization hash to Fetch.. see:
For background: #6 (comment). In terms of other attributes, custom HTTP headers, and other Fetch request initialization options.
Not attached to it. Just going by what's being discussed in the linked bug above.
yoavweiss commentedon Aug 22, 2014
The use of JSON scares me from an implementation point of view.
Since this is a mechanism for talking to the preloader, and the preloader is implemented off-main-thread in at least Gecko and Blink (not sure about IE), it probably has no access to existing JSON parsers. I also don't think either of them uses the Fetch object underneath.
I didn't study this in detail for Blink, but I suspect that using JSON would require creating a thread-safe JSON parser, which will likely complicate implementation.
So, if we have alternatives to using JSON here, they may be better for quick adoption.
igrigorik commentedon Aug 22, 2014
That's good feedback - thanks.
At the moment the primary thing we need to communicate is
destinationContext, so we could pull it out into a separate attribute. However, thinking a bit ahead, it does seem like there would be cases where you'd want to (declaratively) specify some extra request headers, override default request priorities, and so on. Exposing attributes for all of those would be a painful exercise... on the other hand, a JSON hash is something that can be easily extended in the future.yoavweiss commentedon Aug 22, 2014
It might be worth while to get @abarth's opinion on this, but I think it'd be a good idea to split the destinationContext to a separate attribute, so that an initial implementation will be relatively simple, and add the extra complexity of a JSON based attribute later on, if neccessary.
igrigorik commentedon Aug 22, 2014
Updated the spec to use
fetch-settingsin 955a9ff. See here:https://igrigorik.github.io/resource-hints/#fetch-settings
Let's see what the feedback is... It's easy enough to change it back to a dedicated attribute and then expose the JSON variant later once Fetch is further along.
bizzbyster commentedon Aug 25, 2014
"It's easy enough to change it back to a dedicated attribute and then expose the JSON variant later once Fetch is further along."
+1.
It seems like you are anticipating a need that we may not have here. It may be that destinationContext alone will be needed.
bizzbyster commentedon Aug 26, 2014
@igrigorik Would the destinationContext value be set as the initiatorType for this fetched resource in the Resource Timing API?
If so, this would close the loop on the issue discussed here: http://lists.w3.org/Archives/Public/public-web-perf/2014Aug/0013.html.
igrigorik commentedon Aug 27, 2014
@bizzbyster no, initiatorType should be left as is. We need to know who initiated the fetch - see #19. That said, as doc'ed in that bug, there is a chance we'll need a new attribute to expose if the resource was matched against a speculative fetch.
bizzbyster commentedon Aug 28, 2014
Ilya,
The system I am building is using Resource Timing API feedback to auto-generate preload resource hints. I therefore need some way to get the destinationContext value (Script, Image, etc.) from the Resource Timing API. If not initiatorType, what do you suggest?
Thanks,
Peter
igrigorik commentedon Aug 28, 2014
@bizzbyster I'm suggesting that we need a new attribute on NavTiming/ResourceTiming to expose this data - see #19 and lets continue that discussion there.
bizzbyster commentedon Aug 29, 2014
Sounds good okay. That other thread just seemed more about indicating if a hint was "used" or not. As opposed to making sure we're able to get the initiatorType and destinationContext in the RT/NT API.
igrigorik commentedon Aug 30, 2014
@yoavweiss think
asshould address all of the above.. and much cleaner too! Let me know if otherwise.yoavweiss commentedon Aug 31, 2014
LGTM!