Make DOMException serializable (#36535)

Follow the implementation of making DOMPoint and DOMPointReadOnly
serializable in PR #35989

Testing: Passed a test previously expected to fail.
Fixes: #36463

---------

Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
This commit is contained in:
Kingsley Yung 2025-04-15 21:25:31 +08:00 committed by GitHub
parent cc04caa8ce
commit dacd951c9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 138 additions and 12 deletions

View file

@ -196,6 +196,7 @@ impl PipelineNamespace {
self, ServiceWorkerRegistrationIndex}
namespace_id_method! {next_blob_id, BlobId, self, BlobIndex}
namespace_id_method! {next_dom_point_id, DomPointId, self, DomPointIndex}
namespace_id_method! {next_dom_exception_id, DomExceptionId, self, DomExceptionIndex}
}
thread_local!(pub static PIPELINE_NAMESPACE: Cell<Option<PipelineNamespace>> = const { Cell::new(None) });
@ -425,6 +426,19 @@ impl DomPointId {
}
}
namespace_id! {DomExceptionId, DomExceptionIndex, "DomException"}
impl DomExceptionId {
pub fn new() -> DomExceptionId {
PIPELINE_NAMESPACE.with(|tls| {
let mut namespace = tls.get().expect("No namespace set for this thread!");
let next_exception_id = namespace.next_dom_exception_id();
tls.set(Some(namespace));
next_exception_id
})
}
}
namespace_id! {HistoryStateId, HistoryStateIndex, "HistoryState"}
impl HistoryStateId {