Closed Bug 646391 Opened 13 years ago Closed 13 years ago

All font files are re-requested when stylesheets containing new @font-face rules are added

Categories

(Firefox :: General, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: andyhume, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27
Build Identifier: 4.0

When dynamically adding new stylesheets which contain @font-face rules to the page, all hosted fonts are re-requested and potentially downloaded again.

In other words, Firefox won't download a new font file without re-requesting all previously downloaded font files.

Reproducible: Always

Steps to Reproduce:
1. Load the specified URL above.
2. Notice that on initial page load a CSS file containing 1 @font-face rule is downloaded.
3. Notice that this font is required to render an h1 so the font file (Woff) is downloaded.
4. Click 'Show Linear Ultra Bold Oblique' and notice a link to a new stylesheet is added to the DOM.
5. Notice that this new stylesheet containing a new @font-face rule is downloaded.
6. Notice that this font is required to render an h2 so the new font file is downloaded.
7. Notice that the original Woff downloaded in step 3 is requested again and potentially downloaded again.

This behaviour can be repeated when clicking 'Show Egyptienne URW Extra Light'. In this case the previous 2 fonts will both be requested again.
Actual Results:  
Fonts that have already been downloaded and shown on the page, are re-requested for no clear reason. 

Expected Results:  
Fonts that have already been downloaded and rendered to the page should NOT be re-requested.

The example page is using a font hosting service called Fontdeck which does not allow for caching in the browser. Aggressively caching the fonts would help mitigate this issue, but this is still a behaviour that seems undesirable and is not exhibited in the latest versions of other browsers.
I think this is another manifestation of bug 633299, and should be fixed by the patch there. Marking dependent rather than duplicate for now in case there turns out to be more to it in this example.
Depends on: 633299
Works for me on Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.2a1pre) Gecko/20110410 Firefox/4.2a1pre

Also, could you see if the issue occurs if using Firefox in safe mode:
http://support.mozilla.com/kb/Safe+Mode

How about with a new, empty testing profile? (Don't install any addons into it)
http://support.mozilla.com/kb/Basic+Troubleshooting#w_8-make-a-new-profile
Do you still see this issue in current Nightly builds? (I think it should have been fixed in bug 633299.)

I expect you'll still see a flicker (and potentially a re-download) if you repeatedly click the "Show Linear Ultra Bold Oblique" link, because this adds a new stylesheet every time, even if it was already being shown. So in this case a new @font-face rule is being added (even though it happens to be identical to an existing one). You should avoid doing this if you want to optimize the user experience.
Reporter, do you have anything new to add about this issue?
Setting resolution to Resolved WFM. Reporter, if you have anything new to add
about this issue, feel free to reopen this bug
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.