Bug 229839 - FontFaceSet.status needs to react to style changes
Summary: FontFaceSet.status needs to react to style changes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on:
Blocks: 229850 229911 229975
  Show dependency treegraph
 
Reported: 2021-09-02 16:21 PDT by Myles C. Maxfield
Modified: 2021-09-07 23:52 PDT (History)
10 users (show)

See Also:


Attachments
Patch (4.76 KB, patch)
2021-09-02 16:23 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (4.42 KB, patch)
2021-09-02 19:13 PDT, Myles C. Maxfield
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2021-09-02 16:21:10 PDT
FontFaceSet.status needs to react to style changes
Comment 1 Myles C. Maxfield 2021-09-02 16:23:33 PDT
Created attachment 437212 [details]
Patch
Comment 2 Myles C. Maxfield 2021-09-02 18:50:02 PDT
Comment on attachment 437212 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=437212&action=review

> LayoutTests/ChangeLog:8
> +        This is not a WPT test because it requires webfont/slow-ahem-loading.cgi.

Oh, I think I can actually turn this into a WPT test
Comment 3 Myles C. Maxfield 2021-09-02 18:55:10 PDT
Comment on attachment 437212 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=437212&action=review

>> LayoutTests/ChangeLog:8
>> +        This is not a WPT test because it requires webfont/slow-ahem-loading.cgi.
> 
> Oh, I think I can actually turn this into a WPT test

Oh, no, I can't, because the font may be cached, which will make the status update synchronously. So this needs internals.clearMemoryCache().

But I can at least make it less racey.
Comment 4 Myles C. Maxfield 2021-09-02 19:13:35 PDT
Created attachment 437233 [details]
Patch
Comment 5 Sam Weinig 2021-09-03 09:43:17 PDT
Comment on attachment 437233 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=437233&action=review

> Source/WebCore/css/FontFaceSet.cpp:191
> +    auto protect = m_backing;

Hm. This clearly does the right thing, but I usually like to ensure we are actually in a Ref or RefPtr when using the protect idiom by doing something like:

Ref protect = backing;

just to make sure that if m_backing ever changes type this is still doing what we expect.

Since m_backing is a Ref, I guess the posibilities here are that either 'this' got deleted or m_backing got replaced and the original value got deleted. Would be interesting to try and add tests for either of those cases if possible.
Comment 6 Myles C. Maxfield 2021-09-03 12:51:51 PDT
Comment on attachment 437233 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=437233&action=review

>> Source/WebCore/css/FontFaceSet.cpp:191
>> +    auto protect = m_backing;
> 
> Hm. This clearly does the right thing, but I usually like to ensure we are actually in a Ref or RefPtr when using the protect idiom by doing something like:
> 
> Ref protect = backing;
> 
> just to make sure that if m_backing ever changes type this is still doing what we expect.
> 
> Since m_backing is a Ref, I guess the posibilities here are that either 'this' got deleted or m_backing got replaced and the original value got deleted. Would be interesting to try and add tests for either of those cases if possible.

Yeah. I'll land this with "Ref" instead of "auto" and I'll try to come up with a test that exercises the deletion problem in a follow-up.
Comment 7 Myles C. Maxfield 2021-09-03 13:03:31 PDT
Committed r282015 (241320@main): <https://commits.webkit.org/241320@main>
Comment 8 Radar WebKit Bug Importer 2021-09-03 13:04:22 PDT
<rdar://problem/82735622>
Comment 9 Fujii Hironori 2021-09-05 12:50:48 PDT
fast/text/FontFaceSet-status-after-style-update.html is flaky.
https://results.webkit.org/?suite=layout-tests&test=fast%2Ftext%2FFontFaceSet-status-after-style-update.html
Comment 10 Carlos Alberto Lopez Perez 2021-09-06 16:49:44 PDT
(In reply to Fujii Hironori from comment #9)
> fast/text/FontFaceSet-status-after-style-update.html is flaky.
> https://results.webkit.org/?suite=layout-
> tests&test=fast%2Ftext%2FFontFaceSet-status-after-style-update.html

Reported it on bug 229975