Bug 194251 - Some fonts never load, causing fallback text to be rendered instead
Summary: Some fonts never load, causing fallback text to be rendered instead
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-02-04 16:22 PST by Myles C. Maxfield
Modified: 2022-02-19 08:15 PST (History)
5 users (show)

See Also:


Attachments
WIP (23.97 KB, patch)
2019-02-04 16:22 PST, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews202 for win-future (133.59 KB, application/zip)
2019-02-04 19:01 PST, EWS Watchlist
no flags Details
WIP (5.23 KB, patch)
2019-04-01 19:55 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (5.68 KB, patch)
2019-04-01 19:59 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (9.56 KB, patch)
2019-04-02 14:16 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (9.63 KB, patch)
2019-04-02 14:16 PDT, Myles C. Maxfield
no flags 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 2019-02-04 16:22:16 PST
Add lots of fonts logging
Comment 1 Myles C. Maxfield 2019-02-04 16:22:33 PST
Created attachment 361122 [details]
WIP
Comment 2 EWS Watchlist 2019-02-04 16:25:22 PST
Attachment 361122 [details] did not pass style-queue:


ERROR: Source/WebCore/css/CSSFontSelector.cpp:126:  One line control clauses should not use braces.  [whitespace/braces] [4]
ERROR: Source/WebCore/css/CSSFontSelector.cpp:148:  One line control clauses should not use braces.  [whitespace/braces] [4]
ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
Total errors found: 3 in 9 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 EWS Watchlist 2019-02-04 19:01:24 PST
Comment on attachment 361122 [details]
WIP

Attachment 361122 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/11034034

Number of test failures exceeded the failure limit.
Comment 4 EWS Watchlist 2019-02-04 19:01:25 PST
Created attachment 361150 [details]
Archive of layout-test-results from ews202 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews202  Port: win-future  Platform: CYGWIN_NT-6.1-2.10.0-0.325-5-3-x86_64-64bit
Comment 5 Myles C. Maxfield 2019-03-26 10:03:08 PDT
CachedResource::load: Failed security check -- state is provisional


#0	0x0000000108b31c6d in WebCore::CSSFontFaceSource::fontLoaded(WebCore::CachedFont&) at /Users/litherum/src/WebKit/Source/WebCore/css/CSSFontFaceSource.cpp:140
#1	0x0000000109830f80 in WebCore::CachedFont::checkNotify() at /Users/litherum/src/WebKit/Source/WebCore/loader/cache/CachedFont.cpp:159
#2	0x00000001098429e1 in WebCore::CachedResource::error(WebCore::CachedResource::Status) at /Users/litherum/src/WebKit/Source/WebCore/loader/cache/CachedResource.cpp:379
#3	0x0000000109846212 in WebCore::CachedResource::failBeforeStarting() at /Users/litherum/src/WebKit/Source/WebCore/loader/cache/CachedResource.cpp:185
#4	0x000000010983d346 in WebCore::CachedResource::load(WebCore::CachedResourceLoader&) at /Users/litherum/src/WebKit/Source/WebCore/loader/cache/CachedResource.cpp:230
#5	0x000000010983078c in WebCore::CachedFont::beginLoadIfNeeded(WebCore::CachedResourceLoader&) at /Users/litherum/src/WebKit/Source/WebCore/loader/cache/CachedFont.cpp:82
#6	0x0000000108b336bf in WebCore::CSSFontSelector::beginLoadTimerFired() at /Users/litherum/src/WebKit/Source/WebCore/css/CSSFontSelector.cpp:381
Comment 6 Myles C. Maxfield 2019-03-26 10:04:14 PDT
That calls setStatus(Status::Failure) which means we never try to download the font again.
Comment 7 Myles C. Maxfield 2019-03-26 10:06:13 PDT
... Which means both the CSSFontFaceSource and the CSSFontFace call setStatus(Status::Failure).
Comment 8 Myles C. Maxfield 2019-03-26 10:11:13 PDT
When we go "back," we rebuild new CSSFontFace and CSSFontFaceSource objects. In CSSFontFaceSource's constructor, it adds itself as a client to the CachedFont. This synchronously calls CSSFontFaceSource::fontLoaded(), which checks m_font->errorOccurred(), which is true, so it setStatus(Status::Failure) again.
Comment 9 Myles C. Maxfield 2019-03-26 10:24:07 PDT
CSSFontFaceSrcValue::cachedFont() saves the CachedFont object, so the state is preserved (because the CSSFontFaceSrcValue is preserved)
Comment 10 Myles C. Maxfield 2019-04-01 18:25:29 PDT
I think the way to fix this is:

1) CachedFont overrides error(CachedResource::Status), and in the implementation, checks isLoading() to determine whether or not it failed before loading.
2) Even if the CachedResource failed, CachedFont remembers whether or not that failure was a failBeforeStarting or a real failure
3) CSSFontFaceSource treats a failBeforeStarted CachedFont as a yet-to-be-loaded CachedFont
4) CachedFont::beginLoadIfNeeded() allows for another load if the first one was a failBeforeStarted
Comment 11 Myles C. Maxfield 2019-04-01 19:27:53 PDT
Unfortunately, CachedFont::load() calls setLoading(true)
Comment 12 Myles C. Maxfield 2019-04-01 19:55:47 PDT
Created attachment 366460 [details]
WIP
Comment 13 Myles C. Maxfield 2019-04-01 19:59:20 PDT
Created attachment 366461 [details]
Patch
Comment 14 EWS Watchlist 2019-04-01 20:03:13 PDT
Attachment 366461 [details] did not pass style-queue:


ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 15 Myles C. Maxfield 2019-04-02 14:16:00 PDT
Created attachment 366536 [details]
Patch
Comment 16 Myles C. Maxfield 2019-04-02 14:16:57 PDT
Created attachment 366537 [details]
Patch
Comment 17 Myles C. Maxfield 2019-04-02 14:17:17 PDT
<rdar://problem/44808773>
Comment 18 Myles C. Maxfield 2019-04-02 14:23:59 PDT
This codepath probably kicks in too often - A content blocker probably causes a synchronous fail, and those shouldn't cause the font to be retried. Constantly retrying the font, means we never progress down the font-family list, which isn't an improvement from this bug.
Comment 19 Simon Fraser (smfr) 2019-06-16 20:54:53 PDT
Still relevant?
Comment 20 Dean Jackson 2022-02-19 08:15:09 PST
Comment on attachment 366537 [details]
Patch

Clearing old review flag. Please rebase and mark for review if necessary.