diff options
author | Gregory Terzian <gterzian@users.noreply.github.com> | 2018-04-28 22:48:14 +0800 |
---|---|---|
committer | Gregory Terzian <gterzian@users.noreply.github.com> | 2018-05-23 21:45:57 +0800 |
commit | d4382407722108a52bf23b1f3a3114984f13fb90 (patch) | |
tree | 55f5dad9ccad14e6911cb5434f2d362ba79f166e /components/script_traits/script_msg.rs | |
parent | a297e8f2881d0d1927160d2ebc0e4b26d71f2534 (diff) | |
download | servo-d4382407722108a52bf23b1f3a3114984f13fb90.tar.gz servo-d4382407722108a52bf23b1f3a3114984f13fb90.zip |
move msg to embedder_traits, use in script, handle send error in embedder
Diffstat (limited to 'components/script_traits/script_msg.rs')
-rw-r--r-- | components/script_traits/script_msg.rs | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs index ad437b09d8d..c9cb879f1c2 100644 --- a/components/script_traits/script_msg.rs +++ b/components/script_traits/script_msg.rs @@ -12,11 +12,11 @@ use WorkerGlobalScopeInit; use WorkerScriptLoadOrigin; use canvas_traits::canvas::{CanvasMsg, CanvasId}; use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; +use embedder_traits::EmbedderMsg; use euclid::{Size2D, TypedSize2D}; use gfx_traits::Epoch; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use msg::constellation_msg::{BrowsingContextId, HistoryStateId, PipelineId, TraversalDirection}; -use msg::constellation_msg::{InputMethodType, Key, KeyModifiers, KeyState}; use net_traits::CoreResourceMsg; use net_traits::request::RequestInit; use net_traits::storage_thread::StorageType; @@ -83,6 +83,8 @@ pub enum LogEntry { /// Messages from the script to the constellation. #[derive(Deserialize, Serialize)] pub enum ScriptMsg { + /// Forward a message to the embedder. + ForwardToEmbedder(EmbedderMsg), /// Requests are sent to constellation and fetches are checked manually /// for cross-origin loads InitiateNavigateRequest(RequestInit, /* cancellation_chan */ IpcReceiver<()>), @@ -104,8 +106,6 @@ pub enum ScriptMsg { GetParentInfo(PipelineId, IpcSender<Option<PipelineId>>), /// Get the nth child browsing context ID for a given browsing context, sorted in tree order. GetChildBrowsingContextId(BrowsingContextId, usize, IpcSender<Option<BrowsingContextId>>), - /// <head> tag finished parsing - HeadParsed, /// All pending loads are complete, and the `load` event for this pipeline /// has been dispatched. LoadComplete, @@ -124,10 +124,6 @@ pub enum ScriptMsg { ReplaceHistoryState(HistoryStateId, ServoUrl), /// Gets the length of the joint session history from the constellation. JointSessionHistoryLength(IpcSender<u32>), - /// Favicon detected - NewFavicon(ServoUrl), - /// Status message to be displayed in the chrome, eg. a link URL on mouseover. - NodeStatus(Option<String>), /// Notification that this iframe should be removed. /// Returns a list of pipelines which were closed. RemoveIFrame(BrowsingContextId, IpcSender<Vec<PipelineId>>), @@ -147,17 +143,6 @@ pub enum ScriptMsg { SetDocumentState(DocumentState), /// Update the pipeline Url, which can change after redirections. SetFinalUrl(ServoUrl), - /// Check if an alert dialog box should be presented - Alert(String, IpcSender<bool>), - /// Set title of current page - /// <https://html.spec.whatwg.org/multipage/#document.title> - SetTitle(Option<String>), - /// Send a key event - SendKeyEvent(Option<char>, Key, KeyState, KeyModifiers), - /// Move the window to a point - MoveTo(DeviceIntPoint), - /// Resize the window to size - ResizeTo(DeviceUintSize), /// Script has handled a touch event, and either prevented or allowed default actions. TouchEventProcessed(EventResult), /// A log entry, with the top-level browsing context id and thread name @@ -171,18 +156,12 @@ pub enum ScriptMsg { ForwardDOMMessage(DOMMessage, ServoUrl), /// Store the data required to activate a service worker for the given scope RegisterServiceWorker(ScopeThings, ServoUrl), - /// Enter or exit fullscreen - SetFullscreenState(bool), /// Get Window Informations size and position GetClientWindow(IpcSender<(DeviceUintSize, DeviceIntPoint)>), /// Get the screen size (pixel) GetScreenSize(IpcSender<(DeviceUintSize)>), /// Get the available screen size (pixel) GetScreenAvailSize(IpcSender<(DeviceUintSize)>), - /// Request to present an IME to the user when an editable element is focused. - ShowIME(InputMethodType), - /// Request to hide the IME when the editable element is blurred. - HideIME, /// Requests that the compositor shut down. Exit, } @@ -191,6 +170,7 @@ impl fmt::Debug for ScriptMsg { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { use self::ScriptMsg::*; let variant = match *self { + ForwardToEmbedder(..) => "ForwardToEmbedder", InitiateNavigateRequest(..) => "InitiateNavigateRequest", BroadcastStorageEvent(..) => "BroadcastStorageEvent", ChangeRunningAnimationsState(..) => "ChangeRunningAnimationsState", @@ -200,7 +180,6 @@ impl fmt::Debug for ScriptMsg { GetBrowsingContextId(..) => "GetBrowsingContextId", GetParentInfo(..) => "GetParentInfo", GetChildBrowsingContextId(..) => "GetChildBrowsingContextId", - HeadParsed => "HeadParsed", LoadComplete => "LoadComplete", LoadUrl(..) => "LoadUrl", AbortLoadUrl => "AbortLoadUrl", @@ -209,8 +188,6 @@ impl fmt::Debug for ScriptMsg { PushHistoryState(..) => "PushHistoryState", ReplaceHistoryState(..) => "ReplaceHistoryState", JointSessionHistoryLength(..) => "JointSessionHistoryLength", - NewFavicon(..) => "NewFavicon", - NodeStatus(..) => "NodeStatus", RemoveIFrame(..) => "RemoveIFrame", SetVisible(..) => "SetVisible", VisibilityChangeComplete(..) => "VisibilityChangeComplete", @@ -220,23 +197,15 @@ impl fmt::Debug for ScriptMsg { ActivateDocument => "ActivateDocument", SetDocumentState(..) => "SetDocumentState", SetFinalUrl(..) => "SetFinalUrl", - Alert(..) => "Alert", - SetTitle(..) => "SetTitle", - SendKeyEvent(..) => "SendKeyEvent", - MoveTo(..) => "MoveTo", - ResizeTo(..) => "ResizeTo", TouchEventProcessed(..) => "TouchEventProcessed", LogEntry(..) => "LogEntry", DiscardDocument => "DiscardDocument", PipelineExited => "PipelineExited", ForwardDOMMessage(..) => "ForwardDOMMessage", RegisterServiceWorker(..) => "RegisterServiceWorker", - SetFullscreenState(..) => "SetFullscreenState", GetClientWindow(..) => "GetClientWindow", GetScreenSize(..) => "GetScreenSize", GetScreenAvailSize(..) => "GetScreenAvailSize", - ShowIME(..) => "ShowIME", - HideIME => "HideIME", Exit => "Exit", }; write!(formatter, "ScriptMsg::{}", variant) |