aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_traits/script_msg.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script_traits/script_msg.rs')
-rw-r--r--components/script_traits/script_msg.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs
index c19766263a5..aaa22732937 100644
--- a/components/script_traits/script_msg.rs
+++ b/components/script_traits/script_msg.rs
@@ -136,6 +136,9 @@ pub enum ScriptMsg {
LogEntry(Option<PipelineId>, Option<String>, LogEntry),
/// Notifies the constellation that this pipeline has exited.
PipelineExited(PipelineId),
+ /// Send messages from postMessage calls from serviceworker
+ /// to constellation for storing in service worker manager
+ ForwardDOMMessage(DOMMessage, Url),
/// Store the data required to activate a service worker for the given scope
RegisterServiceWorker(ScopeThings, Url),
/// Requests that the compositor shut down.
@@ -159,6 +162,10 @@ pub struct ScopeThings {
pub worker_id: WorkerId,
}
+/// Message that gets passed to service worker scope on postMessage
+#[derive(Deserialize, Serialize, Debug, Clone)]
+pub struct DOMMessage(pub Vec<u8>);
+
/// Channels to allow service worker manager to communicate with constellation and resource thread
pub struct SWManagerSenders {
/// sender for communicating with constellation
@@ -174,6 +181,8 @@ pub enum ServiceWorkerMsg {
RegisterServiceWorker(ScopeThings, Url),
/// Timeout message sent by active service workers
Timeout(Url),
+ /// Message sent by constellation to forward to a running service worker
+ ForwardDOMMessage(DOMMessage, Url),
/// Exit the service worker manager
Exit,
}
@@ -182,5 +191,6 @@ pub enum ServiceWorkerMsg {
#[derive(Deserialize, Serialize)]
pub enum SWManagerMsg {
/// Provide the constellation with a means of communicating with the Service Worker Manager
- OwnSender(IpcSender<ServiceWorkerMsg>),
+ OwnSender(IpcSender<ServiceWorkerMsg>)
+
}