Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 967f1ef0f0c879e16d0e2140336e023c82c95172
https://github.com/WebKit/WebKit/commit/967f1ef0f0c879e16d0e2140336e023c82c95172
Author: Elliott Williams <[email protected]>
Date: 2024-11-14 (Thu, 14 Nov 2024)
Changed paths:
M Source/WebKit/Configurations/Base.xcconfig
M Source/WebKit/UIProcess/API/Cocoa/ObjectiveCBlockConversions.swift
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.h
M Source/WebKit/UIProcess/API/Cocoa/WebKitSwiftOverlay.swift
Log Message:
-----------
[WebKit] Fix actor-isolation warnings in Swift overlay
https://bugs.webkit.org/show_bug.cgi?id=280924
rdar://problem/137317585
Reviewed by Geoffrey Garen.
In https://commits.webkit.org/278930@main, we annotated WebKit's ObjC
API to mark main-thread-only classes and callback blocks. Refactor the
Swift overlays of these APIs to match.
* Source/WebKit/Configurations/Base.xcconfig: Enable the
"IsolatedDefaultValues" feature, which makes default values of
functions initialize in the same isolation domain. This means that in
an async function like
public func pdf(configuration: WKPDFConfiguration = .init()) async throws
-> Data
a caller using the default value must either be in the same isolation
domain as WKPDFConfiguration (the main thread), or make the call
asynchronously with `await webView.pdf()`.
See also:
https://github.com/swiftlang/swift-evolution/blob/main/proposals/0411-isolated-default-values.md
* Source/WebKit/UIProcess/API/Cocoa/ObjectiveCBlockConversions.swift:
Mark the closures returned by these `Result<_,_>` wrappers as
@MainActor. Mark the higher-order static functions `nonisolated`.
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.h: Add missing
nullability annotations to
-createWebArchiveDataWithCompletionHandler:. This is not a
source-breaking change because the method has a Swift overlay method
with correct nullability. We never noticed this because of automatic
optional promotion in the ObjectiveCBlockConversions funcctions.
* Source/WebKit/UIProcess/API/Cocoa/WebKitSwiftOverlay.swift:
- Add missing @MainActor annotations to completion handlers to match
the ObjC API. Mark these as @preconcurrency to avoid source breaks
for clients in Swift 5 mode.
- Refactor use of Optional.map to pass an actual closure, not a
function parameter. This is required for the return type to infer
the @MainActor isolation of the closure returned by
ObjectiveCBlockConversions functions.
(WKWebView.callAsyncJavaScript(_:arguments:in:in:completionHandler:Error:)):
(WKWebView.createPDF(_:completionHandler:Error:)):
(WKWebView.createWebArchiveData(_:Error:)):
(WKWebView.evaluateJavaScript(_:in:in:completionHandler:Error:)):
Canonical link: https://commits.webkit.org/286620@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes