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

Issue 878225 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Sep 4
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Feature



Sign in to add a comment

Provide a user-friendly warning for link rel=preload matching failure

Project Member Reported by yhirano@chromium.org, Aug 28

Issue description

There have been many bugs / requests / questions (see  issue 786943 , issue 735014 and  issue 850099  for example) saying “link rel=preload doesn’t work” (e.g., I placed a link rel=preload and then made an actual request but both requests went to network). Actually it works and the misbehavior is due to mis-configuration, but figuring out the cause is hard. We could mitigate the pain by printing a console log when a request whose URL is equal to one of preloaded requests but they don’t match for some reason.
 
Cc: y...@yoav.ws addyo@chromium.org

Comment 2 by y...@yoav.ws, Aug 28

We have a warning in place that fires 3 seconds after onload if a preloaded resource was not yet used: https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/frame/local_dom_window.cc?type=cs&q=%22was+preloaded+using%22&sq=package:chromium&g=0&l=1439

Is the warning not enough? Or was it not firing in the cases you've seen?
But the existing warning doesn't say why it wasn't used, and finding the reason is often hard.

Comment 4 by y...@yoav.ws, Aug 28

OK, so that falls into the "not enough" bucket
 
In order to support that, we'd need to:
* Keep track of invalidation reasons in ResourceFetcher::DetermineRevalidationPolicy and friends and keep that state on the preloaded Resource which *was not* reused.
* Expose that in the warning.

Seems feasible and I agree it would be helpful
I think it's enough to print the message when we find there is a close-to-match request, and we don't have to remember that.


Comment 6 by y...@yoav.ws, Aug 28

OK, as long as that won't be too spammy
Project Member

Comment 7 by bugdroid1@chromium.org, Aug 29

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

commit cceb3d65bc30254740a177f91582fb482a84d3e3
Author: Yutaka Hirano <yhirano@chromium.org>
Date: Wed Aug 29 12:16:47 2018

Cleanup Resource reuse logic

 - A resource with kDoNotBufferData is never stored in the memory cache
   or the preload cache, so replace a if-statement with a DCHECK.
 - A request with a non-cacheable method should not be cached in the
   first place.
 - Move checks for HTTP method and HTTP body to Resource from
   RawResource.
 - The check for AllowStoredCredentials is duplicated, so remove it
   from RawResource::CanReuse.

Bug:  878225 
Change-Id: Ic4e72c00de0acbfcd91a3186abb04c8191281029
Reviewed-on: https://chromium-review.googlesource.com/1192376
Reviewed-by: Yoav Weiss <yoav@yoav.ws>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587083}
[modify] https://crrev.com/cceb3d65bc30254740a177f91582fb482a84d3e3/third_party/blink/renderer/platform/loader/fetch/raw_resource.cc
[modify] https://crrev.com/cceb3d65bc30254740a177f91582fb482a84d3e3/third_party/blink/renderer/platform/loader/fetch/resource.cc
[modify] https://crrev.com/cceb3d65bc30254740a177f91582fb482a84d3e3/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc

Project Member

Comment 8 by bugdroid1@chromium.org, Aug 30

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

commit 544a2f36c0c6def26898c395e018aaf668e6af19
Author: Yutaka Hirano <yhirano@chromium.org>
Date: Thu Aug 30 09:51:25 2018

Print a warning message when a close-to-matching preload is found

It is often hard to point the exact cause why a preload is not used
for a request |r|. This CL adds a warning message when there is a
preloaded request for |r|'s URL and type, but somehow not used, with
the reason.

Bug:  878225 
Change-Id: Ib4ed4655cd9a964c3d60058f8a330b1c098c93b6
Reviewed-on: https://chromium-review.googlesource.com/1193163
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Yoav Weiss <yoav@yoav.ws>
Cr-Commit-Position: refs/heads/master@{#587499}
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/blob-request-expected.txt
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/blob-request.html
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/integrity-mismatch-expected.txt
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/integrity-mismatch.html
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/keepalive-expected.txt
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/keepalive.html
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/request-credentials-mode-expected.txt
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/request-credentials-mode.html
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/request-headers-expected.txt
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/request-headers.html
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/request-method-expected.txt
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/request-method.html
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/request-mode-expected.txt
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/request-mode.html
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/resources/hello.txt
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/resources/script.js
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/sync-request-expected.txt
[add] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/WebKit/LayoutTests/http/tests/preload/warning/sync-request.html
[modify] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/blink/renderer/core/loader/base_fetch_context.cc
[modify] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/blink/renderer/core/loader/base_fetch_context.h
[modify] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/blink/renderer/core/loader/resource/image_resource.cc
[modify] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/blink/renderer/core/loader/resource/image_resource.h
[modify] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/blink/renderer/platform/loader/fetch/fetch_context.cc
[modify] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/blink/renderer/platform/loader/fetch/fetch_context.h
[modify] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/blink/renderer/platform/loader/fetch/raw_resource.cc
[modify] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/blink/renderer/platform/loader/fetch/raw_resource.h
[modify] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/blink/renderer/platform/loader/fetch/raw_resource_test.cc
[modify] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/blink/renderer/platform/loader/fetch/resource.cc
[modify] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/blink/renderer/platform/loader/fetch/resource.h
[modify] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc
[modify] https://crrev.com/544a2f36c0c6def26898c395e018aaf668e6af19/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h

Status: Fixed (was: Assigned)

Sign in to add a comment