[webkit-changes] [WebKit/WebKit] 234c5f: [Cocoa] WebPreferencesStore::defaults() can differ...
aestes
noreply at github.com
Wed Oct 9 22:35:15 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 234c5f7ab5b983500d575cc73eefce863f36a82d
https://github.com/WebKit/WebKit/commit/234c5f7ab5b983500d575cc73eefce863f36a82d
Author: Andy Estes <aestes at apple.com>
Date: 2024-10-09 (Wed, 09 Oct 2024)
Changed paths:
M Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.mm
M Source/WebKit/Shared/AuxiliaryProcess.cpp
M Source/WebKit/Shared/AuxiliaryProcess.h
M Source/WebKit/Shared/Cocoa/AuxiliaryProcessCocoa.mm
M Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h
M Source/WebKit/UIProcess/WebProcessPool.cpp
Log Message:
-----------
[Cocoa] WebPreferencesStore::defaults() can differ between (Mobile)Safari and auxiliary processes
https://bugs.webkit.org/show_bug.cgi?id=281163
rdar://137624686
Reviewed by Sihui Liu.
WebPreferencesStore::defaults() are computed lazily on first access, and some default values are
computed based on SDK-aligned behaviors. SDK-aligned behaviors are computed in the UI process based
on the SDK version the process is linked against then sent to auxiliary processes at launch time.
Additionally, SDK-aligned behaviors can change at any time when clients call
-_setLinkedOnOrBeforeEverythingForTesting, -_setLinkedOnOrAfterEverythingForTesting, or
-_setLinkedOnOrAfterEverything on WKProcessPool. Finally, in WebProcessPool's constructor, Safari
and MobileSafari were special-cased to enable all SDK-aligned behaviors.
This arrangement led to a bug where WebPreferencesStore::defaults() could differ between
(Mobile)Safari and auxiliary processes in the following sequence:
1. WebPreferencesStore::defaults() is called, which computes SDK-aligned behaviors (possibly triggering bug #281166).
2. WebProcessPool::WebProcessPool() is called, which enables all SDK-aligned behaviors.
3. A new auxiliary process launches and is sent the now all-enabled SDK-aligned behaviors.
Because WebPreferencesStore::defaults() had already been called by the time
WebProcessPool::WebProcessPool() enabled all SDK-aligned behaviors, its defaults are based on
outdated values. However, WebPreferencesStore::defaults() in the new auxiliary process will be
based on the updated SDK-aligned behaviors set in (2).
A second, related bug exists in auxiliary processes where InitializeWebKit2() (which calls
linkedOnOrAfterSDKWithBehavior()) is called before the SDK-aligned behaviors sent from the UI
process were set.
Addressed the first bug by moving the special-casing of Safari and MobileSafari from
WebProcessPool::WebProcessPool() to computeSDKAlignedBehaviors(). This ensures that SDK-aligned
behaviors are in the correct state as soon as they are first accessed in the UI process. Addressed
the second bug by ensuring SDK-aligned behaviors are set in auxiliary processes prior to calling
InitializeWebKit2().
* Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.mm:
(WTF::computeSDKAlignedBehaviors):
* Source/WebKit/Shared/AuxiliaryProcess.cpp:
(WebKit::AuxiliaryProcess::initialize):
* Source/WebKit/Shared/AuxiliaryProcess.h:
* Source/WebKit/Shared/Cocoa/AuxiliaryProcessCocoa.mm:
(WebKit::AuxiliaryProcess::platformInitialize):
* Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
(WebKit::XPCServiceInitializer):
* Source/WebKit/UIProcess/WebProcessPool.cpp:
Canonical link: https://commits.webkit.org/284952@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list