aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_traits
diff options
context:
space:
mode:
authorRahul Sharma <rsconceptx@gmail.com>2016-07-28 23:34:44 +0530
committerRahul Sharma <rsconceptx@gmail.com>2016-09-07 12:07:36 +0530
commit0996b38ade7e2fe368ad7bd21ba8cf9a48d8f866 (patch)
tree8ac690564d216b672e1da26404e8c6d5585dcbc3 /components/script_traits
parent72279cc7eb044a760ce461d76da2ff62adc511dc (diff)
downloadservo-0996b38ade7e2fe368ad7bd21ba8cf9a48d8f866.tar.gz
servo-0996b38ade7e2fe368ad7bd21ba8cf9a48d8f866.zip
Make service workers talk to their serviceworkerglobalscopes
Diffstat (limited to 'components/script_traits')
-rw-r--r--components/script_traits/lib.rs5
-rw-r--r--components/script_traits/script_msg.rs7
2 files changed, 11 insertions, 1 deletions
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs
index 897f20bb3b2..ce708fd34ab 100644
--- a/components/script_traits/lib.rs
+++ b/components/script_traits/lib.rs
@@ -71,7 +71,7 @@ use util::ipc::OptionalOpaqueIpcSender;
use webdriver_msg::{LoadStatus, WebDriverScriptCommand};
pub use script_msg::{LayoutMsg, ScriptMsg, EventResult, LogEntry};
-pub use script_msg::{ServiceWorkerMsg, ScopeThings, SWManagerMsg, SWManagerSenders};
+pub use script_msg::{ServiceWorkerMsg, ScopeThings, SWManagerMsg, SWManagerSenders, DOMMessage};
/// The address of a node. Layout sends these back. They must be validated via
/// `from_untrusted_node_address` before they can be used, because we do not trust layout.
@@ -208,6 +208,8 @@ pub enum ConstellationControlMsg {
ReportCSSError(PipelineId, String, usize, usize, String),
/// Reload the given page.
Reload(PipelineId),
+ /// Requests the script thread to connect service worker object to its scope
+ ConnectServiceWorker(Url, IpcSender<DOMMessage>)
}
impl fmt::Debug for ConstellationControlMsg {
@@ -237,6 +239,7 @@ impl fmt::Debug for ConstellationControlMsg {
FramedContentChanged(..) => "FramedContentChanged",
ReportCSSError(..) => "ReportCSSError",
Reload(..) => "Reload",
+ ConnectServiceWorker(..) => "ConnectServiceWorker"
})
}
}
diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs
index d183336f6f8..b1a9f2e6a52 100644
--- a/components/script_traits/script_msg.rs
+++ b/components/script_traits/script_msg.rs
@@ -158,6 +158,10 @@ pub struct ScopeThings {
pub worker_id: WorkerId,
}
+/// Message that gets passed to service worker scope on postMessage
+#[derive(Deserialize, Serialize, Debug)]
+pub struct DOMMessage(pub Vec<u64>);
+
/// Channels to allow service worker manager to communicate with constellation and resource thread
pub struct SWManagerSenders {
/// sender for communicating with constellation
@@ -182,4 +186,7 @@ pub enum ServiceWorkerMsg {
pub enum SWManagerMsg {
/// Provide the constellation with a means of communicating with the Service Worker Manager
OwnSender(IpcSender<ServiceWorkerMsg>),
+ /// Message to ask to get a Trusted<ServiceWorker> to constellation
+ ConnectServiceWorker(Url, PipelineId, IpcSender<DOMMessage>)
+
}