Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 32ee401ab706355455e48265e18665e04268ea11
https://github.com/WebKit/WebKit/commit/32ee401ab706355455e48265e18665e04268ea11
Author: Timothy Hatcher <[email protected]>
Date: 2024-03-27 (Wed, 27 Mar 2024)
Changed paths:
M Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionMessagePort.h
M
Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIRuntimeCocoa.mm
M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionMessagePortCocoa.mm
M Source/WebKit/UIProcess/Extensions/WebExtensionMessagePort.h
M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIRuntime.mm
M Tools/TestWebKitAPI/cocoa/TestWebExtensionsDelegate.mm
Log Message:
-----------
_WKWebExtensionMessagePort should not throw on invalid messages.
https://webkit.org/b/271796
rdar://125505726
Reviewed by Jeff Miller.
Change the exception that was thrown in -[_WKWebExtensionMessagePort
sendMessage::] to an
error that is returned to the completion handler instead.
Also fixed the reply message handling for runtime.sendNativeMessage() so it
returns the
error to the extension instead of throwing an exception.
* Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionMessagePort.h:
(NS_ERROR_ENUM): Added _WKWebExtensionMessagePortErrorMessageInvalid.
*
Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIRuntimeCocoa.mm:
(WebKit::WebExtensionContext::runtimeSendNativeMessage): Changed THROW_UNLESS
into a check that returns
and error to the completion handler.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionMessagePortCocoa.mm:
(WebKit::toAPI): Added cases for ErrorType::MessageInvalid.
(WebKit::WebExtensionMessagePort::sendMessage): Changed THROW_UNLESS into a
check that returns
_WKWebExtensionMessagePortErrorMessageInvalid error to the completion handler.
* Source/WebKit/UIProcess/Extensions/WebExtensionMessagePort.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIRuntime.mm:
(TEST(WKWebExtensionAPIRuntime, SendNativeMessageWithInvalidReply)): Added.
(TEST(WKWebExtensionAPIRuntime, ConnectNativeWithInvalidMessage)): Added.
* Tools/TestWebKitAPI/cocoa/TestWebExtensionsDelegate.mm:
(-[TestWebExtensionsDelegate
webExtensionController:openOptionsPageForExtensionContext:completionHandler:]):
Fix typo.
(-[TestWebExtensionsDelegate
webExtensionController:sendMessage:toApplicationIdentifier:forExtensionContext:replyHandler:]):
Ditto.
(-[TestWebExtensionsDelegate
webExtensionController:connectUsingMessagePort:forExtensionContext:completionHandler:]):
Ditto.
(-[TestWebExtensionsDelegate
webExtensionController:presentPopupForAction:forExtensionContext:completionHandler:]):
Ditto.
Canonical link: https://commits.webkit.org/276760@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