Closed Bug 1603542 Opened 5 years ago Closed 4 years ago

[rel=preload] Log a warning when preloaded resources are not used

Categories

(DevTools :: Netmonitor, enhancement, P1)

enhancement

Tracking

(firefox79 fixed)

RESOLVED FIXED
Firefox 79
Tracking Status
firefox79 --- fixed

People

(Reporter: Harald, Assigned: mayhemer)

References

(Blocks 3 open bugs)

Details

(Whiteboard: [necko-triaged])

Attachments

(3 files, 1 obsolete file)

Suggestion from rel=”preload” performance consultation.

Chrome warns on 3sec but maybe a network-dependent threshold might adapt better to slow connections.

Priority: -- → P3
Whiteboard: [necko-triaged]

Related, this would also be a useful warning to show in Network panel.

Moving to the right component. Necko parts to provide the information can be done here or in a separate bug.

Component: Networking → Netmonitor
Depends on: 1618287
Product: Core → DevTools
Summary: Log a warning when preloaded resources are not used → [rel=preload] Log a warning when preloaded resources are not used

Would be nice to have this now.

Priority: P3 → P1

Not sure if we should/could do this in the same bug, but it would be good to have this holistically 1) as console warning and 2) as notification for a request to show a warning flag on the request in the Network panel.

(In reply to :Harald Kirschner :digitarald from comment #4)

Not sure if we should/could do this in the same bug, but it would be good to have this holistically 1) as console warning and 2) as notification for a request to show a warning flag on the request in the Network panel.

Because of a time press, I will only write a patch for console warning.

Assignee: nobody → honzab.moz
Status: NEW → ASSIGNED
Blocks: 1640717
Pushed by honzab.moz@firemni.cz: https://hg.mozilla.org/integration/autoland/rev/c3dcacdd97c4 Log a warning in the web console when a preloaded resource is not used, r=Harald https://hg.mozilla.org/integration/autoland/rev/cc70c96b63e0 Properly mark CSS preloads as used when processing stylesheet tags or imports, r=emilio

Emilio, this used to work, can you please look at it or guide me what to do?

(see the previous comment)

Flags: needinfo?(honzab.moz) → needinfo?(emilio)

So here's a reduced test-case for example:

<!doctype html>
<link rel=preload href=a.css>
<link rel=stylesheet href=b.css>
<script>
  console.log("foo");
</script>
<link rel=stylesheet href=a.css>
<div>Foo</div>

(Neither a.css or b.css need to exist)

The issue is that we don't store sheets in the cache if the load failed. We could change it, but other than that I think that the best option for now is removing the assertion. A bit sad :/

Flags: needinfo?(emilio)

For the record, this is the stylesheet that's failing to load: https://searchfox.org/mozilla-central/rev/eef39502e08bcd3c40573c65a6827828dce4a032/toolkit/content/plugins.html#12

Because a FILE_NOT_FOUND error, which is expected afaict (we have just one, and it's chrome://global/content/plugins.css)

Thanks, Emilio. I will remove that assertion then and also incorporate your followup patch in my patch (to save some merging).

Attachment #9157327 - Attachment is obsolete: true
Pushed by honzab.moz@firemni.cz: https://hg.mozilla.org/integration/autoland/rev/754e4ddef9b9 Log a warning in the web console when a preloaded resource is not used, r=Harald https://hg.mozilla.org/integration/autoland/rev/990dce4af7cf Properly mark CSS preloads as used when processing stylesheet tags or imports, r=emilio
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 79
Blocks: 1646983
Blocks: 1652755
No longer blocks: 1646983
Regressions: 1658551
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: