⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 277215 in webkit


Ignore:
Timestamp:
May 7, 2021, 5:30:35 PM (5 years ago)
Author:
James Savage
Message:

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.
Location:
trunk/Source/WebKit
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r277210 r277215  
     12021-05-07  James Savage  <james.savage@apple.com>
     2
     3        Validate Swift async imports.
     4        https://bugs.webkit.org/show_bug.cgi?id=225134
     5        <rdar://73620237>
     6
     7        Reviewed by Sam Weinig.
     8
     9        Audit our imported Objective-C API for correct translations to Swift's
     10        upcoming concurrency feature. This mostly entails removing redundant
     11        words, tagging methods which Swift's heuristics missed, and in some
     12        cases disabling methods that do not follow Swift's async conventions.
     13
     14        * Shared/API/Cocoa/WKFoundation.h: Because the Foundation macros used
     15        for Swift async won't exist in all SDKs, provide our own wrapper around
     16        them to avoid undefined macro errors.
     17        * SwiftOverlay/Configurations/WebKitSwiftOverlay.xcconfig: Passing these
     18        flags to older tools will result in errors, so only so conditionally.
     19        * SwiftOverlay/WebKitSwiftOverlay.xcodeproj/project.pbxproj: Added a
     20        new source file reference for generated sources. These will be copied
     21        from WebKitAdditions if available, or replaced with empty sources for
     22        compatibility.
     23        * UIProcess/API/Cocoa/NSAttributedString.h: Adopt new attributes to
     24        define an explicit Swift async name.
     25        * UIProcess/API/Cocoa/WKContentRuleListStore.h: Ditto.
     26        * UIProcess/API/Cocoa/WKDownloadDelegate.h: In this case I also apply
     27        NS_SWIFT_NAME as the "decisionHandler" argument would otherwise not
     28        import as async. Despite using a different macro, I'm just using
     29        NS_SWIFT_ASYNC_NAME to check for these changes as all these annotations
     30        should exist or not-exist at once.
     31        * UIProcess/API/Cocoa/WKHTTPCookieStore.h: Ditto.
     32        * UIProcess/API/Cocoa/WKNavigationDelegate.h: Ditto.
     33        * UIProcess/API/Cocoa/WKScriptMessageHandlerWithReply.h: Ditto.
     34        * UIProcess/API/Cocoa/WKUIDelegate.h: Ditto.
     35        * UIProcess/API/Cocoa/WKWebView.h: _Nullable_result is a new annotation
     36        which specifies that the result and error are not mutually exclusive,
     37        but rather than we can expect a nil result in cases where there are not
     38        an error. For the same reason as above, we only want to refer to this
     39        keyword conditionally.
     40        * UIProcess/API/Cocoa/WKWebsiteDataStore.h: Ditto.
     41
    1422021-05-07  Tim Horton  <timothy_horton@apple.com>
    243
  • trunk/Source/WebKit/Shared/API/Cocoa/WKFoundation.h

    r276125 r277215  
    3333#endif
    3434
     35#ifdef NS_SWIFT_ASYNC_NAME
     36#define WK_SWIFT_ASYNC_NAME(...) NS_SWIFT_ASYNC_NAME(__VA_ARGS__)
     37#else
     38#define WK_SWIFT_ASYNC_NAME(...)
     39#endif
     40
     41#ifdef NS_SWIFT_ASYNC
     42#define WK_SWIFT_ASYNC(...) NS_SWIFT_ASYNC(__VA_ARGS__)
     43#else
     44#define WK_SWIFT_ASYNC(...)
     45#endif
     46
    3547#ifndef WK_FRAMEWORK_HEADER_POSTPROCESSING_ENABLED
    3648
  • trunk/Source/WebKit/SwiftOverlay/Configurations/WebKitSwiftOverlay.xcconfig

    r269273 r277215  
    5151INSTALL_PATH = $(WK_ALTERNATE_FRAMEWORKS_DIR)$(SWIFT_OVERLAY_INSTALL_PATH);
    5252
    53 OTHER_SWIFT_FLAGS = -module-link-name $(SWIFT_MODULE_LINK_NAME) -autolink-force-load -runtime-compatibility-version none -disable-autolinking-runtime-compatibility-dynamic-replacements;
     53WK_SWIFT_CONCURRENCY_FLAGS = -Xfrontend -enable-experimental-concurrency;
     54WK_SWIFT_CONCURRENCY_FLAGS[sdk=macos*11.*] = ;
     55WK_SWIFT_CONCURRENCY_FLAGS[sdk=iphone*14.*] = ;
     56
     57OTHER_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);
    5458SWIFT_MODULE_LINK_NAME = swift$(PRODUCT_NAME);
    5559
  • trunk/Source/WebKit/SwiftOverlay/WebKitSwiftOverlay.xcodeproj/project.pbxproj

    r267352 r277215  
    1818                B3B8FEEF2502BAA0006172CA /* ObjectiveCBlockConversions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3B8FEEE2502BAA0006172CA /* ObjectiveCBlockConversions.swift */; };
    1919                B3B8FEF02502BAA0006172CA /* ObjectiveCBlockConversions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3B8FEEE2502BAA0006172CA /* ObjectiveCBlockConversions.swift */; };
     20                B3DF244C2638BE240038D95A /* WebKitSwiftOverlayAdditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B31B03FD2637EF6500D67EAD /* WebKitSwiftOverlayAdditions.swift */; };
     21                B3DF244D2638BE290038D95A /* WebKitSwiftOverlayAdditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B31B03FD2637EF6500D67EAD /* WebKitSwiftOverlayAdditions.swift */; };
    2022/* End PBXBuildFile section */
    2123
    … …  
    4244                7D20070722F4EB72008DF640 /* WebKitSwiftOverlayTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WebKitSwiftOverlayTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
    4345                7D20071622F4ECCA008DF640 /* WebKitSwiftOverlayTests-maccatalyst.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "WebKitSwiftOverlayTests-maccatalyst.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
     46                B31B03FD2637EF6500D67EAD /* WebKitSwiftOverlayAdditions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WebKitSwiftOverlayAdditions.swift; path = usr/local/include/WebKitAdditions/WebKitSwiftOverlayAdditions.swift; sourceTree = BUILT_PRODUCTS_DIR; };
    4447                B3A5D38823F78F5400B17727 /* WebKitTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebKitTests.swift; sourceTree = "<group>"; };
    4548                B3A5D39123F790DB00B17727 /* WebKitSwiftOverlay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WebKitSwiftOverlay.swift; path = ../UIProcess/API/Cocoa/WebKitSwiftOverlay.swift; sourceTree = SOURCE_ROOT; };
    … …  
    9598                                B3B8FEEE2502BAA0006172CA /* ObjectiveCBlockConversions.swift */,
    9699                                B3A5D39123F790DB00B17727 /* WebKitSwiftOverlay.swift */,
     100                                B31B03FD2637EF6500D67EAD /* WebKitSwiftOverlayAdditions.swift */,
    97101                        );
    98102                        name = "Swift Overlay";
    … …  
    175179                        buildConfigurationList = 7D20067B22F2652E008DF640 /* Build configuration list for PBXNativeTarget "WebKitSwiftOverlay" */;
    176180                        buildPhases = (
     181                                B31B03FC2637EEBD00D67EAD /* Copy Additional Sources */,
    177182                                7D20067122F2652E008DF640 /* Headers */,
    178183                                7D20067222F2652E008DF640 /* Sources */,
    … …  
    193198                        buildConfigurationList = 7D20068D22F26721008DF640 /* Build configuration list for PBXNativeTarget "WebKitSwiftOverlay-maccatalyst" */;
    194199                        buildPhases = (
     200                                B31B04002637F22E00D67EAD /* Copy Additional Sources */,
    195201                                7D20068322F26721008DF640 /* Headers */,
    196202                                7D20068422F26721008DF640 /* Sources */,
    … …  
    346352                        shellScript = "exec \"${SOURCE_ROOT}/SwiftOverlay/install-swiftmodules.sh\"\n";
    347353                };
     354                B31B03FC2637EEBD00D67EAD /* Copy Additional Sources */ = {
     355                        isa = PBXShellScriptBuildPhase;
     356                        buildActionMask = 2147483647;
     357                        files = (
     358                        );
     359                        inputFileListPaths = (
     360                        );
     361                        inputPaths = (
     362                                "$(SDK_DIR)/usr/local/include/WebKitAdditions/WebKitSwiftOverlayAdditions.swift",
     363                        );
     364                        name = "Copy Additional Sources";
     365                        outputFileListPaths = (
     366                        );
     367                        outputPaths = (
     368                                "$(BUILT_PRODUCTS_DIR)/usr/local/include/WebKitAdditions/WebKitSwiftOverlayAdditions.swift",
     369                        );
     370                        runOnlyForDeploymentPostprocessing = 0;
     371                        shellPath = /bin/sh;
     372                        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";
     373                };
     374                B31B04002637F22E00D67EAD /* Copy Additional Sources */ = {
     375                        isa = PBXShellScriptBuildPhase;
     376                        buildActionMask = 2147483647;
     377                        files = (
     378                        );
     379                        inputFileListPaths = (
     380                        );
     381                        inputPaths = (
     382                                "$(SDK_DIR)/usr/local/include/WebKitAdditions/WebKitSwiftOverlayAdditions.swift",
     383                        );
     384                        name = "Copy Additional Sources";
     385                        outputFileListPaths = (
     386                        );
     387                        outputPaths = (
     388                                "$(BUILT_PRODUCTS_DIR)/usr/local/include/WebKitAdditions/WebKitSwiftOverlayAdditions.swift",
     389                        );
     390                        runOnlyForDeploymentPostprocessing = 0;
     391                        shellPath = /bin/sh;
     392                        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";
     393                };
    348394/* End PBXShellScriptBuildPhase section */
    349395
    … …  
    355401                                B3B8FEEF2502BAA0006172CA /* ObjectiveCBlockConversions.swift in Sources */,
    356402                                B3A5D39223F790DB00B17727 /* WebKitSwiftOverlay.swift in Sources */,
     403                                B3DF244C2638BE240038D95A /* WebKitSwiftOverlayAdditions.swift in Sources */,
    357404                        );
    358405                        runOnlyForDeploymentPostprocessing = 0;
    … …  
    364411                                B3B8FEF02502BAA0006172CA /* ObjectiveCBlockConversions.swift in Sources */,
    365412                                B3A5D39323F790DB00B17727 /* WebKitSwiftOverlay.swift in Sources */,
     413                                B3DF244D2638BE290038D95A /* WebKitSwiftOverlayAdditions.swift in Sources */,
    366414                        );
    367415                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/WebKit/UIProcess/API/Cocoa/NSAttributedString.h

    r252174 r277215  
    7171*/
    7272+ (void)loadFromHTMLWithRequest:(NSURLRequest *)request options:(NSDictionary<NSAttributedStringDocumentReadingOptionKey, id> *)options completionHandler:(NSAttributedStringCompletionHandler)completionHandler
    73     NS_SWIFT_NAME(loadFromHTML(request:options:completionHandler:)) WK_API_AVAILABLE(macos(10.15), ios(13.0));
     73    NS_SWIFT_NAME(loadFromHTML(request:options:completionHandler:)) WK_SWIFT_ASYNC_NAME(fromHTML(request:options:)) WK_API_AVAILABLE(macos(10.15), ios(13.0));
    7474
    7575/*!
    … …  
    8686*/
    8787+ (void)loadFromHTMLWithFileURL:(NSURL *)fileURL options:(NSDictionary<NSAttributedStringDocumentReadingOptionKey, id> *)options completionHandler:(NSAttributedStringCompletionHandler)completionHandler
    88     NS_SWIFT_NAME(loadFromHTML(fileURL:options:completionHandler:)) WK_API_AVAILABLE(macos(10.15), ios(13.0));
     88    NS_SWIFT_NAME(loadFromHTML(fileURL:options:completionHandler:)) WK_SWIFT_ASYNC_NAME(fromHTML(fileURL:options:)) WK_API_AVAILABLE(macos(10.15), ios(13.0));
    8989
    9090/*!
    … …  
    100100*/
    101101+ (void)loadFromHTMLWithString:(NSString *)string options:(NSDictionary<NSAttributedStringDocumentReadingOptionKey, id> *)options completionHandler:(NSAttributedStringCompletionHandler)completionHandler
    102     NS_SWIFT_NAME(loadFromHTML(string:options:completionHandler:)) WK_API_AVAILABLE(macos(10.15), ios(13.0));
     102    NS_SWIFT_NAME(loadFromHTML(string:options:completionHandler:)) WK_SWIFT_ASYNC_NAME(fromHTML(_:options:)) WK_API_AVAILABLE(macos(10.15), ios(13.0));
    103103
    104104/*!
    … …  
    114114*/
    115115+ (void)loadFromHTMLWithData:(NSData *)data options:(NSDictionary<NSAttributedStringDocumentReadingOptionKey, id> *)options completionHandler:(NSAttributedStringCompletionHandler)completionHandler
    116     NS_SWIFT_NAME(loadFromHTML(data:options:completionHandler:)) WK_API_AVAILABLE(macos(10.15), ios(13.0));
     116    NS_SWIFT_NAME(loadFromHTML(data:options:completionHandler:)) WK_SWIFT_ASYNC_NAME(fromHTML(_:options:)) WK_API_AVAILABLE(macos(10.15), ios(13.0));
    117117
    118118@end
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.h

    r275166 r277215  
    3737
    3838- (void)compileContentRuleListForIdentifier:(NSString *)identifier encodedContentRuleList:(NSString *)encodedContentRuleList completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler;
    39 - (void)lookUpContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler;
     39
     40- (void)lookUpContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(WKContentRuleList *, NSError *))completionHandler WK_SWIFT_ASYNC_NAME(contentRuleList(forIdentifier:));
     41
    4042- (void)removeContentRuleListForIdentifier:(NSString *)identifier completionHandler:(void (^)(NSError *))completionHandler;
    41 - (void)getAvailableContentRuleListIdentifiers:(void (^)(NSArray<NSString *> *))completionHandler;
     43
     44- (void)getAvailableContentRuleListIdentifiers:(void (^)(NSArray<NSString *> *))completionHandler WK_SWIFT_ASYNC_NAME(availableIdentifiers());
    4245
    4346@end
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKDownloadDelegate.h

    r270790 r277215  
    6969 @discussion If you do not implement this method, all server suggested redirects will be taken.
    7070 */
    71 - (void)download:(WKDownload *)download willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request decisionHandler:(void (^)(WKDownloadRedirectPolicy))decisionHandler;
     71- (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);
    7272
    7373/* @abstract Invoked when the download needs to respond to an authentication challenge.
    … …  
    8181 @discussion If you do not implement this method, the web view will respond to the authentication challenge with the NSURLSessionAuthChallengeRejectProtectionSpace disposition.
    8282 */
    83 - (void)download:(WKDownload *)download didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler;
     83- (void)download:(WKDownload *)download didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler WK_SWIFT_ASYNC_NAME(download(_:respondTo:));
    8484
    8585/* @abstract Invoked when the download has finished successfully.
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.h

    r243376 r277215  
    6060 @param completionHandler A block to invoke once the cookie has been deleted.
    6161 */
    62 - (void)deleteCookie:(NSHTTPCookie *)cookie completionHandler:(nullable void (^)(void))completionHandler;
     62- (void)deleteCookie:(NSHTTPCookie *)cookie completionHandler:(nullable void (^)(void))completionHandler WK_SWIFT_ASYNC_NAME(deleteCookie(_:));
    6363
    6464/*! @abstract Adds a WKHTTPCookieStoreObserver object with the cookie store.
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegate.h

    r271813 r277215  
    7878 @discussion If you do not implement this method, the web view will load the request or, if appropriate, forward it to another application.
    7979 */
    80 - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler;
     80- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler WK_SWIFT_ASYNC(3);
    8181
    8282/*! @abstract Decides whether to allow or cancel a navigation.
    … …  
    9292 -webView:decidePolicyForNavigationAction:decisionHandler: will not be called.
    9393 */
    94 - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction preferences:(WKWebpagePreferences *)preferences decisionHandler:(void (^)(WKNavigationActionPolicy, WKWebpagePreferences *))decisionHandler WK_API_AVAILABLE(macos(10.15), ios(13.0));
     94- (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));
    9595
    9696/*! @abstract Decides whether to allow or cancel a navigation after its
    … …  
    103103 @discussion If you do not implement this method, the web view will allow the response, if the web view can show it.
    104104 */
    105 - (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler;
     105- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler WK_SWIFT_ASYNC(3);
    106106
    107107/*! @abstract Invoked when a main frame navigation starts.
    … …  
    156156 @discussion If you do not implement this method, the web view will respond to the authentication challenge with the NSURLSessionAuthChallengeRejectProtectionSpace disposition.
    157157 */
    158 - (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler;
     158- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler WK_SWIFT_ASYNC_NAME(webView(_:respondTo:));
    159159
    160160/*! @abstract Invoked when the web view's web content process is terminated.
    … …  
    168168 @param decisionHandler The decision handler you must invoke to respond to indicate whether or not to continue with the connection establishment.
    169169 */
    170 - (void)webView:(WKWebView *)webView authenticationChallenge:(NSURLAuthenticationChallenge *)challenge shouldAllowDeprecatedTLS:(void (^)(BOOL))decisionHandler WK_API_AVAILABLE(macos(11.0), ios(14.0));
     170- (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));
    171171
    172172/*
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKScriptMessageHandlerWithReply.h

    r271813 r277215  
    8888   - JavaScript execution continues and the value 42 is returned.
    8989 */
    90 - (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));
     90- (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));
     91
    9192@end
    9293
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegate.h

    r276125 r277215  
    145145 @discussion If not implemented, the result is the same as calling the decisionHandler with WKPermissionDecisionPrompt.
    146146 */
    147 - (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));
     147- (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));
    148148
    149149/*! @abstract Allows your app to determine whether or not the given security origin should have access to the device's orientation and motion.
    … …  
    201201 */
    202202
    203 - (void)webView:(WKWebView *)webView contextMenuConfigurationForElement:(WKContextMenuElementInfo *)elementInfo completionHandler:(void (^)(UIContextMenuConfiguration * _Nullable configuration))completionHandler WK_API_AVAILABLE(ios(13.0));
     203- (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));
    204204
    205205/**
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h

    r275984 r277215  
    334334 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.
    335335*/
     336#ifdef NS_SWIFT_ASYNC_NAME
     337- (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));
     338#else
    336339- (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));
     340#endif
    337341
    338342/*! @abstract Closes all out-of-window media presentations in a WKWebView.
    … …  
    402406 */
    403407#if TARGET_OS_IPHONE
    404 - (void)takeSnapshotWithConfiguration:(nullable WKSnapshotConfiguration *)snapshotConfiguration completionHandler:(void (^)(UIImage * _Nullable snapshotImage, NSError * _Nullable error))completionHandler WK_API_AVAILABLE(ios(11.0));
     408- (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));
    405409#else
    406 - (void)takeSnapshotWithConfiguration:(nullable WKSnapshotConfiguration *)snapshotConfiguration completionHandler:(void (^)(NSImage * _Nullable snapshotImage, NSError * _Nullable error))completionHandler WK_API_AVAILABLE(macos(10.13));
     410- (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));
    407411#endif
    408412
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.h

    r263570 r277215  
    6161  @param completionHandler A block to invoke when the data records have been fetched.
    6262*/
    63 - (void)fetchDataRecordsOfTypes:(NSSet<NSString *> *)dataTypes completionHandler:(void (^)(NSArray<WKWebsiteDataRecord *> *))completionHandler;
     63- (void)fetchDataRecordsOfTypes:(NSSet<NSString *> *)dataTypes completionHandler:(void (^)(NSArray<WKWebsiteDataRecord *> *))completionHandler WK_SWIFT_ASYNC_NAME(dataRecords(ofTypes:));
    6464
    6565/*! @abstract Removes website data of the given types for the given data records.
Note: See TracChangeset for help on using the changeset viewer.