Split StructuredCloneHolder into Reader and Writer structs (#34792)

Signed-off-by: webbeef <me@webbeef.org>
This commit is contained in:
webbeef 2024-12-29 18:20:52 -08:00 committed by GitHub
parent 9156ee3fa1
commit 1296c71f36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 67 additions and 111 deletions

View file

@ -6,7 +6,7 @@
//! (<https://html.spec.whatwg.org/multipage/#serializable-objects>).
use crate::dom::bindings::reflector::DomObject;
use crate::dom::bindings::structuredclone::StructuredDataHolder;
use crate::dom::bindings::structuredclone::{StructuredDataReader, StructuredDataWriter};
use crate::dom::globalscope::GlobalScope;
use crate::script_runtime::CanGc;
@ -22,11 +22,11 @@ pub struct StorageKey {
/// <https://html.spec.whatwg.org/multipage/#serializable>
pub trait Serializable: DomObject {
/// <https://html.spec.whatwg.org/multipage/#serialization-steps>
fn serialize(&self, sc_holder: &mut StructuredDataHolder) -> Result<StorageKey, ()>;
fn serialize(&self, sc_writer: &mut StructuredDataWriter) -> Result<StorageKey, ()>;
/// <https://html.spec.whatwg.org/multipage/#deserialization-steps>
fn deserialize(
owner: &GlobalScope,
sc_holder: &mut StructuredDataHolder,
sc_reader: &mut StructuredDataReader,
extra_data: StorageKey,
can_gc: CanGc,
) -> Result<(), ()>;