New issue
Advanced search Search tips

Issue 750422 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Jul 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

DevTools: Unused preloaded resource warning is not suppressed when console.log loads resource

Reported by nesmallt...@gmail.com, Jul 29 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3167.0 Safari/537.36

Steps to reproduce the problem:
1. use <link rel="preload" href="foo.com/bar.jpg" as="image" />
2. and then use console.log(
    '%c   ',
      background-image:url('foo.com/bar.jpg'); 
   );
3. there will appear a warning to tell us we don't use the preloaded resource

What is the expected behavior?
no warnings,

see https://github.com/whatwg/html/issues/2853 for more details.

What went wrong?
appear warning

Did this work before? N/A 

Chrome version: 62.0.3167.0  Channel: canary
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 26.0 r0
 
Owner: l...@chromium.org
Status: Assigned (was: Unconfirmed)

Comment 2 by l...@chromium.org, Jul 31 2017

Status: WontFix (was: Assigned)
Summary: DevTools: Unused preloaded resource warning is not suppressed when console.log loads resource (was: use preloaded resource in console will not work)
Thanks for the report.  It does seem confusing that DevTools warns the developer that an image is unused even though the resource can be clearly seen in the console.  However, I believe this is working as intended.

Console.log behavior with '%c' is not specified, as far as I'm aware.  For Chrome's implementation, specifying a background image tells the DevTools-context to load the image, not the inspected-page-context.  The request for the image fired by the console.log('...') doesn't actually happen in the inspected page, which is why it doesn't suppress the warning.

DevTools itself is a webapp with HTML, and it's capable of using rel="preload".  We can imagine evaluating the `console.log('..image..')` in this DevTools console.  If one opens a new DevTools to inspect the original DevTools instance, I would expect that the new DevTools' console would report the 'unused-preload' warning if the first DevTools instance violated the rule in its context.


That said, we are currently working on better presenting and organizing console violations/warnings that are more useful and not distracting, and hopefully it will help reduce confusing situations like this :)

Please feel free to ask further questions.
Thanks for your clarification! Can I say that in the future the situation I describe will get improved even make it can use rel="preload"?

Comment 4 by l...@chromium.org, Aug 3 2017

No, for this case, the warning is still going to be presented in the future.  But we plan on bringing easier options to group warnings like this together, in some UX that should be less cluttered.
Ok, got it.Thanks for your clarification!

Sign in to add a comment