[Webkit-unassigned] [Bug 225790] New: document.fonts.ready is sometimes still resolved too quickly

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 13 16:50:12 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=225790

            Bug ID: 225790
           Summary: document.fonts.ready is sometimes still resolved too
                    quickly
           Product: WebKit
           Version: WebKit Local Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: CSS
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: heycam at apple.com
                CC: fred.wang at free.fr, mmaxfield at apple.com

Here is a test: https://mcc.id.au/2021/font-load.html

If I open this in a debug MiniBrowser, I get this output:

FontFaceSet.status in onload:   loaded
FontFace.status in onload:      unloaded
FontFaceSet.status after ready: loading
FontFace.status after ready:    loading

So the ready promise was initially resolved, and then at some point after the document.fonts.ready.then() call, it was replaced with a fresh, unresolved promise, so that once we're in the promise handler, the font has started loading.

In a regular Safari, I occasionally get this output, but usually I get this (more expected) output:

FontFaceSet.status in onload:   loaded
FontFace.status in onload:      unloaded
FontFaceSet.status after ready: loaded
FontFace.status after ready:    loaded

Firefox and Chrome both delay the load event for font loads from style sheets, and so we get different output still.  Firefox:

FontFaceSet.status in onload:   loaded
FontFace.status in onload:      loaded
FontFaceSet.status after ready: loaded
FontFace.status after ready:    loaded

Chrome:

FontFaceSet.status in onload:   loading
FontFace.status in onload:      loaded
FontFaceSet.status after ready: loaded
FontFace.status after ready:    loaded

(Chrome's makes a little less sense to me, with the FontFaceSet still loading but the only FontFace in it loaded.)

The upshot of this is that if relying on font loads to have been triggered by content already in the document by the time of the load event, document.fonts.ready.then() is not sufficient in Safari to wait for them.  I'm working around this in bug 225728 for some MathML tests.

I'm not even sure though that WebKit's behavior here violates the spec.  But it probably is a compat problem.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210513/4e778fd0/attachment.htm>


More information about the webkit-unassigned mailing list