mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
move msg to embedder_traits, use in script, handle send error in embedder
This commit is contained in:
parent
a297e8f288
commit
d438240772
31 changed files with 362 additions and 337 deletions
|
@ -14,6 +14,7 @@ bluetooth_traits = {path = "../bluetooth_traits"}
|
|||
canvas_traits = {path = "../canvas_traits"}
|
||||
cookie = "0.10"
|
||||
devtools_traits = {path = "../devtools_traits"}
|
||||
embedder_traits = {path = "../embedder_traits"}
|
||||
euclid = "0.17"
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
hyper = "0.10"
|
||||
|
@ -34,3 +35,6 @@ time = "0.1.12"
|
|||
url = "1.2"
|
||||
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
||||
webvr_traits = {path = "../webvr_traits"}
|
||||
|
||||
[dev-dependencies]
|
||||
embedder_traits = { path = "../embedder_traits", features = ["tests"]}
|
||||
|
|
|
@ -13,6 +13,7 @@ extern crate bluetooth_traits;
|
|||
extern crate canvas_traits;
|
||||
extern crate cookie as cookie_rs;
|
||||
extern crate devtools_traits;
|
||||
extern crate embedder_traits;
|
||||
extern crate euclid;
|
||||
extern crate gfx_traits;
|
||||
extern crate hyper;
|
||||
|
@ -702,6 +703,8 @@ pub enum ConstellationMsg {
|
|||
NewBrowser(ServoUrl, IpcSender<TopLevelBrowsingContextId>),
|
||||
/// Close a top level browsing context.
|
||||
CloseBrowser(TopLevelBrowsingContextId),
|
||||
/// Panic a top level browsing context.
|
||||
SendError(Option<TopLevelBrowsingContextId>, String),
|
||||
/// Make browser visible.
|
||||
SelectBrowser(TopLevelBrowsingContextId),
|
||||
/// Forward an event to the script task of the given pipeline.
|
||||
|
@ -730,6 +733,7 @@ impl fmt::Debug for ConstellationMsg {
|
|||
WebVREvents(..) => "WebVREvents",
|
||||
NewBrowser(..) => "NewBrowser",
|
||||
CloseBrowser(..) => "CloseBrowser",
|
||||
SendError(..) => "SendError",
|
||||
SelectBrowser(..) => "SelectBrowser",
|
||||
ForwardEvent(..) => "ForwardEvent",
|
||||
SetCursor(..) => "SetCursor",
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue