mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 01:08:48 +00:00
LibWeb: Ensure an ESO is pushed before doing structured deserialization
We need to make sure that the given target realm is at the top of the VM's execution context stack before doing any JS object construction based on the data in our serialized buffer.
This commit is contained in:
parent
9f6841a65c
commit
2c27b4e63c
Notes:
sideshowbarker
2024-07-17 03:35:16 +09:00
Author: https://github.com/ADKaster
Commit: 2c27b4e63c
Pull-request: https://github.com/SerenityOS/serenity/pull/22850
1 changed files with 9 additions and 1 deletions
|
@ -1142,8 +1142,16 @@ WebIDL::ExceptionOr<JS::Value> structured_deserialize(JS::VM& vm, SerializationR
|
|||
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
|
||||
auto& target_settings = Bindings::host_defined_environment_settings_object(target_realm);
|
||||
target_settings.prepare_to_run_script();
|
||||
|
||||
Deserializer deserializer(vm, target_realm, serialized.span(), *memory);
|
||||
return deserializer.deserialize();
|
||||
|
||||
auto result = deserializer.deserialize();
|
||||
|
||||
target_settings.clean_up_after_running_script();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue