Closed Bug 1462850 Opened 2 years ago Closed 2 years ago

[wpt-sync] Sync PR 11082 - [css-fonts] Avoid race condition

Categories

(Core :: Layout: Text and Fonts, enhancement, P4)

enhancement

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: wptsync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 11082 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/w3c/web-platform-tests/pull/11082
Details from upstream follow.

Mike Pennisi <mike@mikepennisi.com> wrote:
>  [css-fonts] Avoid race condition
>  
>  @gsnedders @Ms2ger I'm not certain that my rationale is sound, so I've over-explained a bit to help you show me if/where I've gone wrong.
>  
>  ---
>  
>  The modified test primes the document's font source by declaring a
>  `font-face` rule and deferring tests until the font has been loaded. The
>  sub-tests are expressed in terms of a FontFace which is dynamically
>  generated via a `<style>` tag but which shares the same URL.
>  
>  Prior to this patch, the test assumed that the declaration of the second
>  FontFace would be reflected in a synchronously-triggered reflow (via
>  access of the `offsetWidth` property). This is not guaranteed because
>  each parse of a `<style>` element creates a new FontFace object [1] which
>  must be loaded [2] with the potentially CORS-enabled fetch method of the
>  HTML specification [3].
>  
>  Practically speaking, this caused the Firefox and Chrome browsers to
>  consistently fail the sub-tests.
>  
>  Update the test to define a unique FontFace for every subtest and to
>  explicitly wait for it to be available for rendering. Annotate the test
>  as "long" to accomodate the additional time spent waiting.
>  
>  [1] > A CSS @font-face rule automatically defines a corresponding
>      > FontFace object, which is automatically placed in the document’s
>      > font source when the rule is parsed.
>  
>      https://www.w3.org/TR/css-font-loading-3/#font-face-css-connection
>  
>  [2] > When a user-agent needs to load a font face, it must do so by
>      > calling the load() method of the corresponding FontFace object.
>  
>      https://www.w3.org/TR/css-font-loading-3/#font-face-set-css
>  
>  [3] > For font loads, user agents must use the potentially CORS-enabled
>      > fetch method defined by the [HTML5] specification for URL's
>      > defined within @font-face rules.
>  
>      https://www.w3.org/TR/css-fonts-3/#font-fetching-requirements
Component: web-platform-tests → Layout: Text
Product: Testing → Core
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Failed to get results from try push
Pushed by wptsync@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/f2058e8755b3
[wpt PR 11082] - [css-fonts] Avoid race condition, a=testonly
https://hg.mozilla.org/integration/mozilla-inbound/rev/d9c00afaa47c
[wpt PR 11082] - Update wpt metadata, a=testonly
https://hg.mozilla.org/mozilla-central/rev/f2058e8755b3
https://hg.mozilla.org/mozilla-central/rev/d9c00afaa47c
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.