[webkit-changes] [WebKit/WebKit] 8ebae8: IPC testing API is unable to reply with nullopt op...
Kimmo Kinnunen
noreply at github.com
Thu Jun 13 23:17:32 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 8ebae84b5572e076d84b8ead18258c48a72e9280
https://github.com/WebKit/WebKit/commit/8ebae84b5572e076d84b8ead18258c48a72e9280
Author: Kimmo Kinnunen <kkinnunen at apple.com>
Date: 2024-06-13 (Thu, 13 Jun 2024)
Changed paths:
A LayoutTests/ipc/async-with-reply-optional-expected.txt
A LayoutTests/ipc/async-with-reply-optional.html
M Source/WebKit/Platform/IPC/JSIPCBinding.cpp
M Source/WebKit/Platform/IPC/JSIPCBinding.h
M Source/WebKit/Shared/IPCTester.cpp
M Source/WebKit/Shared/IPCTester.h
M Source/WebKit/Shared/IPCTester.messages.in
M Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp
Log Message:
-----------
IPC testing API is unable to reply with nullopt optional
https://bugs.webkit.org/show_bug.cgi?id=275409
rdar://129669346
Reviewed by Cameron McCormack.
Decoding std::optional would return empty JSValue (JSValue()) if the
optional was std::nullopt. This would be interpreted as a decoding
failure.
Fix this by returning the more natural value, jsUndefined value. Fix the
result array construction to not use jsUndefined to signify that the
value should be a array buffer containing the data. Use empty JSValue to
signify this. Use exception scope to detect when JS exception would
cancel the decoding as a decoding failure.
Decoding failures would use the already cleared exception as the result
JS object, causing a crash.
Fix by first constructing the JS value, then clearing the exception from
the scope.
Add decoder for WebCore::ExceptionData, to be used in testing the
message this problem was noted.
* LayoutTests/ipc/async-with-reply-optional.html: Added.
* Source/WebKit/Platform/IPC/JSIPCBinding.cpp:
(IPC::jsValueForDecodedArgumentValue):
(IPC::putJSValueForDecodedArgumentAtIndexOrArrayBufferIfUndefined): Deleted.
* Source/WebKit/Platform/IPC/JSIPCBinding.h:
(IPC::jsValueForDecodedArgumentValue):
(IPC::putJSValueForDecodeArgumentInArray):
* Source/WebKit/Shared/IPCTester.cpp:
(WebKit::IPCTester::asyncOptionalExceptionData):
* Source/WebKit/Shared/IPCTester.h:
* Source/WebKit/Shared/IPCTester.messages.in:
* Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp:
(WebKit::IPCTestingAPI::jsSendWithAsyncReply):
Canonical link: https://commits.webkit.org/279999@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