aboutsummaryrefslogtreecommitdiffstats
path: root/components/shared/constellation/message_port.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/shared/constellation/message_port.rs')
-rw-r--r--components/shared/constellation/message_port.rs37
1 files changed, 36 insertions, 1 deletions
diff --git a/components/shared/constellation/message_port.rs b/components/shared/constellation/message_port.rs
index 79c34cd4022..8fe40418004 100644
--- a/components/shared/constellation/message_port.rs
+++ b/components/shared/constellation/message_port.rs
@@ -13,7 +13,7 @@ use std::cell::RefCell;
use std::collections::{HashMap, VecDeque};
use std::path::PathBuf;
-use base::id::{BlobId, DomPointId, MessagePortId};
+use base::id::{BlobId, DomExceptionId, DomPointId, MessagePortId};
use log::warn;
use malloc_size_of_derive::MallocSizeOf;
use net_traits::filemanager_thread::RelativePos;
@@ -177,6 +177,8 @@ pub struct StructuredSerializedData {
pub blobs: Option<HashMap<BlobId, BlobImpl>>,
/// Serialized point objects.
pub points: Option<HashMap<DomPointId, DomPoint>>,
+ /// Serialized exception objects.
+ pub exceptions: Option<HashMap<DomExceptionId, DomException>>,
/// Transferred objects.
pub ports: Option<HashMap<MessagePortId, MessagePortImpl>>,
}
@@ -205,6 +207,8 @@ pub enum Serializable {
DomPoint,
/// The `DOMPointReadOnly` interface.
DomPointReadOnly,
+ /// The `DOMException` interface.
+ DomException,
}
impl Serializable {
@@ -215,6 +219,9 @@ impl Serializable {
StructuredSerializedData::clone_all_of_type::<DomPoint>
},
Serializable::DomPoint => StructuredSerializedData::clone_all_of_type::<DomPoint>,
+ Serializable::DomException => {
+ StructuredSerializedData::clone_all_of_type::<DomException>
+ },
}
}
}
@@ -294,6 +301,7 @@ pub struct PortMessageTask {
/// Messages for communication between the constellation and a global managing ports.
#[derive(Debug, Deserialize, Serialize)]
+#[allow(clippy::large_enum_variant)]
pub enum MessagePortMsg {
/// Complete the transfer for a batch of ports.
CompleteTransfer(HashMap<MessagePortId, VecDeque<PortMessageTask>>),
@@ -526,3 +534,30 @@ impl BroadcastClone for DomPoint {
Some(self.clone())
}
}
+
+#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
+/// A serializable version of the DOMException interface.
+pub struct DomException {
+ pub message: String,
+ pub name: String,
+}
+
+impl BroadcastClone for DomException {
+ type Id = DomExceptionId;
+
+ fn source(
+ data: &StructuredSerializedData,
+ ) -> &Option<std::collections::HashMap<Self::Id, Self>> {
+ &data.exceptions
+ }
+
+ fn destination(
+ data: &mut StructuredSerializedData,
+ ) -> &mut Option<std::collections::HashMap<Self::Id, Self>> {
+ &mut data.exceptions
+ }
+
+ fn clone_for_broadcast(&self) -> Option<Self> {
+ Some(self.clone())
+ }
+}