LibWeb/HTML: Enable callbacks in postMessage deserialization

Interestingly, the spec has a note saying:

> window.postMessage() performs StructuredSerializeWithTransfer on
> its arguments, but is careful to do so immediately, inside the
> synchronous portion of its algorithm. Thus it is able to use the
> algorithms without needing to prepare to run script and prepare
> to run a callback.

But there is no note about the deserialization steps. In any case, we do
need callbacks enabled here.
This commit is contained in:
Shannon Booth 2024-12-22 01:53:10 +13:00 committed by Tim Flynn
parent bfbc0124c0
commit fe7d7f6f6b
Notes: github-actions[bot] 2025-01-20 12:53:32 +00:00

View file

@ -1136,7 +1136,7 @@ WebIDL::ExceptionOr<void> Window::window_post_message_steps(JS::Value message, W
auto& source = verify_cast<WindowProxy>(incumbent_settings.realm().global_environment().global_this_value());
// 4. Let deserializeRecord be StructuredDeserializeWithTransfer(serializeWithTransferResult, targetRealm).
auto temporary_execution_context = TemporaryExecutionContext { target_realm };
auto temporary_execution_context = TemporaryExecutionContext { target_realm, TemporaryExecutionContext::CallbacksEnabled::Yes };
auto deserialize_record_or_error = structured_deserialize_with_transfer(vm(), serialize_with_transfer_result);
// If this throws an exception, catch it, fire an event named messageerror at targetWindow, using MessageEvent,