Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 453be733611550f245d8fcffc9eaba0243f6abbe
https://github.com/WebKit/WebKit/commit/453be733611550f245d8fcffc9eaba0243f6abbe
Author: Richard Robinson <[email protected]>
Date: 2024-12-11 (Wed, 11 Dec 2024)
Changed paths:
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.h
M Tools/TestWebKitAPI/Tests/WebKit Swift/WKWebViewSwiftOverlayTests.swift
Log Message:
-----------
Calling `WKWebView.evaluateJavaScript` in an async context crashes if nothing
is returned by JS
https://bugs.webkit.org/show_bug.cgi?id=282918
rdar://139618495
Reviewed by Abrar Rahman Protyasha.
When an Objective-C method that has a completion handler with two nullable
parameters, one of which is `NSError`, is called from
Swift as an async method, Swift expects exactly one of the parameters to be
nil, and makes the return type non-nil.
However, it is valid for the `evaluateJavaScript` functions to return nil as
the return value even when there is no error. As a result,
this causes a crash whenever nil is returned.
Fix by using the correct annotation to inform Swift that nil is a valid return
value.
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.h:
* Tools/TestWebKitAPI/Tests/WebKit Swift/WKWebViewSwiftOverlay.swift:
(WKWebViewSwiftOverlayTests.evaluateJavaScriptWithNilResponse):
Canonical link: https://commits.webkit.org/287682@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