Changeset 290482 in webkit


Ignore:
Timestamp:
Feb 24, 2022, 5:44:44 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

Port CaptivePortalMode preferences to AnyHost in order to support CFPrefs Direct Mode propagation
https://bugs.webkit.org/show_bug.cgi?id=237098

Patch by Gavin Phillips <gavin.p@apple.com> on 2022-02-24
Reviewed by Brent Fulgham.

Move our CaptivePortalMode preference to AnyHost in order to correctly support
CFPrefs Direct Mode propagation. We also now dispatch a CFNotification to ensure our preference
observer is always notified of the change.

  • UIProcess/Cocoa/PreferenceObserver.mm:

(-[WKUserDefaults findPreferenceChangesAndNotifyForKeys:toValuesForKeys:]):

  • Shared/Cocoa/AuxiliaryProcessCocoa.mm:

(WebKit::AuxiliaryProcess::setPreferenceValue):

  • UIProcess/API/Cocoa/_WKSystemPreferences.mm:

(+[_WKSystemPreferences isCaptivePortalModeEnabled]):
(+[_WKSystemPreferences setCaptivePortalModeEnabled:]):

  • UIProcess/Cocoa/WebProcessPoolCocoa.mm:

(WebKit::WebProcessPool::captivePortalModeConfigUpdateCallback):
(WebKit::WebProcessPool::registerNotificationObservers):
(WebKit::WebProcessPool::unregisterNotificationObservers):

  • UIProcess/WebProcessPool.h:
Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r290481 r290482  
     12022-02-24  Gavin Phillips  <gavin.p@apple.com>
     2
     3        Port CaptivePortalMode preferences to AnyHost in order to support CFPrefs Direct Mode propagation
     4        https://bugs.webkit.org/show_bug.cgi?id=237098
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Move our CaptivePortalMode preference to AnyHost in order to correctly support
     9        CFPrefs Direct Mode propagation. We also now dispatch a CFNotification to ensure our preference
     10        observer is always notified of the change.
     11
     12        * UIProcess/Cocoa/PreferenceObserver.mm:
     13        (-[WKUserDefaults findPreferenceChangesAndNotifyForKeys:toValuesForKeys:]):
     14
     15        * Shared/Cocoa/AuxiliaryProcessCocoa.mm:
     16        (WebKit::AuxiliaryProcess::setPreferenceValue):
     17        * UIProcess/API/Cocoa/_WKSystemPreferences.mm:
     18        (+[_WKSystemPreferences isCaptivePortalModeEnabled]):
     19        (+[_WKSystemPreferences setCaptivePortalModeEnabled:]):
     20        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
     21        (WebKit::WebProcessPool::captivePortalModeConfigUpdateCallback):
     22        (WebKit::WebProcessPool::registerNotificationObservers):
     23        (WebKit::WebProcessPool::unregisterNotificationObservers):
     24        * UIProcess/WebProcessPool.h:
     25
    1262022-02-24  Aditya Keerthi  <akeerthi@apple.com>
    227
  • trunk/Source/WebKit/UIProcess/API/Cocoa/_WKSystemPreferences.mm

    r290144 r290482  
    3737{
    3838    auto changedNotificationKey = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, WKCaptivePortalModeEnabledKey, kCFStringEncodingUTF8));
    39     auto preferenceValue = adoptCF(CFPreferencesCopyValue(changedNotificationKey.get(), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost));
     39    auto preferenceValue = adoptCF(CFPreferencesCopyValue(changedNotificationKey.get(), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost));
    4040    return preferenceValue.get() == kCFBooleanTrue;
    4141}
     
    4444{
    4545    auto changedNotificationKey = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, WKCaptivePortalModeEnabledKey, kCFStringEncodingUTF8));
    46     CFPreferencesSetValue(changedNotificationKey.get(), enabled ? kCFBooleanTrue : kCFBooleanFalse, kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost);
    47     CFPreferencesSynchronize(kCFPreferencesAnyApplication, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
     46    CFPreferencesSetValue(changedNotificationKey.get(), enabled ? kCFBooleanTrue : kCFBooleanFalse, kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
     47    CFPreferencesSynchronize(kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
     48    CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), (__bridge CFStringRef)WKCaptivePortalModeContainerConfigurationChangedNotification, nullptr, nullptr, true);
    4849}
    4950
  • trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm

    r290394 r290482  
    625625#endif
    626626
    627 #if PLATFORM(IOS_FAMILY)
     627#if PLATFORM(COCOA)
    628628void WebProcessPool::captivePortalModeConfigUpdateCallback(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef)
    629629{
     
    746746    });
    747747
    748 #if PLATFORM(IOS_FAMILY)
     748#if PLATFORM(COCOA)
    749749    addCFNotificationObserver(captivePortalModeConfigUpdateCallback, (__bridge CFStringRef)WKCaptivePortalModeContainerConfigurationChangedNotification);
    750750#endif
     
    794794    m_powerSourceNotifier = nullptr;
    795795   
    796 #if PLATFORM(IOS_FAMILY)
     796#if PLATFORM(COCOA)
    797797    removeCFNotificationObserver((__bridge CFStringRef)WKCaptivePortalModeContainerConfigurationChangedNotification);
    798798#endif
  • trunk/Source/WebKit/UIProcess/WebProcessPool.h

    r290387 r290482  
    586586#endif
    587587
    588 #if PLATFORM(IOS_FAMILY)
     588#if PLATFORM(COCOA)
    589589    static void captivePortalModeConfigUpdateCallback(CFNotificationCenterRef, void* observer, CFStringRef name, const void* postingObject, CFDictionaryRef userInfo);
    590590#endif
Note: See TracChangeset for help on using the changeset viewer.