Contact emails
yo...@yoav.ws / ywe...@akamai.com
Spec
Related spec discussions:
https://github.com/w3c/preload/issues/80
https://github.com/whatwg/fetch/pull/547
https://github.com/whatwg/fetch/pull/549
https://github.com/whatwg/html/pull/2588
As this is a fairly small change to the API's surface, I don't think a TAG review is required, but let me know if you think otherwise.
Summary
Align the preload implementation to the spec on 3 fronts:
Motivation
The motivation for this change is to avoid double downloads following developer confusion around empty `as` values, enable feature detection of supported `as` values, and simplify the HTML processing model. Details below:
Interoperability and Compatibility Risk
Interoperability risk is low, and I intend to implement similar changes in WebKit, and Firefox were part of the related spec discussions and are supportive of this change.
Compatibility risk is low. This is changing the behavior of a shipped feature, but:
Edge: No signals
Firefox: In development
Safari: In development
Web developers: Positive
Ongoing technical constraints
None.
Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
Yes.
OWP launch tracking bug
CL & WPT tests are at https://codereview.chromium.org/2903653005/
Link to entry on the feature dashboard
This is a small change to the API surface so I don't think a dedicated entry is required.
Requesting approval to ship?
Yes, please! :)
- Usage of onerror with preload (which we're removing here) is 0 when querying the HTTP archive.
- Thanks to igrigorik@ for improving & running that query! :)
--
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+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CABc02_Kp8ZvwAgezTzBBr5t5QAnHT0Jr1dzeiSmQabDnzmQ%2BFw%40mail.gmail.com.
There is currently (empirically) agreement between all browsers implementing preload that:- if as attribute is empty- and the resource is a script- and the actual script is downloaded by a child iframe- and the script it cacheablethat there is no double download.
Due to the unfortunate fact that preload is observing CSP rules according to the owning document, this is currently the only way to preload resources for child iframes that have a less strict CSP than their container (typical usage of an iframe as a sandbox), which is critical to increase concurrency in downloads of embeds.
Lets make sure that this change has a documented way of doing the above (just defaulting as to `fetch`?) and that this actually works without double downloads across implementations.<link rel=preload href=script.js><script src=script.js></script>currently does not double download if script.js is cacheable in any browser. An equivalent mechanism should continue to exist.
☆PhistucK
--
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+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CACj%3DBEjOby6xXJCrovhbYo1FgwvDFh7e1Y-1NS7AyQXAxawArg%40mail.gmail.com.
Tested in Safari and Chrome. it would be sad to lose the functionality. Having prefetch do the right thing would be even better, of course. Right now prefetch doesn't work for the use case. It appears Chrome doesn't use the result if the prefetch request hasn't finished by the time a request to the same URL is made.
On Fri, May 26, 2017 at 8:59 AM, Yoav Weiss <yo...@yoav.ws> wrote:
On Fri, May 26, 2017 at 3:42 PM PhistucK <phis...@gmail.com> wrote:On Fri, May 26, 2017 at 12:52 PM, Yoav Weiss <yo...@yoav.ws> wrote:
- Usage of onerror with preload (which we're removing here) is 0 when querying the HTTP archive.
- Thanks to igrigorik@ for improving & running that query! :)
It only counts inline event listeners. There might be usage in JavaScript, but yes, that would be a pretty weird practice.Would there be a perpetual console warning when the value is invalid? I think there should be, to be friendly to mistaken developers.Yes, I have no plans to remove the console warning.☆PhistucK
--
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/8f30b22a-1954-4c4e-9559-4b4d32c9e838%40chromium.org.
One of our principles of web compat is that we try to avoid taking away useful functionality when there is not some other way to achieve it.
Yoav, is that prefetch bug something you could look into fixing before shipping this preload change?
Is there any web-platform-test coverage for this?
IIUC, the same effect can be achieved by sending out an XHR/fetch() for said resource, instead of preloading it. That'd put said resource inside the HTTP cache (while submitting it to connect-src CSP restrictions, rather than script-src) for other renderers to take it from there.
On Mon, May 29, 2017 at 11:34 AM, Yoav Weiss <yo...@yoav.ws> wrote:IIUC, the same effect can be achieved by sending out an XHR/fetch() for said resource, instead of preloading it. That'd put said resource inside the HTTP cache (while submitting it to connect-src CSP restrictions, rather than script-src) for other renderers to take it from there.
I strongly recommend against accepting this as a viable workaround. Not only does it mean that you have to expand your connect-src policy (to also include the ones in script-src)
, you are also encouraging inline scripts (because unless I am mistaken, there is no other effective way to execute XMLHttpRequest or fetch that does not require a script request and requesting a script defeats the entire start-loading-early concept).
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/op.y00m93ctidj3kv%40simons-mbp.lan.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CALjhuidW1Q_hRLdUfF%2BrwnXiNLhN9Af6Ry8AOyd1g7%2BtoasXdQ%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAARdPYeGexnavAZEZP8m2YWMcED77qJzjQvz6WLDbEJdG52Fow%40mail.gmail.com.
Yoav: Unfortunately the XHR method doesn't appear to seed the HTTP cache for scripts in Safari. It working might be an artefact of the preload implementation there?
Where is the right place to file an issue for prefetch?
LGTM2The change in behavior makes good sense to me, the chances that a "missing value default" would be the right fetch mode aren't high I'd wager. The compat risk seems low enough to just try this, I don't think use counters could help shed any light here.To answer Rick's question, wpt are in https://codereview.chromium.org/2903653005/. However, some of the spec PRs are open, will you make sure they are merged roughly at the same time as the tests make it upstream?
On Thu, Jun 1, 2017 at 4:18 PM Malte Ubl <malt...@google.com> wrote:Yoav: Unfortunately the XHR method doesn't appear to seed the HTTP cache for scripts in Safari. It working might be an artefact of the preload implementation there?Not sure, tbh.
Not right now, but hopefully soon.What Simon suggested was something like:`<link rel=preload href=foo><link rel=preload href=foo as=fetch>`which would trigger a single identical preload both before and after this change.
I see. We can probably do that. I'm sad about the wasted CPU/RAM on an extra DOM node, but it would work.