Title: [253733] trunk
Revision
253733
Author
[email protected]
Date
2019-12-18 18:38:47 -0800 (Wed, 18 Dec 2019)

Log Message

Add SPI WKWebView._updateWebpagePreferences to replace _updateWebsitePolicies
https://bugs.webkit.org/show_bug.cgi?id=205427

Patch by Alex Christensen <[email protected]> on 2019-12-18
Reviewed by Wenson Hsieh.

Source/WebKit:

This blocks the removal of _WKWebsitePolicies.
This change is verified by an API test.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _updateWebsitePolicies:]):
(-[WKWebView _updateWebpagePreferences:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:
(TEST):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (253732 => 253733)


--- trunk/Source/WebKit/ChangeLog	2019-12-19 02:38:15 UTC (rev 253732)
+++ trunk/Source/WebKit/ChangeLog	2019-12-19 02:38:47 UTC (rev 253733)
@@ -1,3 +1,18 @@
+2019-12-18  Alex Christensen  <[email protected]>
+
+        Add SPI WKWebView._updateWebpagePreferences to replace _updateWebsitePolicies
+        https://bugs.webkit.org/show_bug.cgi?id=205427
+
+        Reviewed by Wenson Hsieh.
+
+        This blocks the removal of _WKWebsitePolicies.
+        This change is verified by an API test.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _updateWebsitePolicies:]):
+        (-[WKWebView _updateWebpagePreferences:]):
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+
 2019-12-18  Tim Horton  <[email protected]>
 
         macCatalyst: Cursor should update when the platform deems it necessary

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (253732 => 253733)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2019-12-19 02:38:15 UTC (rev 253732)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2019-12-19 02:38:47 UTC (rev 253733)
@@ -2070,7 +2070,12 @@
 
 - (void)_updateWebsitePolicies:(_WKWebsitePolicies *)websitePolicies
 {
-    auto data = ""
+    [self _updateWebpagePreferences:websitePolicies.webpagePreferences];
+}
+
+- (void)_updateWebpagePreferences:(WKWebpagePreferences *)webpagePreferences
+{
+    auto data = ""
     if (data.websiteDataStoreParameters)
         [NSException raise:NSInvalidArgumentException format:@"Updating WKWebsiteDataStore is only supported during decidePolicyForNavigationAction."];
     _page->updateWebsitePolicies(WTFMove(data));

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (253732 => 253733)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2019-12-19 02:38:15 UTC (rev 253732)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2019-12-19 02:38:47 UTC (rev 253733)
@@ -104,6 +104,7 @@
 #endif
 
 @class WKBrowsingContextHandle;
+@class WKWebpagePreferences;
 @class _WKApplicationManifest;
 @class _WKFrameHandle;
 @class _WKHitTestResult;
@@ -187,6 +188,7 @@
 - (void)_close;
 
 - (void)_updateWebsitePolicies:(_WKWebsitePolicies *)websitePolicies WK_API_AVAILABLE(macos(10.13), ios(11.0));
+- (void)_updateWebpagePreferences:(WKWebpagePreferences *)webpagePreferences WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 - (void)_evaluateJavaScriptWithoutUserGesture:(NSString *)_javascript_String completionHandler:(void (^)(id, NSError *))completionHandler WK_API_AVAILABLE(macos(10.13), ios(11.0));
 

Modified: trunk/Tools/ChangeLog (253732 => 253733)


--- trunk/Tools/ChangeLog	2019-12-19 02:38:15 UTC (rev 253732)
+++ trunk/Tools/ChangeLog	2019-12-19 02:38:47 UTC (rev 253733)
@@ -1,3 +1,13 @@
+2019-12-18  Alex Christensen  <[email protected]>
+
+        Add SPI WKWebView._updateWebpagePreferences to replace _updateWebsitePolicies
+        https://bugs.webkit.org/show_bug.cgi?id=205427
+
+        Reviewed by Wenson Hsieh.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:
+        (TEST):
+
 2019-12-18  Jonathan Bedard  <[email protected]>
 
         test-lldb-webkit: Run in CI (Follow-up fix)

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm (253732 => 253733)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm	2019-12-19 02:38:15 UTC (rev 253732)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm	2019-12-19 02:38:47 UTC (rev 253733)
@@ -742,9 +742,9 @@
 
     [webView stringByEvaluatingJavaScript:@"pauseVideo()"];
 
-    policies = [[[_WKWebsitePolicies alloc] init] autorelease];
-    policies.autoplayPolicy = _WKWebsiteAutoplayPolicyDeny;
-    [webView _updateWebsitePolicies:policies];
+    WKWebpagePreferences *preferences = [[[WKWebpagePreferences alloc] init] autorelease];
+    preferences._autoplayPolicy = _WKWebsiteAutoplayPolicyDeny;
+    [webView _updateWebpagePreferences:preferences];
 
     // A script should no longer be able to autoplay media.
     receivedAutoplayEvent = WTF::nullopt;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to