瀏覽代碼

LibWeb: Default initialize StructuredDeserialize memory argument

This is optional in the spec, so let's make it actually optional at the
call site.
Shannon Booth 8 月之前
父節點
當前提交
9724c67be2

+ 1 - 1
Libraries/LibWeb/DOM/Document.cpp

@@ -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.
     // 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.
     // 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())
     if (state_or_error.is_error())
         m_history->set_state(JS::js_null());
         m_history->set_state(JS::js_null());
     else
     else

+ 1 - 1
Libraries/LibWeb/HTML/NavigationDestination.cpp

@@ -87,7 +87,7 @@ bool NavigationDestination::same_document() const
 WebIDL::ExceptionOr<JS::Value> NavigationDestination::get_state()
 WebIDL::ExceptionOr<JS::Value> NavigationDestination::get_state()
 {
 {
     // The getState() method steps are to return StructuredDeserialize(this's 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());
 }
 }
 
 
 }
 }

+ 1 - 1
Libraries/LibWeb/HTML/NavigationHistoryEntry.cpp

@@ -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.
     // 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
     //    NOTE: This can in theory throw an exception, if attempting to deserialize a large ArrayBuffer
     //          when not enough memory is available.
     //          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)
 void NavigationHistoryEntry::set_ondispose(WebIDL::CallbackType* event_handler)

+ 1 - 1
Libraries/LibWeb/HTML/StructuredSerialize.h

@@ -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_for_storage(JS::VM& vm, JS::Value);
 WebIDL::ExceptionOr<SerializationRecord> structured_serialize_internal(JS::VM& vm, JS::Value, bool for_storage, SerializationMemory&);
 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 = {});
 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);
 void serialize_boolean_primitive(SerializationRecord& serialized, JS::Value& value);

+ 1 - 1
Libraries/LibWeb/HTML/UniversalGlobalScope.cpp

@@ -102,7 +102,7 @@ WebIDL::ExceptionOr<JS::Value> UniversalGlobalScopeMixin::structured_clone(JS::V
 
 
     // 2. Let deserializeRecord be ? StructuredDeserializeWithTransfer(serialized, this's relevant realm).
     // 2. Let deserializeRecord be ? StructuredDeserializeWithTransfer(serialized, this's relevant realm).
     // FIXME: Use WithTransfer variant of the AO
     // 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]].
     // 3. Return deserializeRecord.[[Deserialized]].
     return deserialized;
     return deserialized;

+ 1 - 1
Libraries/LibWeb/HighResolutionTime/Performance.cpp

@@ -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));
         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.
         // 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.
     // 2. Otherwise, set it to null.

+ 1 - 1
Libraries/LibWeb/Streams/AbstractOperations.cpp

@@ -5397,7 +5397,7 @@ WebIDL::ExceptionOr<JS::Value> structured_clone(JS::Realm& realm, JS::Value valu
     auto serialized = TRY(HTML::structured_serialize(vm, value));
     auto serialized = TRY(HTML::structured_serialize(vm, value));
 
 
     // 2. Return ? StructuredDeserialize(serialized, the current Realm).
     // 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
 // https://streams.spec.whatwg.org/#close-sentinel

+ 1 - 1
Libraries/LibWeb/UserTiming/PerformanceMark.cpp

@@ -86,7 +86,7 @@ WebIDL::ExceptionOr<GC::Ref<PerformanceMark>> PerformanceMark::construct_impl(JS
         auto record = TRY(HTML::structured_serialize(vm, mark_options.detail));
         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.
         // 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.
     // 2. Create a new PerformanceMark object (entry) with the current global object's realm.