Closed Bug 1696392 Opened 4 years ago Closed 4 years ago

the media query doesn't work on preload

Categories

(Core :: Audio/Video, defect)

Firefox 86
defect

Tracking

()

RESOLVED DUPLICATE of bug 1598613
Tracking Status
firefox86 --- wontfix
firefox87 --- fixed
firefox88 --- fixed

People

(Reporter: r3nz_10, Unassigned)

Details

Attachments

(5 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36

Steps to reproduce:

Added the following in the HTML markup inside the head
<link rel="preload" href="url-mobile.png" as="image" media="(max-width: 599px)">
<link rel="preload" href="url-desktop.png" as="image" media="(min-width: 600px)">

Actual results:

Firefox is preloading both of the resources on desktop

Expected results:

Should only preload url-desktop.png

The Bugbug bot thinks this bug should belong to the 'Core::Audio/Video' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Audio/Video
Product: Firefox → Core
Attached file bug-1696392.html

I created a simple test and wasn't able to reproduce the issue. When I load this on desktop, the Network inspector shows only "280px-PNG_transparency_demonstration_1.png" getting fetched.

Attached image bug-1696392.png

If you see different behavior with the attached test case, or you can share a minimized test case that reproduces the erroneous behavior, please let us know. Otherwise, I'm guessing there may be references to both images somewhere else in your page which is forcing them to download. What do you see if you remove everything else and leave only the head links?

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Flags: needinfo?(r3nz_10)
Resolution: --- → WORKSFORME
Attached image loads-both-images.PNG

Using the HTML test you've provided, it shows that both images are being preloaded

Flags: needinfo?(r3nz_10)
Attached image console-warnings.PNG

And the console warnings does show the PNG_demo_Banana.png is getting ignored BUT it does say it is getting preloaded but not being used lol

Flags: needinfo?(jbauman)

I'm seeing different behavior locally between Nightly 88.0a1 (2021-02-26) and beta 87.0b5 (both show only one image loaded) and 86.0 (release), which loads both.

What Firefox version are you reproducing this with? The User Agent string from comment 1:

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36

Doesn't look like a normal Firefox UA and doesn't include a Firefox version. It looks like it's from Chrome. Here are the UA strings I see for my local versions:

Nightly 88.0a1 (2021-02-26): Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:88.0) Gecko/20100101 Firefox/88.0
beta 87.0b5: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:87.0) Gecko/20100101 Firefox/87.0
86.0 (release): Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:86.0) Gecko/20100101 Firefox/86.0

Can you let me know what the behavior is for you on Firefox 86 and Nightly (88)?

Flags: needinfo?(jbauman) → needinfo?(r3nz_10)
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: WORKSFORME → ---

Thanks for looking in it and apologies for the confusion. I have stated that I the issue is happening on FireFox 86 in the Categories when I reported it.

Yes, I am getting the same behaviour as you:
Nightly 88.0a1 - Loads 1
Firefox 86 - Loads 2
Firefox Beta 87.0b7 - Loads 1

The issue seems to be on Firefox 86

Flags: needinfo?(r3nz_10) → needinfo?(jbauman)

Ok, I'm not sure what changed, but since it seems to be fixed as of 87, I'm going to resolve this. Thanks for the report and following up with the additional info!

Status: REOPENED → RESOLVED
Closed: 4 years ago4 years ago
Flags: needinfo?(jbauman)
Resolution: --- → FIXED

Emilio, is this expected? Related to bug 1626997 perhaps?

Flags: needinfo?(emilio)

I fixed this in bug 1598613. The speculative loader wasn't accounting for media correctly.

Flags: needinfo?(emilio)
Resolution: FIXED → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: