Closed Bug 1852587 Opened 1 years ago Closed 1 year ago

Firefox still loads some fonts when downloadable fonts disabled

Categories

(Core :: Networking, defect, P2)

Firefox 117
x86_64
Linux
defect

Tracking

()

VERIFIED FIXED
119 Branch
Tracking Status
firefox119 --- verified
firefox120 --- verified

People

(Reporter: seth, Assigned: jfkthame)

References

Details

(Whiteboard: [necko-triaged])

Attachments

(2 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0

Steps to reproduce:

  1. Navigate to about:config
  2. Set gfx.downloadable_fonts.enabled to false
  3. Open the network tab and filter by Font requests
  4. Visit a website like flathub.org or freecodecamp.org

Actual results:

Fonts are being downloaded, visible from the network tab.

On most sites they are ignored correctly, it's unclear to me why it's behaving differently on some.

Expected results:

When gfx.downloadable_fonts.enabled is set to false, font declarations in the HTML or via @font-face are meant to be ignored afaik.

OS: Unspecified → Linux
Hardware: Unspecified → x86_64

The Bugbug bot thinks this bug should belong to the 'DevTools::Netmonitor' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Netmonitor
Product: Firefox → DevTools

Thanks for reporting i tested on freecodecamp.org. I can confirm that certain fonts get ignored and not others. One obvious difference is initiators. I'll investigate this a little bit more.

Thanks for reporting i tested on freecodecamp.org. I can confirm that certain fonts get ignored and not others. One obvious difference is initiators

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(hmanilla)
Flags: needinfo?(hmanilla)
Whiteboard: [devtools-triage]

Some more context that may be valuable. On Firefox 117, it loads the font but doesn't actually use it.
On Firefox ESR 115 it actually uses the fonts too, despite downloadable fonts being disabled.

Oh actually, upon double-checking this, that is not the case.
I'm unable to remove/delete comments, but please ignore what I previously reported with Firefox ESR using the font.

It appears in Firefox ESR it does not use the font, I probably just messed up while testing.

In general, updating preferences in about:config is not recommended for end-users, unless this is exposed by some UI or recommended in one of our documentations.

Brad: do you or someone else in the Graphics team know what is the expected behavior when gfx.downloadable_fonts.enabled is set to false? Should it prevent from downloading the fonts, or only prevent using it.

Also the preference is quite old, and has defaulted to true for a while. Do we still want to expose it?

Flags: needinfo?(bwerth)
Whiteboard: [devtools-triage]

There is a different setting in the UI in about:preferencesAllow pages to choose their own fonts, instead of your selections above.

I did not use that one as the font files are still downloaded, so a blocking request which only serves to block rendering of the page. I assume there are some differences relative to gfx.downloadable_fonts.enabled, for example, icon fonts actually work the setting exposed in about:preferences.

If about:configgfx.downloadable_fonts.enabled is deprecated or will be removed, then I can use the one exposed in about:preferences paired with a uBlock Origin filter to block fonts from third-party servers like Google Fonts instead, perhaps.

Just wanted to share why I'm using it, but I won't fuss if it's removed.

(In reply to Julian Descottes [:jdescottes] from comment #6)

Brad: do you or someone else in the Graphics team know what is the expected behavior when gfx.downloadable_fonts.enabled is set to false? Should it prevent from downloading the fonts, or only prevent using it.

Also the preference is quite old, and has defaulted to true for a while. Do we still want to expose it?

Jonathan, can you give guidance on how we use this pref?

Flags: needinfo?(bwerth) → needinfo?(jfkthame)

This pref was originally designed, I think, to effectively block @font-face rules from being used. If it's disabled, this code block will not execute, and any @font-face rules present in the document (stylesheet) won't actually contribute to the "user font set" that layout uses, and that in turn triggers loading of the actual resources.

What I suspect is happening here, though, is that the fonts are being inserted into the font set via the CSS Font Loading API, rather than from @font-face rules, and we don't check this pref in that case. (Note that I haven't confirmed this directly, as the freecodecamp.org site looks like a huge and complex mass of stuff.... so for now it's just a theory.)

Probably it'd make sense to also block the Font Loading API if this pref is disabled. (Not to throw an error or anything, most likely, as that'd break sites; just make it a no-op.)

Flags: needinfo?(jfkthame)

Hmm, another possibility -- and I think this might be what's happening in the freecodecamp case -- is that these downloads are being triggered by a <link rel=preload ....> that the site uses to try and optimize rendering. AFAICS they're not actually being used on the page when the pref is disabled, but if there are preload links, that still causes the resources to get downloaded.

Component: Netmonitor → Networking
Product: DevTools → Core
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged]
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/93cbcb20dcb6 Disable font preloads if the downloadable_fonts pref is turned off. r=necko-reviewers,kershaw
See Also: → 1853116
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 119 Branch
QA Whiteboard: [qa-119b-p2]

Reproducible on a 2023-09-11 Nightly build on Ubuntu 22.
Verified as fixed on Nightly 120.0a1(20231018094117) and Firefox 119.0(build ID: 20231019122658) on Ubuntu 22, macOS 12, Windows 10.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-119b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: