Closed Bug 668178 Opened 13 years ago Closed 13 years ago

Webfonts requested twice when domContentLoaded is handled

Categories

(Core :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: mail, Unassigned)

Details

Attachments

(1 file)

Attached file Reproduction files
In current releases of Firefox (at least 4 and 5) I am encoutering a bug that causes fonts linked through the @font-face CSS technique to be requested twice by the browser. This can cause a flash of text being re-rendered on larger pages with more resources, although very simple pages seem fine. This behaviour does not occur on Chrome, IE9, and Opera. To reproduce this issue, the following is needed: * A HTML page with the following elements: * A link to an external CSS stylesheet that sets up the @font-face declaration. * A bit of JavaScript that listens to the DOMContentLoaded event, and some code to execute in the handler function, such as alert('test'). When such a file is loaded and its HTTP requests inspected with a tool like Firebug, the font-files are seen twice in the request list, once before and once after DOMContentLoaded. At first I suspected jQuery (which listent to the DOMContentLoaded event as well), but reducing the reproduction case to just the event handler seems to rule it out as the culprit. I have attached a zip-archive with a minimal reproduction case. The file "twice.html" requests the WOFF font file twice. For comparison, the "once.html" file places the exact same CSS declaration in-line, but does NOT trigger the double load. I suspect that the files need to be accessed over HTTP for this reproduction to work. I have also uploaded the files in case someone wants to try to reproduce this behaviour directly: This loads the web-font once: http://jeroenhoek.nl/firefox/once.html This requests it twice, the second time after the JavaScript alert triggered by the DOMContentLoaded event handler: http://jeroenhoek.nl/firefox/twice.html The attached zip-archive includes screenshots from Firebug's Net panel illustrating the issue.
Attachment #542768 - Attachment mime type: application/octet-stream → application/x-gzip
I can't reproduce this. When I load http://jeroenhoek.nl/firefox/twice.html in Firefox 5, there is only one request made for <http://jeroenhoek.nl/firefox/dejavu_sans/dejavusans-webfont.woff>. Same for Firefox 4 and a nightly. Jeroen, can you reproduce this in safe mode?
Now that is interesting. Testing in safe mode and looking at the connections with Ettercap rather than the Firebug extension, I can only reproduce the issue when Firebug is active for that website. Firefox seems to be in the clear. As a web-developer I use Firebug almost without a second thought, I didn't consider that the very tool I used to diagnose the issue was causing it. This bug should probably be marked NOTABUG. Thank you for your help in tracking this down.
No problem. Thanks for retesting! Worth reporting this to the Firebug folks, though. http://code.google.com/p/fbug/issues/list
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
No longer depends on: 735561
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: