[webkit-changes] [WebKit/WebKit] 453be7: Calling `WKWebView.evaluateJavaScript` in an async...
Richard Robinson
noreply at github.com
Wed Dec 11 11:05:43 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 453be733611550f245d8fcffc9eaba0243f6abbe
https://github.com/WebKit/WebKit/commit/453be733611550f245d8fcffc9eaba0243f6abbe
Author: Richard Robinson <richard_robinson2 at apple.com>
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
More information about the webkit-changes
mailing list