diff --git a/Libraries/LibWeb/HTML/StructuredSerialize.cpp b/Libraries/LibWeb/HTML/StructuredSerialize.cpp index bb913516716..a817fe71aee 100644 --- a/Libraries/LibWeb/HTML/StructuredSerialize.cpp +++ b/Libraries/LibWeb/HTML/StructuredSerialize.cpp @@ -64,6 +64,7 @@ #include #include #include +#include #include #include #include @@ -1507,15 +1508,12 @@ WebIDL::ExceptionOr structured_serialize_internal(JS::VM& v // https://html.spec.whatwg.org/multipage/structured-data.html#structureddeserialize WebIDL::ExceptionOr structured_deserialize(JS::VM& vm, SerializationRecord const& serialized, JS::Realm& target_realm, Optional memory) { + TemporaryExecutionContext execution_context { target_realm }; + if (!memory.has_value()) memory = DeserializationMemory { vm.heap() }; - // IMPLEMENTATION DEFINED: We need to make sure there's an execution context for target_realm on the stack before constructing these JS objects - prepare_to_run_script(target_realm); - auto result = TRY(structured_deserialize_internal(vm, serialized.span(), target_realm, *memory)); - - clean_up_after_running_script(target_realm); VERIFY(result.value.has_value()); return *result.value; }