mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Make service workers talk to their serviceworkerglobalscopes
This commit is contained in:
parent
72279cc7eb
commit
0996b38ade
13 changed files with 184 additions and 46 deletions
|
@ -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"
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>)
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue