Changeset 287364 in webkit
- Timestamp:
- Dec 22, 2021, 10:48:55 AM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r287360 r287364 1 2021-12-22 Simon Fraser <simon.fraser@apple.com> 2 3 Preferences that read from NSUserDefaults need to be initialied from platformInitializeStore() 4 https://bugs.webkit.org/show_bug.cgi?id=234488 5 6 Reviewed by Sam Weinig. 7 8 Having the default value for a preference read from NSUserDefaults can cause issues 9 if the UIProcess and WebProcess values don't match. Instead, have platformInitializeStore() 10 explicitly add values for these keys; this is done for scrollAnimatorEnabledKey. 11 12 * Scripts/Preferences/WebPreferences.yaml: 13 1 14 2021-12-22 J Pascoe <j_pascoe@apple.com> 2 15 -
trunk/Source/WTF/Scripts/Preferences/WebPreferences.yaml
r287228 r287364 1894 1894 default: false 1895 1895 WebKit: 1896 "PLATFORM(MAC)": WebKit::defaultScrollAnimatorEnabled()1896 # PLATFORM(MAC) initializes the value in initializeProcessStateDependentPreferences 1897 1897 "PLATFORM(GTK) || PLATFORM(WPE)": true 1898 1898 default: false -
trunk/Source/WebKit/ChangeLog
r287358 r287364 1 2021-12-22 Simon Fraser <simon.fraser@apple.com> 2 3 Preferences that read from NSUserDefaults need to be initialied from platformInitializeStore() 4 https://bugs.webkit.org/show_bug.cgi?id=234488 5 6 Reviewed by Sam Weinig. 7 8 Having the default value for a preference read from NSUserDefaults can cause issues 9 if the UIProcess and WebProcess values don't match. Instead, have platformInitializeStore() 10 explicitly add values for these keys; this is done for scrollAnimatorEnabledKey. 11 12 * UIProcess/Cocoa/WebPreferencesCocoa.mm: 13 (WebKit::WebPreferences::initializePlatformDependentPreferences): 14 (WebKit::WebPreferences::platformInitializeStore): 15 * UIProcess/WebPreferences.cpp: 16 (WebKit::WebPreferences::initializePlatformDependentPreferences): 17 * UIProcess/WebPreferences.h: 18 1 19 2021-12-22 Commit Queue <commit-queue@webkit.org> 2 20 -
trunk/Source/WebKit/UIProcess/Cocoa/WebPreferencesCocoa.mm
r268012 r287364 141 141 } 142 142 143 void WebPreferences::initializeProcessStateDependentPreferences() 144 { 145 #if ENABLE(MEDIA_STREAM) 146 // NOTE: This is set here, and does not set the default using the 'defaultValue' mechanism, because the 147 // 'defaultValue' must be the same in both the UIProcess and WebProcess, which may not be true for audio 148 // and video capture state as the WebProcess is not entitled to use the camera or microphone by default. 149 // If other preferences need to dynamically set the initial value based on host app state, we should extended 150 // the declarative format rather than adding more special cases here. 151 m_store.setBoolValueForKey(WebPreferencesKey::mediaDevicesEnabledKey(), UserMediaPermissionRequestManagerProxy::permittedToCaptureAudio() || UserMediaPermissionRequestManagerProxy::permittedToCaptureVideo()); 152 #endif 153 154 #if PLATFORM(MAC) 155 m_store.setBoolValueForKey(WebPreferencesKey::scrollAnimatorEnabledKey(), [[NSUserDefaults standardUserDefaults] boolForKey:@"NSScrollAnimationEnabled"]); 156 #endif 157 } 158 143 159 void WebPreferences::platformInitializeStore() 144 160 { 145 161 @autoreleasepool { 146 #if ENABLE(MEDIA_STREAM) 147 // NOTE: This is set here, and does not setting the default using the 'defaultValue' mechanism, because the 148 // 'defaultValue' must be the same in both the UIProcess and WebProcess, which may not be true for audio 149 // and video capture state as the WebProcess is not entitled to use the camera or microphone by default. 150 // If other preferences need to dynamically set the initial value based on host app state, we should extended 151 // the declarative format rather than adding more special cases here. 152 m_store.setBoolValueForKey(WebPreferencesKey::mediaDevicesEnabledKey(), UserMediaPermissionRequestManagerProxy::permittedToCaptureAudio() || UserMediaPermissionRequestManagerProxy::permittedToCaptureVideo()); 153 #endif 162 initializeProcessStateDependentPreferences(); 154 163 155 164 #define INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) \ -
trunk/Source/WebKit/UIProcess/WebPreferences.cpp
r271287 r287364 229 229 230 230 #if !PLATFORM(COCOA) 231 void WebPreferences::initializeProcessStateDependentPreferences() 232 { 233 } 234 231 235 void WebPreferences::platformUpdateStringValueForKey(const String&, const String&) 232 236 { -
trunk/Source/WebKit/UIProcess/WebPreferences.h
r276880 r287364 90 90 private: 91 91 void platformInitializeStore(); 92 void initializeProcessStateDependentPreferences(); 92 93 93 94 void update();
Note:
See TracChangeset
for help on using the changeset viewer.