Open Bug 1650507 Opened 5 years ago Updated 3 years ago

CSS imports do not show in the network inspector

Categories

(DevTools :: Netmonitor, defect, P2)

78 Branch
defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: randomrandom12-ads, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

15.73 KB, image/png
Details
Attached image no.png

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0

Steps to reproduce:

HTML:

<!DOCTYPE html>
<html>
<head>
  <style type="text/css">@\import "test.css";</style>
</head>

<body>
</body>

CSS in 'test.css':

body {
    background-color: red;
}

The whole page should be red if test.css is used

Actual results:

test.css does not appear in the network inspector

Expected results:

In the network inspector, test.css should show as one of the entries. This worked in prior versions of FireFox.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Inspector: Rules
Product: Firefox → DevTools
Component: Inspector: Rules → Netmonitor

Thanks for reporting!
I can reproduce.

Important Note:

  • It seems to only happen on localhost.
  • Also it only happens for requests from the cache, (With Disable cache on, it works.)
Severity: -- → S3
Priority: -- → P2

I can reproduce this on other websites too,not just localhost. Here is a demo. https://ffxdemo.azurewebsites.net/

It doesn't always happen, but if you refresh enough times, sometimes it won't show. As you mentioned, disabling the cache will make it show.

Hi Daragana,
Wondering if you could help out with this.
I had quick look into it, we do not seem to get an event from the platform when the CSS request is from the cache.
https://searchfox.org/mozilla-central/rev/9b282b34b5aa0f836beb735656c55efb2cc4c617/devtools/server/actors/network-monitor/network-observer.js#472

Thanks

Flags: needinfo?(dd.mozilla)

Can it be that this is speculatively loaded early and that is why you do not get the notification? That it is served from cssloader (I do not know all the details about this)

Flags: needinfo?(dd.mozilla)

I would like to try working on this. I was thinking of trying to see where the css is loaded from and seeing if I can try firing an event when it is loaded from cache. I don't know the details about how the whole file loading/caching process works but I would like to give it a go. If anyone has any recommended starting points they would be much appreciated.

I can reproduce this bug also using <link> tag, when the page is loaded form cache.
Example:

<head>
   <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: