Skip to content

Commit

Permalink
Annotate some main-thread-only classes and protocols in WebKit API
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=273798
rdar://127629908

Reviewed by Brady Eidson.

Most WebKit APIs are main-thread-only so let's say so for better
ergonomics and error checking for clients.

I manually tested these classes:

WKBackForwardList
WKBackForwardListItem
WKWebViewConfiguration
WKUserContentController
WKContentRuleList
WKContentRuleListStore
WKContentWorld
WKContextMenuElementInfo
WKDownload
WKFindConfiguration
WKFindResult
WKFrameInfo
WKHTTPCookieStore
WKNavigation
WKNavigationAction
WKNavigationResponse
WKPreferences
WKProcessPool
WKScriptMessage
WKWebsiteDataStore
WKOpenPanelParameters
WKPDFConfiguration
WKSecurityOrigin
WKSnapshotConfiguration
WKUserScript
WKWebpagePreferences
WKWebsiteDataRecord
WKWebView
WKWindowFeatures

...and these callback-to-WebKit APIs:

WKDownloadDelegate
   - decideDestinationUsingResponse
   - willPerformHTTPRedirection
   - didReceiveAuthenticationChallenge

WKUIDelegate
   - runJavaScriptAlertPanelWithMessage
   - runJavaScriptConfirmPanelWithMessage
   - runJavaScriptTextInputPanelWithPrompt
   - requestMediaCapturePermissionForOrigin
   - requestDeviceOrientationAndMotionPermissionForOrigin
   - contextMenuConfigurationForElement
   - showLockdownModeFirstUseMessage
   - runOpenPanelWithParameters

WKScriptMessageHandlerWithReply
   - didReceiveScriptMessage

...and verified that they compile when used in "isolated" (i.e. main thread)
code and fail to compile when used in "nonisolated" (i.e. secondary thread)
code.

I manually tested these protocols:

WKHTTPCookieStoreObserver
WKUIDelegate
WKURLSchemeHandler
WKScriptMessageHandler
WKScriptMessageHandlerWithReply
WKDownloadDelegate
WKNavigationDelegate

...and these callback-to-client APIs:

WKContentRuleListStore
   - compileContentRuleListForIdentifier
   - lookUpContentRuleListForIdentifier
   - removeContentRuleListForIdentifier
   - getAvailableContentRuleListIdentifiers

WKDownload
   - cancel

WKHTTPCookieStore
   - getAllCookies
   - setCookie
   - deleteCookie
   - setCookiePolicy
   - getCookiePolicy

WKWebsiteDataStore
   - fetchDataRecordsOfTypes
   - removeDataOfTypes
   - removeDataOfTypes
   - removeDataStoreForIdentifier
   - fetchAllDataStoreIdentifiers

* WKWebView.h
   - evaluateJavaScript
   - evaluateJavaScript
   - callAsyncJavaScript
   - closeAllMediaPresentationsWithCompletionHandler
   - pauseAllMediaPlaybackWithCompletionHandler
   - setAllMediaPlaybackSuspended
   - requestMediaPlaybackStateWithCompletionHandler
   - setCameraCaptureState
   - setMicrophoneCaptureState
   - takeSnapshotWithConfiguration
   - createPDFWithConfiguration
   - createWebArchiveDataWithCompletionHandler
   - findString
   - startDownloadUsingRequest
   - resumeDownloadFromResumeData

...and verified that they compile when implemented in "isolated" (i.e. main
thread) code.

These classes are thread safe and need no annotation:

WKURLSchemeTask

Canonical link: https://commits.webkit.org/278930@main
  • Loading branch information
geoffreygaren committed May 17, 2024
1 parent a57fafd commit 13873b2
Show file tree
Hide file tree
Showing 36 changed files with 90 additions and 48 deletions.
6 changes: 6 additions & 0 deletions Source/WebKit/Shared/API/Cocoa/WKFoundation.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@
#define WK_NULLABLE_RESULT _Nullable
#endif

#ifdef NS_SWIFT_UI_ACTOR
#define WK_SWIFT_UI_ACTOR NS_SWIFT_UI_ACTOR
#else
#define WK_SWIFT_UI_ACTOR
#endif

#ifndef WK_FRAMEWORK_HEADER_POSTPROCESSING_ENABLED

#define WK_API_AVAILABLE(...)
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKBackForwardList.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
*/
NS_ASSUME_NONNULL_BEGIN

WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(10.10), ios(8.0))
@interface WKBackForwardList : NSObject

Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
*/
NS_ASSUME_NONNULL_BEGIN

WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(10.10), ios(8.0))
@interface WKBackForwardListItem : NSObject

Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKContentRuleList.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#import <Foundation/Foundation.h>

WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(10.13), ios(11.0))
@interface WKContentRuleList : NSObject

Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

@class WKContentRuleList;

WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(10.13), ios(11.0))
@interface WKContentRuleListStore : NSObject

Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKContentWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ For example:
- If you store a variable in JavaScript in the scope of a particular WKContentWorld while viewing a particular web page document, after navigating to a new document that variable will be gone.
- If you store a variable in JavaScript in the scope of a particular WKContentWorld in one WKWebView, that variable will not exist in the same world in another WKWebView.
*/
WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(11.0), ios(14.0))
@interface WKContentWorld : NSObject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

NS_ASSUME_NONNULL_BEGIN

WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(ios(13.0))
@interface WKContextMenuElementInfo : NSObject

Expand Down
3 changes: 2 additions & 1 deletion Source/WebKit/UIProcess/API/Cocoa/WKDownload.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
NS_ASSUME_NONNULL_BEGIN

WK_CLASS_AVAILABLE(macos(11.3), ios(14.5))
WK_SWIFT_UI_ACTOR
@interface WKDownload : NSObject<NSProgressReporting>

/* @abstract The request used to initiate this download.
Expand All @@ -53,7 +54,7 @@ WK_CLASS_AVAILABLE(macos(11.3), ios(14.5))
@discussion To attempt to resume the download, call WKWebView resumeDownloadFromResumeData: with the data given to the completionHandler.
If no resume attempt is possible with this server, completionHandler will be called with nil.
*/
- (void)cancel:(void(^ _Nullable)(NSData * _Nullable resumeData))completionHandler;
- (void)cancel:(WK_SWIFT_UI_ACTOR void(^ _Nullable)(NSData * _Nullable resumeData))completionHandler;

@end

Expand Down
7 changes: 4 additions & 3 deletions Source/WebKit/UIProcess/API/Cocoa/WKDownloadDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ typedef NS_ENUM(NSInteger, WKDownloadRedirectPolicy) {

NS_ASSUME_NONNULL_BEGIN

WK_SWIFT_UI_ACTOR
@protocol WKDownloadDelegate <NSObject>

@required
Expand All @@ -56,7 +57,7 @@ NS_ASSUME_NONNULL_BEGIN
URL is non-null, it must be a file that does not exist in a directory that does exist
and can be written to.
*/
- (void)download:(WKDownload *)download decideDestinationUsingResponse:(NSURLResponse *)response suggestedFilename:(NSString *)suggestedFilename completionHandler:(void (^)(NSURL * _Nullable destination))completionHandler;
- (void)download:(WKDownload *)download decideDestinationUsingResponse:(NSURLResponse *)response suggestedFilename:(NSString *)suggestedFilename completionHandler:(WK_SWIFT_UI_ACTOR void (^)(NSURL * _Nullable destination))completionHandler;

@optional

Expand All @@ -68,7 +69,7 @@ NS_ASSUME_NONNULL_BEGIN
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 WK_SWIFT_ASYNC_NAME(download(_:decidedPolicyForHTTPRedirection:newRequest:)) WK_SWIFT_ASYNC(4);
- (void)download:(WKDownload *)download willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request decisionHandler:(WK_SWIFT_UI_ACTOR 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.
Expand All @@ -80,7 +81,7 @@ NS_ASSUME_NONNULL_BEGIN
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 WK_SWIFT_ASYNC_NAME(download(_:respondTo:));
- (void)download:(WKDownload *)download didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(WK_SWIFT_UI_ACTOR 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.
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKFindConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

NS_ASSUME_NONNULL_BEGIN

WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(10.15.4), ios(13.4))
@interface WKFindConfiguration : NSObject <NSCopying>

Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKFindResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

NS_ASSUME_NONNULL_BEGIN

WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(10.15.4), ios(13.4))
@interface WKFindResult : NSObject <NSCopying>

Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKFrameInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
*/
NS_ASSUME_NONNULL_BEGIN

WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(10.10), ios(8.0))
@interface WKFrameInfo : NSObject <NSCopying>

Expand Down
12 changes: 7 additions & 5 deletions Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ typedef NS_ENUM(NSInteger, WKCookiePolicy) {
} NS_SWIFT_NAME(WKHTTPCookieStore.CookiePolicy) WK_API_AVAILABLE(macos(14.0), ios(17.0));

WK_API_AVAILABLE(macos(10.13), ios(11.0))
WK_SWIFT_UI_ACTOR
@protocol WKHTTPCookieStoreObserver <NSObject>
@optional
- (void)cookiesDidChangeInCookieStore:(WKHTTPCookieStore *)cookieStore;
Expand All @@ -46,25 +47,26 @@ WK_API_AVAILABLE(macos(10.13), ios(11.0))
A WKHTTPCookieStore object allows managing the HTTP cookies associated with a particular WKWebsiteDataStore.
*/
WK_CLASS_AVAILABLE(macos(10.13), ios(11.0))
WK_SWIFT_UI_ACTOR
@interface WKHTTPCookieStore : NSObject

- (instancetype)init NS_UNAVAILABLE;

/*! @abstract Fetches all stored cookies.
@param completionHandler A block to invoke with the fetched cookies.
*/
- (void)getAllCookies:(void (^)(NSArray<NSHTTPCookie *> *))completionHandler;
- (void)getAllCookies:(WK_SWIFT_UI_ACTOR void (^)(NSArray<NSHTTPCookie *> *))completionHandler;

/*! @abstract Set a cookie.
@param cookie The cookie to set.
@param completionHandler A block to invoke once the cookie has been stored.
*/
- (void)setCookie:(NSHTTPCookie *)cookie completionHandler:(nullable void (^)(void))completionHandler;
- (void)setCookie:(NSHTTPCookie *)cookie completionHandler:(nullable WK_SWIFT_UI_ACTOR void (^)(void))completionHandler;

/*! @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 WK_SWIFT_ASYNC_NAME(deleteCookie(_:));
- (void)deleteCookie:(NSHTTPCookie *)cookie completionHandler:(nullable WK_SWIFT_UI_ACTOR void (^)(void))completionHandler WK_SWIFT_ASYNC_NAME(deleteCookie(_:));

/*! @abstract Adds a WKHTTPCookieStoreObserver object with the cookie store.
@param observer The observer object to add.
Expand All @@ -82,12 +84,12 @@ WK_CLASS_AVAILABLE(macos(10.13), ios(11.0))
@param policy A value indicating whether cookies are allowed. The default value is WKCookiePolicyAllow.
@param completionHandler A block to invoke once the cookie policy has been set.
*/
- (void)setCookiePolicy:(WKCookiePolicy)policy completionHandler:(nullable void (^)(void))completionHandler WK_API_AVAILABLE(macos(14.0), ios(17.0));
- (void)setCookiePolicy:(WKCookiePolicy)policy completionHandler:(nullable WK_SWIFT_UI_ACTOR void (^)(void))completionHandler WK_API_AVAILABLE(macos(14.0), ios(17.0));

/*! @abstract Get whether cookies are allowed.
@param completionHandler A block to invoke with the value of whether cookies are allowed.
*/
- (void)getCookiePolicy:(void (^)(WKCookiePolicy))completionHandler WK_SWIFT_ASYNC_NAME(getter:cookiePolicy()) WK_API_AVAILABLE(macos(14.0), ios(17.0));
- (void)getCookiePolicy:(WK_SWIFT_UI_ACTOR void (^)(WKCookiePolicy))completionHandler WK_SWIFT_ASYNC_NAME(getter:cookiePolicy()) WK_API_AVAILABLE(macos(14.0), ios(17.0));

@end

Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKNavigation.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
also passed to the navigation delegate methods, to uniquely identify a webpage
load from start to finish.
*/
WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(10.10), ios(8.0))
@interface WKNavigation : NSObject

Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKNavigationAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ typedef NS_ENUM(NSInteger, WKNavigationType) {
/*!
A WKNavigationAction object contains information about an action that may cause a navigation, used for making policy decisions.
*/
WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(10.10), ios(8.0))
@interface WKNavigationAction : NSObject

Expand Down
11 changes: 6 additions & 5 deletions Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ typedef NS_ENUM(NSInteger, WKNavigationResponsePolicy) {
methods for tracking progress for main frame navigations and for deciding
policy for main frame and subframe navigations.
*/
WK_SWIFT_UI_ACTOR
@protocol WKNavigationDelegate <NSObject>

@optional
Expand All @@ -77,7 +78,7 @@ typedef NS_ENUM(NSInteger, WKNavigationResponsePolicy) {
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 WK_SWIFT_ASYNC(3);
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(WK_SWIFT_UI_ACTOR 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.
Expand All @@ -91,7 +92,7 @@ typedef NS_ENUM(NSInteger, WKNavigationResponsePolicy) {
@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_SWIFT_ASYNC(4) WK_API_AVAILABLE(macos(10.15), ios(13.0));
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction preferences:(WKWebpagePreferences *)preferences decisionHandler:(WK_SWIFT_UI_ACTOR 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.
Expand All @@ -102,7 +103,7 @@ typedef NS_ENUM(NSInteger, WKNavigationResponsePolicy) {
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 WK_SWIFT_ASYNC(3);
- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(WK_SWIFT_UI_ACTOR void (^)(WKNavigationResponsePolicy))decisionHandler WK_SWIFT_ASYNC(3);

/*! @abstract Invoked when a main frame navigation starts.
@param webView The web view invoking the delegate method.
Expand Down Expand Up @@ -155,7 +156,7 @@ typedef NS_ENUM(NSInteger, WKNavigationResponsePolicy) {
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 WK_SWIFT_ASYNC_NAME(webView(_:respondTo:));
- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(WK_SWIFT_UI_ACTOR 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.
Expand All @@ -167,7 +168,7 @@ typedef NS_ENUM(NSInteger, WKNavigationResponsePolicy) {
@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_SWIFT_ASYNC_NAME(webView(_:shouldAllowDeprecatedTLSFor:)) WK_SWIFT_ASYNC(3) WK_API_AVAILABLE(macos(11.0), ios(14.0));
- (void)webView:(WKWebView *)webView authenticationChallenge:(NSURLAuthenticationChallenge *)challenge shouldAllowDeprecatedTLS:(WK_SWIFT_UI_ACTOR 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.
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKNavigationResponse.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN

/*! Contains information about a navigation response, used for making policy decisions.
*/
WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(10.10), ios(8.0))
@interface WKNavigationResponse : NSObject

Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKOpenPanelParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN

/*! WKOpenPanelParameters contains parameters that a file upload control has specified.
*/
WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(10.12))
@interface WKOpenPanelParameters : NSObject

Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKPDFConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

NS_ASSUME_NONNULL_BEGIN

WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(10.15.4), ios(13.4))
@interface WKPDFConfiguration : NSObject <NSCopying>

Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKPreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
view. The preferences object associated with a web view is specified by
its web view configuration.
*/
WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(10.10), ios(8.0))
@interface WKPreferences : NSObject <NSSecureCoding>

Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
implementation-defined process limit is reached; after that, web views
with the same process pool end up sharing web content processes.
*/
WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(10.10), ios(8.0))
@interface WKProcessPool : NSObject <NSSecureCoding>
@end
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKScriptMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
/*! A WKScriptMessage object contains information about a message sent from
a webpage.
*/
WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(10.10), ios(8.0))
@interface WKScriptMessage : NSObject

Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKScriptMessageHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ NS_ASSUME_NONNULL_BEGIN
/*! A class conforming to the WKScriptMessageHandler protocol provides a
method for receiving messages from JavaScript running in a webpage.
*/
WK_SWIFT_UI_ACTOR
@protocol WKScriptMessageHandler <NSObject>

@required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ NS_ASSUME_NONNULL_BEGIN
/*! A class conforming to the WKScriptMessageHandlerWithReply protocol provides a
method for receiving messages from JavaScript running in a webpage and replying to them asynchronously.
*/
WK_SWIFT_UI_ACTOR
@protocol WKScriptMessageHandlerWithReply <NSObject>

/*! @abstract Invoked when a script message is received from a webpage.
Expand Down Expand Up @@ -87,7 +88,7 @@ method for receiving messages from JavaScript running in a webpage and replying
- 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_SWIFT_ASYNC(3) WK_API_AVAILABLE(macos(11.0), ios(14.0));
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message replyHandler:(WK_SWIFT_UI_ACTOR void (^)(id _Nullable reply, NSString *_Nullable errorMessage))replyHandler WK_SWIFT_ASYNC(3) WK_API_AVAILABLE(macos(11.0), ios(14.0));

@end

Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/UIProcess/API/Cocoa/WKSecurityOrigin.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
*/
NS_ASSUME_NONNULL_BEGIN

WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(10.11), ios(9.0))
@interface WKSecurityOrigin : NSObject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

NS_ASSUME_NONNULL_BEGIN

WK_SWIFT_UI_ACTOR
WK_CLASS_AVAILABLE(macos(10.13), ios(11.0))
@interface WKSnapshotConfiguration : NSObject <NSCopying>

Expand Down
Loading

1 comment on commit 13873b2

@danielpunkass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for doing this! I was about to file a bug after running into issues with WebKit compiling with Swift 6 on the Xcode beta.

Please sign in to comment.