New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 726647 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jun 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Launch-OWP
Launch-Accessibility: ----
Launch-Exp-Leadership: ----
Launch-Leadership: ----
Launch-Legal: ----
Launch-M-Approved: ----
Launch-M-Target: ----
Launch-Privacy: ----
Launch-Security: ----
Launch-Test: ----
Launch-UI: ----
Rollout-Type: ----



Sign in to add a comment

Mandatory `as` value for link rel preload

Project Member Reported by y...@yoav.ws, May 26 2017

Issue description


----------

Change description:
Align the preload implementation to the spec on 3 fronts:
* Avoid fetching a resource if `as` is missing or empty.
* Avoid triggering an error event if `as` is invalid, missing or empty.
* Properly reflect only a limited set of known values for `as`.


Changes to API surface:
* Avoid fetching a resource if `as` is missing - we've seen many cases where developers omit the `as` value from their preload links, which often results in double downloads. We've also had developer feedback that an empty `as` value being mapped to XHR/fetch() feels magical. This change addresses that, by defining a "fetch" value for these cases and ignoring empty/missing `as` values.
* Properly reflect a limited set of known `as` values - enable feature detection of supported `as` values (instead of the `onerror` based fallback, which we're deprecating.
* Avoid triggering the "onerror" event when an invalid `as` value is encountered - simplify HTML's processing model.

Links:
Public standards discussion: 

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

Support in other browsers:
Internet Explorer: No
Firefox: In development
Safari: In development

 

Comment 1 by y...@yoav.ws, May 29 2017

Labels: -M-60 M-61

Comment 2 by y...@yoav.ws, Jun 1 2017

Components: Blink>Loader
Project Member

Comment 3 by bugdroid1@chromium.org, Jun 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1f18863cc9b2a5fe463671f3eb60de2f95bbf283

commit 1f18863cc9b2a5fe463671f3eb60de2f95bbf283
Author: yoav <yoav@yoav.ws>
Date: Sat Jun 03 00:20:44 2017

[preload] Mandatory `as` value and related spec alignments

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:
* Avoid fetching a resource if `as` is missing - we've seen many cases where
  developers omit the `as` value from their preload links, which often results in
  double downloads. We've also had developer feedback that an empty `as` value
  being mapped to XHR/fetch() feels magical. This change addresses that, by defining
  a "fetch" value for these cases and ignoring empty/missing `as` values.
* Properly reflect a limited set of known `as` values - enable feature detection of
  supported `as` values (instead of the `onerror` based fallback, which we're
  deprecating.
* Avoid triggering the "onerror" event when an invalid `as` value is encountered -
  simplify HTML's processing model.

BUG= 726647 ,  715690 ,  698520 

Review-Url: https://codereview.chromium.org/2903653005
Cr-Commit-Position: refs/heads/master@{#476840}

[modify] https://crrev.com/1f18863cc9b2a5fe463671f3eb60de2f95bbf283/third_party/WebKit/LayoutTests/external/wpt/html/dom/reflection-metadata-expected.txt
[modify] https://crrev.com/1f18863cc9b2a5fe463671f3eb60de2f95bbf283/third_party/WebKit/LayoutTests/external/wpt/preload/download-resources.html
[modify] https://crrev.com/1f18863cc9b2a5fe463671f3eb60de2f95bbf283/third_party/WebKit/LayoutTests/external/wpt/preload/onerror-event.html
[modify] https://crrev.com/1f18863cc9b2a5fe463671f3eb60de2f95bbf283/third_party/WebKit/LayoutTests/external/wpt/preload/onload-event.html
[add] https://crrev.com/1f18863cc9b2a5fe463671f3eb60de2f95bbf283/third_party/WebKit/LayoutTests/external/wpt/preload/reflected-as-value.html
[modify] https://crrev.com/1f18863cc9b2a5fe463671f3eb60de2f95bbf283/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/opaque-response-preloaded-iframe.html
[modify] https://crrev.com/1f18863cc9b2a5fe463671f3eb60de2f95bbf283/third_party/WebKit/LayoutTests/fast/dom/HTMLLinkElement/link-preload-validity.html
[modify] https://crrev.com/1f18863cc9b2a5fe463671f3eb60de2f95bbf283/third_party/WebKit/LayoutTests/http/tests/preload/link_header_preload_on_commit.php
[modify] https://crrev.com/1f18863cc9b2a5fe463671f3eb60de2f95bbf283/third_party/WebKit/LayoutTests/http/tests/preload/memcache_eviction.html
[modify] https://crrev.com/1f18863cc9b2a5fe463671f3eb60de2f95bbf283/third_party/WebKit/LayoutTests/http/tests/preload/memcache_reuse_of_non_cacheable_preload.html
[delete] https://crrev.com/37003a1722d89acc689cd3911efceb583bad43e0/third_party/WebKit/LayoutTests/http/tests/preload/onerror_event.html
[modify] https://crrev.com/1f18863cc9b2a5fe463671f3eb60de2f95bbf283/third_party/WebKit/LayoutTests/http/tests/security/link-crossorigin-preload-anonymous.html
[modify] https://crrev.com/1f18863cc9b2a5fe463671f3eb60de2f95bbf283/third_party/WebKit/LayoutTests/http/tests/security/link-crossorigin-preload-no-cors.html
[modify] https://crrev.com/1f18863cc9b2a5fe463671f3eb60de2f95bbf283/third_party/WebKit/LayoutTests/http/tests/security/link-crossorigin-preload-use-credentials.html
[modify] https://crrev.com/1f18863cc9b2a5fe463671f3eb60de2f95bbf283/third_party/WebKit/Source/core/html/HTMLLinkElement.idl
[modify] https://crrev.com/1f18863cc9b2a5fe463671f3eb60de2f95bbf283/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp
[modify] https://crrev.com/1f18863cc9b2a5fe463671f3eb60de2f95bbf283/third_party/WebKit/Source/core/loader/LinkLoader.cpp
[modify] https://crrev.com/1f18863cc9b2a5fe463671f3eb60de2f95bbf283/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp

Comment 4 by y...@yoav.ws, Jun 3 2017

Status: Fixed (was: Assigned)

Sign in to add a comment