mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
LibWeb: Default initialize StructuredDeserialize memory argument
This is optional in the spec, so let's make it actually optional at the call site.
This commit is contained in:
parent
617b8eed75
commit
9724c67be2
Notes:
github-actions[bot]
2024-11-23 15:44:57 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/9724c67be20 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2518
8 changed files with 8 additions and 8 deletions
|
@ -4388,7 +4388,7 @@ void Document::restore_the_history_object_state(GC::Ref<HTML::SessionHistoryEntr
|
|||
|
||||
// 2. Let state be StructuredDeserialize(entry's classic history API state, targetRealm). If this throws an exception, catch it and let state be null.
|
||||
// 3. Set document's history object's state to state.
|
||||
auto state_or_error = HTML::structured_deserialize(target_realm.vm(), entry->classic_history_api_state(), target_realm, {});
|
||||
auto state_or_error = HTML::structured_deserialize(target_realm.vm(), entry->classic_history_api_state(), target_realm);
|
||||
if (state_or_error.is_error())
|
||||
m_history->set_state(JS::js_null());
|
||||
else
|
||||
|
|
|
@ -87,7 +87,7 @@ bool NavigationDestination::same_document() const
|
|||
WebIDL::ExceptionOr<JS::Value> NavigationDestination::get_state()
|
||||
{
|
||||
// The getState() method steps are to return StructuredDeserialize(this's state).
|
||||
return structured_deserialize(vm(), m_state, realm(), {});
|
||||
return structured_deserialize(vm(), m_state, realm());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ WebIDL::ExceptionOr<JS::Value> NavigationHistoryEntry::get_state()
|
|||
// 2. Return StructuredDeserialize(this's session history entry's navigation API state). Rethrow any exceptions.
|
||||
// NOTE: This can in theory throw an exception, if attempting to deserialize a large ArrayBuffer
|
||||
// when not enough memory is available.
|
||||
return structured_deserialize(vm(), m_session_history_entry->navigation_api_state(), realm(), {});
|
||||
return structured_deserialize(vm(), m_session_history_entry->navigation_api_state(), realm());
|
||||
}
|
||||
|
||||
void NavigationHistoryEntry::set_ondispose(WebIDL::CallbackType* event_handler)
|
||||
|
|
|
@ -54,7 +54,7 @@ WebIDL::ExceptionOr<SerializationRecord> structured_serialize(JS::VM& vm, JS::Va
|
|||
WebIDL::ExceptionOr<SerializationRecord> structured_serialize_for_storage(JS::VM& vm, JS::Value);
|
||||
WebIDL::ExceptionOr<SerializationRecord> structured_serialize_internal(JS::VM& vm, JS::Value, bool for_storage, SerializationMemory&);
|
||||
|
||||
WebIDL::ExceptionOr<JS::Value> structured_deserialize(JS::VM& vm, SerializationRecord const& serialized, JS::Realm& target_realm, Optional<DeserializationMemory>);
|
||||
WebIDL::ExceptionOr<JS::Value> structured_deserialize(JS::VM& vm, SerializationRecord const& serialized, JS::Realm& target_realm, Optional<DeserializationMemory> = {});
|
||||
WebIDL::ExceptionOr<DeserializedRecord> structured_deserialize_internal(JS::VM& vm, ReadonlySpan<u32> const& serialized, JS::Realm& target_realm, DeserializationMemory& memory, Optional<size_t> position = {});
|
||||
|
||||
void serialize_boolean_primitive(SerializationRecord& serialized, JS::Value& value);
|
||||
|
|
|
@ -102,7 +102,7 @@ WebIDL::ExceptionOr<JS::Value> UniversalGlobalScopeMixin::structured_clone(JS::V
|
|||
|
||||
// 2. Let deserializeRecord be ? StructuredDeserializeWithTransfer(serialized, this's relevant realm).
|
||||
// FIXME: Use WithTransfer variant of the AO
|
||||
auto deserialized = TRY(structured_deserialize(vm, serialized, relevant_realm(this_impl()), {}));
|
||||
auto deserialized = TRY(structured_deserialize(vm, serialized, relevant_realm(this_impl())));
|
||||
|
||||
// 3. Return deserializeRecord.[[Deserialized]].
|
||||
return deserialized;
|
||||
|
|
|
@ -298,7 +298,7 @@ WebIDL::ExceptionOr<GC::Ref<UserTiming::PerformanceMeasure>> Performance::measur
|
|||
auto record = TRY(HTML::structured_serialize(vm, start_or_measure_options_dictionary_object->detail));
|
||||
|
||||
// 2. Set entry's detail to the result of calling the StructuredDeserialize algorithm on record and the current realm.
|
||||
detail = TRY(HTML::structured_deserialize(vm, record, realm, Optional<HTML::DeserializationMemory> {}));
|
||||
detail = TRY(HTML::structured_deserialize(vm, record, realm));
|
||||
}
|
||||
|
||||
// 2. Otherwise, set it to null.
|
||||
|
|
|
@ -5397,7 +5397,7 @@ WebIDL::ExceptionOr<JS::Value> structured_clone(JS::Realm& realm, JS::Value valu
|
|||
auto serialized = TRY(HTML::structured_serialize(vm, value));
|
||||
|
||||
// 2. Return ? StructuredDeserialize(serialized, the current Realm).
|
||||
return TRY(HTML::structured_deserialize(vm, serialized, realm, {}));
|
||||
return TRY(HTML::structured_deserialize(vm, serialized, realm));
|
||||
}
|
||||
|
||||
// https://streams.spec.whatwg.org/#close-sentinel
|
||||
|
|
|
@ -86,7 +86,7 @@ WebIDL::ExceptionOr<GC::Ref<PerformanceMark>> PerformanceMark::construct_impl(JS
|
|||
auto record = TRY(HTML::structured_serialize(vm, mark_options.detail));
|
||||
|
||||
// 2. Set entry's detail to the result of calling the StructuredDeserialize algorithm on record and the current realm.
|
||||
detail = TRY(HTML::structured_deserialize(vm, record, realm, Optional<HTML::DeserializationMemory> {}));
|
||||
detail = TRY(HTML::structured_deserialize(vm, record, realm));
|
||||
}
|
||||
|
||||
// 2. Create a new PerformanceMark object (entry) with the current global object's realm.
|
||||
|
|
Loading…
Add table
Reference in a new issue