Title: [291413] trunk
Revision
291413
Author
n...@apple.com
Date
2022-03-17 09:45:37 -0700 (Thu, 17 Mar 2022)

Log Message

Allow push preference to be set programatically
https://bugs.webkit.org/show_bug.cgi?id=238003

Reviewed by Geoffrey Garen.

Source/WebKit:

This exposes the PushAPIEnabled experimental preference through WKPreferences so it can be
enabled programatically by API clients.

* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _pushAPIEnabled]):
(-[WKPreferences _setPushAPIEnabled:]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:

Tools:

Make webpushd tests enable the push API via WKPreferences.

* TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (291412 => 291413)


--- trunk/Source/WebKit/ChangeLog	2022-03-17 16:38:08 UTC (rev 291412)
+++ trunk/Source/WebKit/ChangeLog	2022-03-17 16:45:37 UTC (rev 291413)
@@ -1,3 +1,18 @@
+2022-03-17  Ben Nham  <n...@apple.com>
+
+        Allow push preference to be set programatically
+        https://bugs.webkit.org/show_bug.cgi?id=238003
+
+        Reviewed by Geoffrey Garen.
+
+        This exposes the PushAPIEnabled experimental preference through WKPreferences so it can be
+        enabled programatically by API clients.
+
+        * UIProcess/API/Cocoa/WKPreferences.mm:
+        (-[WKPreferences _pushAPIEnabled]):
+        (-[WKPreferences _setPushAPIEnabled:]):
+        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
+
 2022-03-17  Kate Cheney  <katherine_che...@apple.com>
 
         Calls to print can result in unresponsive print modal

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm (291412 => 291413)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm	2022-03-17 16:38:08 UTC (rev 291412)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm	2022-03-17 16:45:37 UTC (rev 291413)
@@ -1570,6 +1570,16 @@
     return _preferences->notificationsEnabled();
 }
 
+- (BOOL)_pushAPIEnabled
+{
+    return _preferences->pushAPIEnabled();
+}
+
+- (void)_setPushAPIEnabled:(BOOL)pushAPIEnabled
+{
+    _preferences->setPushAPIEnabled(pushAPIEnabled);
+}
+
 - (void)_setModelDocumentEnabled:(BOOL)enabled
 {
     _preferences->setModelDocumentEnabled(enabled);

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h (291412 => 291413)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h	2022-03-17 16:38:08 UTC (rev 291412)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h	2022-03-17 16:45:37 UTC (rev 291413)
@@ -178,6 +178,7 @@
 @property (nonatomic, setter=_setStorageAPIEnabled:) BOOL _storageAPIEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic, setter=_setAccessHandleEnabled:) BOOL _accessHandleEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic, setter=_setNotificationsEnabled:) BOOL _notificationsEnabled WK_API_AVAILABLE(macos(10.13.4), ios(WK_IOS_TBA));
+@property (nonatomic, setter=_setPushAPIEnabled:) BOOL _pushAPIEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic, setter=_setModelDocumentEnabled:) BOOL _modelDocumentEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 #if !TARGET_OS_IPHONE

Modified: trunk/Tools/ChangeLog (291412 => 291413)


--- trunk/Tools/ChangeLog	2022-03-17 16:38:08 UTC (rev 291412)
+++ trunk/Tools/ChangeLog	2022-03-17 16:45:37 UTC (rev 291413)
@@ -1,3 +1,14 @@
+2022-03-17  Ben Nham  <n...@apple.com>
+
+        Allow push preference to be set programatically
+        https://bugs.webkit.org/show_bug.cgi?id=238003
+
+        Reviewed by Geoffrey Garen.
+
+        Make webpushd tests enable the push API via WKPreferences.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:
+
 2022-03-17  Kate Cheney  <katherine_che...@apple.com>
 
         Calls to print can result in unresponsive print modal

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm (291412 => 291413)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm	2022-03-17 16:38:08 UTC (rev 291412)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm	2022-03-17 16:45:37 UTC (rev 291413)
@@ -416,11 +416,10 @@
         clearWebsiteDataStore([m_configuration websiteDataStore]);
 
         [m_configuration.get().preferences _setNotificationsEnabled:YES];
+        [m_configuration.get().preferences _setPushAPIEnabled:YES];
         for (_WKExperimentalFeature *feature in [WKPreferences _experimentalFeatures]) {
             if ([feature.key isEqualToString:@"BuiltInNotificationsEnabled"])
                 [[m_configuration preferences] _setEnabled:YES forFeature:feature];
-            else if ([feature.key isEqualToString:@"PushAPIEnabled"])
-                [[m_configuration preferences] _setEnabled:YES forFeature:feature];
         }
 
         m_testMessageHandler = adoptNS([[TestMessageHandler alloc] init]);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to