Firefox preloads resources that don't match the media attribute
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
People
(Reporter: seth, Unassigned)
References
(Blocks 1 open bug)
Details
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0
Steps to reproduce:
Run the following repo:
https://github.com/SethFalco/firefox-bug-question-mark
I'm also an adapted version for GitHub Pages here:
https://sethfalco.github.io/Firefox/
- Contains 3
link
elements that preload in thehead
at various media queries. - Contains a
picture
with 3source
elements that match thelink
elements in thehead
and 1img
element.
To reproduce:
- Open a new private browser.
- Open inspect element and responsive design mode before visiting the website.
- Set the size to iPad Mini or 768x1024
- Access the website for the first time
- Observe that it preloads more than it should
- Refresh
- Observe that it behaves as expected
Actual results:
The first time the site is visited, it preloads images that aren't matched by the media
attribute.
After refreshing the page, or visiting later, even if cookies/cache is cleared, it will behave as expected and not preload additional resources.
Expected results:
It should only preload resources where the media
attribute matches. In the case of the minimal example above, when following those steps the 1080p/4k image should not be preloaded.
The issue can be reproduced by closing the private-browser session and starting a new one.*
Updated•3 years ago
|
Comment 2•3 years ago
•
|
||
I am not sure how this should behave on a private browser window. Does our code differentiate a private browser in preload cases?
FWIW I wasn't seeing the issue when trying to reproduce it.
Comment 3•2 years ago
|
||
I couldn't reproduce this either on the current Nightly build. Following comment 0 I get the following PreloadImage calls (0 or 1 is for "did the media match", and thus "do we preload the image"):
PreloadImage(https://sethfalco.github.io/Firefox/2160.webp, 0)
PreloadImage(https://sethfalco.github.io/Firefox/706.webp, 1)
PreloadImage(https://sethfalco.github.io/Firefox/362.webp, 0)
PreloadImage(https://sethfalco.github.io/Firefox/706.webp, 1)
So we only preload 706.webp which is the expected thing to do for that viewport size afaict. Seth, does this repro on Nightly for you?
Re. comment 2, there should be no behavior difference for private windows vs. non private. However when the last private window is exited we clean up the private-mode image cache iirc, so it makes it easier to reproduce by not requiring a full restart.
Updated•2 years ago
|
Comment 4•2 years ago
|
||
Close per comment 2 and comment 3.
Dear reporter, please feel free to reopen it if you still see this issue and got a chance to get back here. Thanks!
Sorry for coming back to this so late. I did just try to reproduce the issue again, but I'm unable to.
I'm not sure what was wrong before, but in any case, it's fine to keep this closed.
Just updating the ticket to clear the needinfo status.
Description
•