diff options
Diffstat (limited to 'components/script/dom/domexception.rs')
-rw-r--r-- | components/script/dom/domexception.rs | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/components/script/dom/domexception.rs b/components/script/dom/domexception.rs index 35a21556a2d..e63c3ff1f53 100644 --- a/components/script/dom/domexception.rs +++ b/components/script/dom/domexception.rs @@ -3,9 +3,8 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use std::collections::HashMap; -use std::num::NonZeroU32; -use base::id::{DomExceptionId, DomExceptionIndex, PipelineNamespaceId}; +use base::id::{DomExceptionId, DomExceptionIndex}; use constellation_traits::DomException; use dom_struct::dom_struct; use js::rust::HandleObject; @@ -18,7 +17,7 @@ use crate::dom::bindings::reflector::{ Reflector, reflect_dom_object, reflect_dom_object_with_proto, }; use crate::dom::bindings::root::DomRoot; -use crate::dom::bindings::serializable::{IntoStorageKey, Serializable, StorageKey}; +use crate::dom::bindings::serializable::{Serializable, StorageKey}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::structuredclone::{StructuredData, StructuredDataReader}; use crate::dom::globalscope::GlobalScope; @@ -224,11 +223,11 @@ impl DOMExceptionMethods<crate::DomTypeHolder> for DOMException { } impl Serializable for DOMException { - type Id = DomExceptionId; + type Index = DomExceptionIndex; type Data = DomException; // https://webidl.spec.whatwg.org/#idl-DOMException - fn serialize(&self) -> Result<(Self::Id, Self::Data), ()> { + fn serialize(&self) -> Result<(DomExceptionId, Self::Data), ()> { let serialized = DomException { message: self.message.to_string(), name: self.name.to_string(), @@ -253,7 +252,9 @@ impl Serializable for DOMException { )) } - fn serialized_storage(data: StructuredData<'_>) -> &mut Option<HashMap<Self::Id, Self::Data>> { + fn serialized_storage( + data: StructuredData<'_>, + ) -> &mut Option<HashMap<DomExceptionId, Self::Data>> { match data { StructuredData::Reader(reader) => &mut reader.exceptions, StructuredData::Writer(writer) => &mut writer.exceptions, @@ -266,24 +267,3 @@ impl Serializable for DOMException { &mut reader.dom_exceptions } } - -impl From<StorageKey> for DomExceptionId { - fn from(storage_key: StorageKey) -> DomExceptionId { - let namespace_id = PipelineNamespaceId(storage_key.name_space); - let index = DomExceptionIndex( - NonZeroU32::new(storage_key.index).expect("Deserialized exception index is zero"), - ); - - DomExceptionId { - namespace_id, - index, - } - } -} - -impl IntoStorageKey for DomExceptionId { - fn into_storage_key(self) -> StorageKey { - let DomExceptionIndex(index) = self.index; - StorageKey::new(self.namespace_id, index) - } -} |