Due to stricter sandboxing in the WebContent process, Media Accessibility preferences should be updated from the UI process.
<rdar://78614882>
Created attachment 431447 [details] Patch
Comment on attachment 431447 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=431447&action=review > Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp:222 > + case kMACaptionAppearanceDisplayTypeForcedOnly: > + return ForcedOnly; > + > + case kMACaptionAppearanceDisplayTypeAutomatic: > + return Automatic; > + > + case kMACaptionAppearanceDisplayTypeAlwaysOn: > + return AlwaysOn; > + } I think it is a mistake to have the one method sometimes return the cached value and sometimes call the system because the caller always knows if it to do one thing or the other, so I would split this into two methods. > Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp:527 > + if (cachedPreferredLanguages().has_value()) > + return cachedPreferredLanguages().value(); > + > + auto captionLanguages = adoptCF(MACaptionAppearanceCopySelectedLanguages(kMACaptionAppearanceDomainUser)); > + CFIndex captionLanguagesCount = captionLanguages ? CFArrayGetCount(captionLanguages.get()) : 0; > + > + Vector<String> preferredLanguages; > + preferredLanguages.reserveInitialCapacity(captionLanguagesCount); > + for (CFIndex i = 0; i < captionLanguagesCount; i++) > + preferredLanguages.uncheckedAppend(static_cast<CFStringRef>(CFArrayGetValueAtIndex(captionLanguages.get(), i))); > + > + return preferredLanguages; Ditto.
Created attachment 431524 [details] Patch
Committed r278927 (238858@main): <https://commits.webkit.org/238858@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 431524 [details].
(In reply to Eric Carlson from comment #3) > Comment on attachment 431447 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=431447&action=review > > > Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp:222 > > + case kMACaptionAppearanceDisplayTypeForcedOnly: > > + return ForcedOnly; > > + > > + case kMACaptionAppearanceDisplayTypeAutomatic: > > + return Automatic; > > + > > + case kMACaptionAppearanceDisplayTypeAlwaysOn: > > + return AlwaysOn; > > + } > > I think it is a mistake to have the one method sometimes return the cached > value and sometimes call the system because the caller always knows if it to > do one thing or the other, so I would split this into two methods. > > > Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp:527 > > + if (cachedPreferredLanguages().has_value()) > > + return cachedPreferredLanguages().value(); > > + > > + auto captionLanguages = adoptCF(MACaptionAppearanceCopySelectedLanguages(kMACaptionAppearanceDomainUser)); > > + CFIndex captionLanguagesCount = captionLanguages ? CFArrayGetCount(captionLanguages.get()) : 0; > > + > > + Vector<String> preferredLanguages; > > + preferredLanguages.reserveInitialCapacity(captionLanguagesCount); > > + for (CFIndex i = 0; i < captionLanguagesCount; i++) > > + preferredLanguages.uncheckedAppend(static_cast<CFStringRef>(CFArrayGetValueAtIndex(captionLanguages.get(), i))); > > + > > + return preferredLanguages; > > Ditto. Fixed by moving the check outside the method. Thanks for reviewing!