Diff
Modified: trunk/Source/WebKit/ChangeLog (277214 => 277215)
--- trunk/Source/WebKit/ChangeLog 2021-05-08 00:22:46 UTC (rev 277214)
+++ trunk/Source/WebKit/ChangeLog 2021-05-08 00:30:35 UTC (rev 277215)
@@ -1,3 +1,44 @@
+2021-05-07 James Savage <james.sav...@apple.com>
+
+ Validate Swift async imports.
+ https://bugs.webkit.org/show_bug.cgi?id=225134
+ <rdar://73620237>
+
+ Reviewed by Sam Weinig.
+
+ Audit our imported Objective-C API for correct translations to Swift's
+ upcoming concurrency feature. This mostly entails removing redundant
+ words, tagging methods which Swift's heuristics missed, and in some
+ cases disabling methods that do not follow Swift's async conventions.
+
+ * Shared/API/Cocoa/WKFoundation.h: Because the Foundation macros used
+ for Swift async won't exist in all SDKs, provide our own wrapper around
+ them to avoid undefined macro errors.
+ * SwiftOverlay/Configurations/WebKitSwiftOverlay.xcconfig: Passing these
+ flags to older tools will result in errors, so only so conditionally.
+ * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/project.pbxproj: Added a
+ new source file reference for generated sources. These will be copied
+ from WebKitAdditions if available, or replaced with empty sources for
+ compatibility.
+ * UIProcess/API/Cocoa/NSAttributedString.h: Adopt new attributes to
+ define an explicit Swift async name.
+ * UIProcess/API/Cocoa/WKContentRuleListStore.h: Ditto.
+ * UIProcess/API/Cocoa/WKDownloadDelegate.h: In this case I also apply
+ NS_SWIFT_NAME as the "decisionHandler" argument would otherwise not
+ import as async. Despite using a different macro, I'm just using
+ NS_SWIFT_ASYNC_NAME to check for these changes as all these annotations
+ should exist or not-exist at once.
+ * UIProcess/API/Cocoa/WKHTTPCookieStore.h: Ditto.
+ * UIProcess/API/Cocoa/WKNavigationDelegate.h: Ditto.
+ * UIProcess/API/Cocoa/WKScriptMessageHandlerWithReply.h: Ditto.
+ * UIProcess/API/Cocoa/WKUIDelegate.h: Ditto.
+ * UIProcess/API/Cocoa/WKWebView.h: _Nullable_result is a new annotation
+ which specifies that the result and error are not mutually exclusive,
+ but rather than we can expect a nil result in cases where there are not
+ an error. For the same reason as above, we only want to refer to this
+ keyword conditionally.
+ * UIProcess/API/Cocoa/WKWebsiteDataStore.h: Ditto.
+
2021-05-07 Tim Horton <timothy_hor...@apple.com>
Add an experimental alternative display-list-based RemoteLayerBackingStore implementation
Modified: trunk/Source/WebKit/Shared/API/Cocoa/WKFoundation.h (277214 => 277215)
--- trunk/Source/WebKit/Shared/API/Cocoa/WKFoundation.h 2021-05-08 00:22:46 UTC (rev 277214)
+++ trunk/Source/WebKit/Shared/API/Cocoa/WKFoundation.h 2021-05-08 00:30:35 UTC (rev 277215)
@@ -32,6 +32,18 @@
#define WK_EXTERN extern __attribute__((visibility ("default")))
#endif
+#ifdef NS_SWIFT_ASYNC_NAME
+#define WK_SWIFT_ASYNC_NAME(...) NS_SWIFT_ASYNC_NAME(__VA_ARGS__)
+#else
+#define WK_SWIFT_ASYNC_NAME(...)
+#endif
+
+#ifdef NS_SWIFT_ASYNC
+#define WK_SWIFT_ASYNC(...) NS_SWIFT_ASYNC(__VA_ARGS__)
+#else
+#define WK_SWIFT_ASYNC(...)
+#endif
+
#ifndef WK_FRAMEWORK_HEADER_POSTPROCESSING_ENABLED
#define WK_API_AVAILABLE(...)
Modified: trunk/Source/WebKit/SwiftOverlay/Configurations/WebKitSwiftOverlay.xcconfig (277214 => 277215)
--- trunk/Source/WebKit/SwiftOverlay/Configurations/WebKitSwiftOverlay.xcconfig 2021-05-08 00:22:46 UTC (rev 277214)
+++ trunk/Source/WebKit/SwiftOverlay/Configurations/WebKitSwiftOverlay.xcconfig 2021-05-08 00:30:35 UTC (rev 277215)
@@ -50,7 +50,11 @@
// SDK variant on macOS, in which case it's /System/iOSSupport/usr/lib/swift.
INSTALL_PATH = $(WK_ALTERNATE_FRAMEWORKS_DIR)$(SWIFT_OVERLAY_INSTALL_PATH);
-OTHER_SWIFT_FLAGS = -module-link-name $(SWIFT_MODULE_LINK_NAME) -autolink-force-load -runtime-compatibility-version none -disable-autolinking-runtime-compatibility-dynamic-replacements;
+WK_SWIFT_CONCURRENCY_FLAGS = -Xfrontend -enable-experimental-concurrency;
+WK_SWIFT_CONCURRENCY_FLAGS[sdk=macos*11.*] = ;
+WK_SWIFT_CONCURRENCY_FLAGS[sdk=iphone*14.*] = ;
+
+OTHER_SWIFT_FLAGS = -module-link-name $(SWIFT_MODULE_LINK_NAME) -autolink-force-load -runtime-compatibility-version none -disable-autolinking-runtime-compatibility-dynamic-replacements $(WK_SWIFT_CONCURRENCY_FLAGS);
SWIFT_MODULE_LINK_NAME = swift$(PRODUCT_NAME);
SWIFT_ENABLE_INCREMENTAL_COMPILATION = NO; // YES conflicts with -autolink-force-load
Modified: trunk/Source/WebKit/SwiftOverlay/WebKitSwiftOverlay.xcodeproj/project.pbxproj (277214 => 277215)
--- trunk/Source/WebKit/SwiftOverlay/WebKitSwiftOverlay.xcodeproj/project.pbxproj 2021-05-08 00:22:46 UTC (rev 277214)
+++ trunk/Source/WebKit/SwiftOverlay/WebKitSwiftOverlay.xcodeproj/project.pbxproj 2021-05-08 00:30:35 UTC (rev 277215)
@@ -17,6 +17,8 @@
B3B8FECD250090B1006172CA /* _javascript_ToSwiftTypeConversions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3B8FECB250090B1006172CA /* _javascript_ToSwiftTypeConversions.swift */; };
B3B8FEEF2502BAA0006172CA /* ObjectiveCBlockConversions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3B8FEEE2502BAA0006172CA /* ObjectiveCBlockConversions.swift */; };
B3B8FEF02502BAA0006172CA /* ObjectiveCBlockConversions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3B8FEEE2502BAA0006172CA /* ObjectiveCBlockConversions.swift */; };
+ B3DF244C2638BE240038D95A /* WebKitSwiftOverlayAdditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B31B03FD2637EF6500D67EAD /* WebKitSwiftOverlayAdditions.swift */; };
+ B3DF244D2638BE290038D95A /* WebKitSwiftOverlayAdditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B31B03FD2637EF6500D67EAD /* WebKitSwiftOverlayAdditions.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -41,6 +43,7 @@
7D20068722F26721008DF640 /* libswiftWebKit.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libswiftWebKit.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
7D20070722F4EB72008DF640 /* WebKitSwiftOverlayTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WebKitSwiftOverlayTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
7D20071622F4ECCA008DF640 /* WebKitSwiftOverlayTests-maccatalyst.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "WebKitSwiftOverlayTests-maccatalyst.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
+ B31B03FD2637EF6500D67EAD /* WebKitSwiftOverlayAdditions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WebKitSwiftOverlayAdditions.swift; path = usr/local/include/WebKitAdditions/WebKitSwiftOverlayAdditions.swift; sourceTree = BUILT_PRODUCTS_DIR; };
B3A5D38823F78F5400B17727 /* WebKitTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebKitTests.swift; sourceTree = "<group>"; };
B3A5D39123F790DB00B17727 /* WebKitSwiftOverlay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WebKitSwiftOverlay.swift; path = ../UIProcess/API/Cocoa/WebKitSwiftOverlay.swift; sourceTree = SOURCE_ROOT; };
B3A5D39423F790E100B17727 /* WebKitSwiftOverlay.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WebKitSwiftOverlay.xcconfig; sourceTree = "<group>"; };
@@ -94,6 +97,7 @@
B3A5D39923F790E100B17727 /* install-swiftmodules.sh */,
B3B8FEEE2502BAA0006172CA /* ObjectiveCBlockConversions.swift */,
B3A5D39123F790DB00B17727 /* WebKitSwiftOverlay.swift */,
+ B31B03FD2637EF6500D67EAD /* WebKitSwiftOverlayAdditions.swift */,
);
name = "Swift Overlay";
path = SwiftOverlay;
@@ -174,6 +178,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 7D20067B22F2652E008DF640 /* Build configuration list for PBXNativeTarget "WebKitSwiftOverlay" */;
buildPhases = (
+ B31B03FC2637EEBD00D67EAD /* Copy Additional Sources */,
7D20067122F2652E008DF640 /* Headers */,
7D20067222F2652E008DF640 /* Sources */,
7D20067322F2652E008DF640 /* Frameworks */,
@@ -192,6 +197,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 7D20068D22F26721008DF640 /* Build configuration list for PBXNativeTarget "WebKitSwiftOverlay-maccatalyst" */;
buildPhases = (
+ B31B04002637F22E00D67EAD /* Copy Additional Sources */,
7D20068322F26721008DF640 /* Headers */,
7D20068422F26721008DF640 /* Sources */,
7D20068522F26721008DF640 /* Frameworks */,
@@ -345,6 +351,46 @@
shellPath = /bin/sh;
shellScript = "exec \"${SOURCE_ROOT}/SwiftOverlay/install-swiftmodules.sh\"\n";
};
+ B31B03FC2637EEBD00D67EAD /* Copy Additional Sources */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ "$(SDK_DIR)/usr/local/include/WebKitAdditions/WebKitSwiftOverlayAdditions.swift",
+ );
+ name = "Copy Additional Sources";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ "$(BUILT_PRODUCTS_DIR)/usr/local/include/WebKitAdditions/WebKitSwiftOverlayAdditions.swift",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "set -e\n\nRELATIVE_SOURCE_PATH=\"usr/local/include/WebKitAdditions/WebKitSwiftOverlayAdditions.swift\"\nSOURCE_PATH=\"$SDK_DIR/$RELATIVE_SOURCE_PATH\"\nDESTINATION_PATH=\"$BUILT_PRODUCTS_DIR/$RELATIVE_SOURCE_PATH\"\n\nif [[ -e \"$SOURCE_PATH\" ]]; then\n ditto \"$SOURCE_PATH\" \"$DESTINATION_PATH\"\nelse\n touch \"$DESTINATION_PATH\"\nfi\n";
+ };
+ B31B04002637F22E00D67EAD /* Copy Additional Sources */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ "$(SDK_DIR)/usr/local/include/WebKitAdditions/WebKitSwiftOverlayAdditions.swift",
+ );
+ name = "Copy Additional Sources";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ "$(BUILT_PRODUCTS_DIR)/usr/local/include/WebKitAdditions/WebKitSwiftOverlayAdditions.swift",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "set -e\n\nRELATIVE_SOURCE_PATH=\"usr/local/include/WebKitAdditions/WebKitSwiftOverlayAdditions.swift\"\nSOURCE_PATH=\"$SDK_DIR/$RELATIVE_SOURCE_PATH\"\nDESTINATION_PATH=\"$BUILT_PRODUCTS_DIR/$RELATIVE_SOURCE_PATH\"\n\nif [[ -e \"$SOURCE_PATH\" ]]; then\n ditto \"$SOURCE_PATH\" \"$DESTINATION_PATH\"\nelse\n touch \"$DESTINATION_PATH\"\nfi\n";
+ };
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -354,6 +400,7 @@
files = (
B3B8FEEF2502BAA0006172CA /* ObjectiveCBlockConversions.swift in Sources */,
B3A5D39223F790DB00B17727 /* WebKitSwiftOverlay.swift in Sources */,
+ B3DF244C2638BE240038D95A /* WebKitSwiftOverlayAdditions.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -363,6 +410,7 @@
files = (
B3B8FEF02502BAA0006172CA /* ObjectiveCBlockConversions.swift in Sources */,
B3A5D39323F790DB00B17727 /* WebKitSwiftOverlay.swift in Sources */,
+ B3DF244D2638BE290038D95A /* WebKitSwiftOverlayAdditions.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/NSAttributedString.h (277214 => 277215)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/NSAttributedString.h 2021-05-08 00:22:46 UTC (rev 277214)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/NSAttributedString.h 2021-05-08 00:30:35 UTC (rev 277215)
@@ -70,7 +70,7 @@
document-level attributes, or an error.
*/
+ (void)loadFromHTMLWithRequest:(NSURLRequest *)request options:(NSDictionary<NSAttributedStringDocumentReadingOptionKey, id> *)options completionHandler:(NSAttributedStringCompletionHandler)completionHandler
- NS_SWIFT_NAME(loadFromHTML(request:options:completionHandler:)) WK_API_AVAILABLE(macos(10.15), ios(13.0));
+ NS_SWIFT_NAME(loadFromHTML(request:options:completionHandler:)) WK_SWIFT_ASYNC_NAME(fromHTML(request:options:)) WK_API_AVAILABLE(macos(10.15), ios(13.0));
/*!
@abstract Converts a local HTML file into an attributed string.
@@ -85,7 +85,7 @@
files inside that directory may be loaded by WebKit.
*/
+ (void)loadFromHTMLWithFileURL:(NSURL *)fileURL options:(NSDictionary<NSAttributedStringDocumentReadingOptionKey, id> *)options completionHandler:(NSAttributedStringCompletionHandler)completionHandler
- NS_SWIFT_NAME(loadFromHTML(fileURL:options:completionHandler:)) WK_API_AVAILABLE(macos(10.15), ios(13.0));
+ NS_SWIFT_NAME(loadFromHTML(fileURL:options:completionHandler:)) WK_SWIFT_ASYNC_NAME(fromHTML(fileURL:options:)) WK_API_AVAILABLE(macos(10.15), ios(13.0));
/*!
@abstract Converts an HTML string into an attributed string.
@@ -99,7 +99,7 @@
within the document.
*/
+ (void)loadFromHTMLWithString:(NSString *)string options:(NSDictionary<NSAttributedStringDocumentReadingOptionKey, id> *)options completionHandler:(NSAttributedStringCompletionHandler)completionHandler
- NS_SWIFT_NAME(loadFromHTML(string:options:completionHandler:)) WK_API_AVAILABLE(macos(10.15), ios(13.0));
+ NS_SWIFT_NAME(loadFromHTML(string:options:completionHandler:)) WK_SWIFT_ASYNC_NAME(fromHTML(_:options:)) WK_API_AVAILABLE(macos(10.15), ios(13.0));
/*!
@abstract Converts HTML data into an attributed string.
@@ -113,7 +113,7 @@
NSCharacterEncodingDocumentOption is supplied, a best-guess encoding is used.
*/
+ (void)loadFromHTMLWithData:(NSData *)data options:(NSDictionary<NSAttributedStringDocumentReadingOptionKey, id> *)options completionHandler:(NSAttributedStringCompletionHandler)completionHandler
- NS_SWIFT_NAME(loadFromHTML(data:options:completionHandler:)) WK_API_AVAILABLE(macos(10.15), ios(13.0));
+ NS_SWIFT_NAME(loadFromHTML(data:options:completionHandler:)) WK_SWIFT_ASYNC_NAME(fromHTML(_:options:)) WK_API_AVAILABLE(macos(10.15), ios(13.0));
@end
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.h (277214 => 277215)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.h 2021-05-08 00:22:46 UTC (rev 277214)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.h 2021-05-08 00:30:35 UTC (rev 277215)
@@ -36,8 +36,11 @@
+ (instancetype)storeWithURL:(NSURL *)url;
- (void)compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *)encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler;
-- (void)lookUpContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler;
+
+- (void)lookUpContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler WK_SWIFT_ASYNC_NAME(contentRuleList(forIdentifier:));
+
- (void)removeContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler;
-- (void)getAvailableContentRuleListIdentifiers:(void (^)(NSArray<NSString *> *))completionHandler;
+- (void)getAvailableContentRuleListIdentifiers:(void (^)(NSArray<NSString *> *))completionHandler WK_SWIFT_ASYNC_NAME(availableIdentifiers());
+
@end
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKDownloadDelegate.h (277214 => 277215)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKDownloadDelegate.h 2021-05-08 00:22:46 UTC (rev 277214)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKDownloadDelegate.h 2021-05-08 00:30:35 UTC (rev 277215)
@@ -68,7 +68,7 @@
to proceed with the redirection.
@discussion If you do not implement this method, all server suggested redirects will be taken.
*/
-- (void)download:(WKDownload *)download willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request decisionHandler:(void (^)(WKDownloadRedirectPolicy))decisionHandler;
+- (void)download:(WKDownload *)download willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request decisionHandler:(void (^)(WKDownloadRedirectPolicy))decisionHandler WK_SWIFT_ASYNC_NAME(download(_:decidedPolicyForHTTPRedirection:newRequest:)) WK_SWIFT_ASYNC(4);
/* @abstract Invoked when the download needs to respond to an authentication challenge.
@param download The download that received the authentication challenge.
@@ -80,7 +80,7 @@
credential.
@discussion If you do not implement this method, the web view will respond to the authentication challenge with the NSURLSessionAuthChallengeRejectProtectionSpace disposition.
*/
-- (void)download:(WKDownload *)download didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler;
+- (void)download:(WKDownload *)download didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler WK_SWIFT_ASYNC_NAME(download(_:respondTo:));
/* @abstract Invoked when the download has finished successfully.
@param download The download that finished.
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.h (277214 => 277215)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.h 2021-05-08 00:22:46 UTC (rev 277214)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.h 2021-05-08 00:30:35 UTC (rev 277215)
@@ -59,7 +59,7 @@
/*! @abstract Delete the specified cookie.
@param completionHandler A block to invoke once the cookie has been deleted.
*/
-- (void)deleteCookie:(NSHTTPCookie *)cookie completionHandler:(nullable void (^)(void))completionHandler;
+- (void)deleteCookie:(NSHTTPCookie *)cookie completionHandler:(nullable void (^)(void))completionHandler WK_SWIFT_ASYNC_NAME(deleteCookie(_:));
/*! @abstract Adds a WKHTTPCookieStoreObserver object with the cookie store.
@param observer The observer object to add.
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegate.h (277214 => 277215)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegate.h 2021-05-08 00:22:46 UTC (rev 277214)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegate.h 2021-05-08 00:30:35 UTC (rev 277215)
@@ -77,7 +77,7 @@
navigation. The argument is one of the constants of the enumerated type WKNavigationActionPolicy.
@discussion If you do not implement this method, the web view will load the request or, if appropriate, forward it to another application.
*/
-- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler;
+- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler WK_SWIFT_ASYNC(3);
/*! @abstract Decides whether to allow or cancel a navigation.
@param webView The web view invoking the delegate method.
@@ -91,7 +91,7 @@
@discussion If you implement this method,
-webView:decidePolicyForNavigationAction:decisionHandler: will not be called.
*/
-- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction preferences:(WKWebpagePreferences *)preferences decisionHandler:(void (^)(WKNavigationActionPolicy, WKWebpagePreferences *))decisionHandler WK_API_AVAILABLE(macos(10.15), ios(13.0));
+- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction preferences:(WKWebpagePreferences *)preferences decisionHandler:(void (^)(WKNavigationActionPolicy, WKWebpagePreferences *))decisionHandler WK_SWIFT_ASYNC(4) WK_API_AVAILABLE(macos(10.15), ios(13.0));
/*! @abstract Decides whether to allow or cancel a navigation after its
response is known.
@@ -102,7 +102,7 @@
navigation. The argument is one of the constants of the enumerated type WKNavigationResponsePolicy.
@discussion If you do not implement this method, the web view will allow the response, if the web view can show it.
*/
-- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler;
+- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler WK_SWIFT_ASYNC(3);
/*! @abstract Invoked when a main frame navigation starts.
@param webView The web view invoking the delegate method.
@@ -155,7 +155,7 @@
credential.
@discussion If you do not implement this method, the web view will respond to the authentication challenge with the NSURLSessionAuthChallengeRejectProtectionSpace disposition.
*/
-- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler;
+- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler WK_SWIFT_ASYNC_NAME(webView(_:respondTo:));
/*! @abstract Invoked when the web view's web content process is terminated.
@param webView The web view whose underlying web content process was terminated.
@@ -167,7 +167,7 @@
@param challenge The authentication challenge.
@param decisionHandler The decision handler you must invoke to respond to indicate whether or not to continue with the connection establishment.
*/
-- (void)webView:(WKWebView *)webView authenticationChallenge:(NSURLAuthenticationChallenge *)challenge shouldAllowDeprecatedTLS:(void (^)(BOOL))decisionHandler WK_API_AVAILABLE(macos(11.0), ios(14.0));
+- (void)webView:(WKWebView *)webView authenticationChallenge:(NSURLAuthenticationChallenge *)challenge shouldAllowDeprecatedTLS:(void (^)(BOOL))decisionHandler WK_SWIFT_ASYNC_NAME(webView(_:shouldAllowDeprecatedTLSFor:)) WK_SWIFT_ASYNC(3) WK_API_AVAILABLE(macos(11.0), ios(14.0));
/*
@abstract Called after using WKNavigationActionPolicyDownload.
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKScriptMessageHandlerWithReply.h (277214 => 277215)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKScriptMessageHandlerWithReply.h 2021-05-08 00:22:46 UTC (rev 277214)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKScriptMessageHandlerWithReply.h 2021-05-08 00:30:35 UTC (rev 277215)
@@ -87,7 +87,8 @@
- The _javascript_ promise is fulfilled with the value 42.
- _javascript_ execution continues and the value 42 is returned.
*/
-- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message replyHandler:(void (^)(id _Nullable reply, NSString *_Nullable errorMessage))replyHandler WK_API_AVAILABLE(macos(11.0), ios(14.0));
+- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message replyHandler:(void (^)(id _Nullable reply, NSString *_Nullable errorMessage))replyHandler WK_SWIFT_ASYNC(3) WK_API_AVAILABLE(macos(11.0), ios(14.0));
+
@end
NS_ASSUME_NONNULL_END
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegate.h (277214 => 277215)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegate.h 2021-05-08 00:22:46 UTC (rev 277214)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegate.h 2021-05-08 00:30:35 UTC (rev 277215)
@@ -144,7 +144,7 @@
@param decisionHandler The completion handler to call once the decision is made
@discussion If not implemented, the result is the same as calling the decisionHandler with WKPermissionDecisionPrompt.
*/
-- (void)webView:(WKWebView *)webView requestMediaCapturePermissionForOrigin:(WKSecurityOrigin *)origin initiatedByFrame:(WKFrameInfo *)frame type:(WKMediaCaptureType)type decisionHandler:(void (^)(WKPermissionDecision decision))decisionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)webView:(WKWebView *)webView requestMediaCapturePermissionForOrigin:(WKSecurityOrigin *)origin initiatedByFrame:(WKFrameInfo *)frame type:(WKMediaCaptureType)type decisionHandler:(void (^)(WKPermissionDecision decision))decisionHandler WK_SWIFT_ASYNC_NAME(webView(_:decideMediaCapturePermissionsFor:initiatedBy:type:)) WK_SWIFT_ASYNC(5) WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
/*! @abstract Allows your app to determine whether or not the given security origin should have access to the device's orientation and motion.
@param securityOrigin The security origin which requested access to the device's orientation and motion.
@@ -200,7 +200,7 @@
* Pass a valid UIContextMenuConfiguration to show a context menu, or pass nil to not show a context menu.
*/
-- (void)webView:(WKWebView *)webView contextMenuConfigurationForElement:(WKContextMenuElementInfo *)elementInfo completionHandler:(void (^)(UIContextMenuConfiguration * _Nullable configuration))completionHandler WK_API_AVAILABLE(ios(13.0));
+- (void)webView:(WKWebView *)webView contextMenuConfigurationForElement:(WKContextMenuElementInfo *)elementInfo completionHandler:(void (^)(UIContextMenuConfiguration * _Nullable configuration))completionHandler WK_SWIFT_ASYNC_NAME(webView(_:contextMenuConfigurationFor:)) WK_API_AVAILABLE(ios(13.0));
/**
* @abstract Called when the context menu will be presented.
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h (277214 => 277215)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h 2021-05-08 00:22:46 UTC (rev 277214)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h 2021-05-08 00:30:35 UTC (rev 277215)
@@ -333,7 +333,11 @@
The above function text will create a promise that will fulfull with the value 42 after a one second delay, wait for it to resolve, then return the fulfillment value of 42.
*/
+#ifdef NS_SWIFT_ASYNC_NAME
+- (void)callAsyncJavaScript:(NSString *)functionBody arguments:(nullable NSDictionary<NSString *, id> *)arguments inFrame:(nullable WKFrameInfo *)frame inContentWorld:(WKContentWorld *)contentWorld completionHandler:(void (^ _Nullable)(_Nullable_result id, NSError * _Nullable error))completionHandler NS_REFINED_FOR_SWIFT WK_API_AVAILABLE(macos(11.0), ios(14.0));
+#else
- (void)callAsyncJavaScript:(NSString *)functionBody arguments:(nullable NSDictionary<NSString *, id> *)arguments inFrame:(nullable WKFrameInfo *)frame inContentWorld:(WKContentWorld *)contentWorld completionHandler:(void (^ _Nullable)(_Nullable id, NSError * _Nullable error))completionHandler NS_REFINED_FOR_SWIFT WK_API_AVAILABLE(macos(11.0), ios(14.0));
+#endif
/*! @abstract Closes all out-of-window media presentations in a WKWebView.
@discussion Includes picture-in-picture and fullscreen.
@@ -401,9 +405,9 @@
device scale. The completionHandler is passed the image of the viewport contents or an error.
*/
#if TARGET_OS_IPHONE
-- (void)takeSnapshotWithConfiguration:(nullable WKSnapshotConfiguration *)snapshotConfiguration completionHandler:(void (^)(UIImage * _Nullable snapshotImage, NSError * _Nullable error))completionHandler WK_API_AVAILABLE(ios(11.0));
+- (void)takeSnapshotWithConfiguration:(nullable WKSnapshotConfiguration *)snapshotConfiguration completionHandler:(void (^)(UIImage * _Nullable snapshotImage, NSError * _Nullable error))completionHandler WK_SWIFT_ASYNC_NAME(takeSnapshot(configuration:)) WK_API_AVAILABLE(ios(11.0));
#else
-- (void)takeSnapshotWithConfiguration:(nullable WKSnapshotConfiguration *)snapshotConfiguration completionHandler:(void (^)(NSImage * _Nullable snapshotImage, NSError * _Nullable error))completionHandler WK_API_AVAILABLE(macos(10.13));
+- (void)takeSnapshotWithConfiguration:(nullable WKSnapshotConfiguration *)snapshotConfiguration completionHandler:(void (^)(NSImage * _Nullable snapshotImage, NSError * _Nullable error))completionHandler WK_SWIFT_ASYNC_NAME(takeSnapshot(configuration:)) WK_API_AVAILABLE(macos(10.13));
#endif
/*! @abstract Create a PDF document representation from the web page currently displayed in the WKWebView
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.h (277214 => 277215)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.h 2021-05-08 00:22:46 UTC (rev 277214)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.h 2021-05-08 00:30:35 UTC (rev 277215)
@@ -60,7 +60,7 @@
@param dataTypes The website data types to fetch records for.
@param completionHandler A block to invoke when the data records have been fetched.
*/
-- (void)fetchDataRecordsOfTypes:(NSSet<NSString *> *)dataTypes completionHandler:(void (^)(NSArray<WKWebsiteDataRecord *> *))completionHandler;
+- (void)fetchDataRecordsOfTypes:(NSSet<NSString *> *)dataTypes completionHandler:(void (^)(NSArray<WKWebsiteDataRecord *> *))completionHandler WK_SWIFT_ASYNC_NAME(dataRecords(ofTypes:));
/*! @abstract Removes website data of the given types for the given data records.
@param dataTypes The website data types that should be removed.