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

Issue 629420 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

Consider being less conservative with link rel preload (in particular the HTTP header flavor)

Project Member Reported by kenjibaheux@chromium.org, Jul 19 2016

Issue description

Today, requests for LINK rel=preload HTTP headers are blocked until the main thread parses the first chunk back from the off-thread parser.

Developers expect that the LINK rel=preload HTTP header would fire a request about when the first byte is received but in practice it is not the case.

Is the conservative approach of the provisional load warranted for preloads?
 
Do we mind evading memory cache here and just populating http cache? If so we could probably do this with semantics similar to link rel prefetch.

Otherwise we could probably at least *not* wait for AppCache! This is a trivial improvement that could be done today. See https://codereview.chromium.org/2165653004 for a first pass at this simple step.

Comment 2 by jochen@chromium.org, Jul 20 2016

the provisional load commits when the first byte is received. if we only fire preloads after the first chunk is parsed, something else is wrong

Comment 3 by y...@yoav.ws, Jul 20 2016

Preloads wait until the first chunk is tokenized (not parsed) in order to support `media` attribute based preloading. (meta viewport is detected and applied before preloads happen)

We could easily start preloading non-media preload headers right after the commit.
Owner: csharrison@chromium.org
Status: Assigned (was: Available)
May throw up a more complete patch here...
Project Member

Comment 5 by bugdroid1@chromium.org, Jul 22 2016

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

commit 7eacc60e1556444061f9f84bac4d82c34419a2ae
Author: csharrison <csharrison@chromium.org>
Date: Fri Jul 22 19:15:58 2016

Don't wait for AppCache for link rel preloads

The preload scanner currently waits for the Application Cache to be
initialized before sending out any preloads. This is less important for link
rel preloads, which are directives to send a fetch as soon as possible.

This patch bypasses the fetch queuing for these preloads.

For link preloads in headers, we can issue these as early as the commit
point (for those which don't have a media attribute).

BUG= 629420 

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

[add] https://crrev.com/7eacc60e1556444061f9f84bac4d82c34419a2ae/third_party/WebKit/LayoutTests/http/tests/preload/link_header_preload_on_commit.php
[modify] https://crrev.com/7eacc60e1556444061f9f84bac4d82c34419a2ae/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
[modify] https://crrev.com/7eacc60e1556444061f9f84bac4d82c34419a2ae/third_party/WebKit/Source/core/html/parser/PreloadRequest.h
[modify] https://crrev.com/7eacc60e1556444061f9f84bac4d82c34419a2ae/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
[modify] https://crrev.com/7eacc60e1556444061f9f84bac4d82c34419a2ae/third_party/WebKit/Source/core/loader/DocumentLoader.h
[modify] https://crrev.com/7eacc60e1556444061f9f84bac4d82c34419a2ae/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
[modify] https://crrev.com/7eacc60e1556444061f9f84bac4d82c34419a2ae/third_party/WebKit/Source/core/loader/FrameLoader.cpp
[modify] https://crrev.com/7eacc60e1556444061f9f84bac4d82c34419a2ae/third_party/WebKit/Source/core/loader/LinkLoader.cpp
[modify] https://crrev.com/7eacc60e1556444061f9f84bac4d82c34419a2ae/third_party/WebKit/Source/core/loader/LinkLoader.h

Status: Fixed (was: Assigned)
Let's mark this as fixed. I believe we can't get any better here without doing things in the browser process. After this patch:
 1. link rel preloads dont wait for appcache
 2. link rel preload headers only wait until commit
 3. link rel preload headers with media attributes are preloaded after the first bytes are tokenized

I'll open up another issue exploring if resource loads in general should go through app cache.

Sign in to add a comment