Bug 221191

Summary: [macOS] Force loading the HEIF reader symbols before transcoding any HEIF image
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: ImagesAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, cmarcelo, ews-watchlist, simon.fraser, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
ews-feeder: commit-queue-
Patch none

Description Said Abou-Hallawa 2021-01-31 15:00:35 PST
Transcoding the HEIF images requires loading the HEIF reader symbols which is not happening in macOS Catalina. The bug has been fixed in the underlaying frameworks of macOS Big Sur. But since the trunk WebKit can run on macOS Catalina, we need a workaround for this bug in WebKit itself.
Comment 1 Said Abou-Hallawa 2021-01-31 15:05:29 PST
<rdar://problem/70942158>
Comment 2 Said Abou-Hallawa 2021-01-31 15:06:47 PST
Created attachment 418833 [details]
Patch
Comment 3 Tim Horton 2021-01-31 16:03:55 PST
Comment on attachment 418833 [details]
Patch

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

> Source/WebCore/platform/graphics/cg/ImageUtilitiesCG.cpp:54
> +    // This will force ImageIO to load the symbols of the HEIF reader.

This should probably reference the ImageIO radar.

> Source/WebCore/platform/graphics/cg/ImageUtilitiesCG.cpp:55
> +    auto sourceMIMEType = MIMETypeFromUTI(sourceUTI);

The workaround should be scoped only to OS versions where the underlying bug is not fixed, so that this code naturally evaporates when the fix is globally available. Other than that, this seems reasonable.
Comment 4 Tim Horton 2021-01-31 18:14:05 PST
Comment on attachment 418833 [details]
Patch

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

>> Source/WebCore/platform/graphics/cg/ImageUtilitiesCG.cpp:55
>> +    auto sourceMIMEType = MIMETypeFromUTI(sourceUTI);
> 
> The workaround should be scoped only to OS versions where the underlying bug is not fixed, so that this code naturally evaporates when the fix is globally available. Other than that, this seems reasonable.

Also, you only need to run it once per process.
Comment 5 Said Abou-Hallawa 2021-02-01 09:18:57 PST
Created attachment 418886 [details]
Patch
Comment 6 Simon Fraser (smfr) 2021-02-01 09:34:44 PST
Comment on attachment 418886 [details]
Patch

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

> Source/WTF/ChangeLog:5
> +        https://bugs.webkit.org/show_bug.cgi?id=221191
> +

You need a radar number here
Comment 7 Said Abou-Hallawa 2021-02-01 10:00:10 PST
Created attachment 418891 [details]
Patch
Comment 8 Tim Horton 2021-02-01 18:35:22 PST
I tried to come up with a concise alternative HAVE name that mentioned the behavior instead of the radar # and came up empty (or with paragraphs).
Comment 9 EWS 2021-02-02 13:54:37 PST
Committed r272234: <https://trac.webkit.org/changeset/272234>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 418891 [details].