diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index cd5946b4e44..0ef8d2ec07b 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -19,14 +19,14 @@ use image::{DynamicImage, ImageFormat, RgbImage}; use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory}; use ipc_channel::router::ROUTER; use msg::constellation_msg::{Image, PixelFormat, Key, KeyModifiers, KeyState}; -use msg::constellation_msg::{LoadData, TraversalDirection, PipelineId}; -use msg::constellation_msg::{PipelineIndex, PipelineNamespaceId, WindowSizeType}; +use msg::constellation_msg::{PipelineId, PipelineIndex, PipelineNamespaceId}; +use msg::constellation_msg::{TraversalDirection, WindowSizeType}; use profile_traits::mem::{self, Reporter, ReporterRequest}; use profile_traits::time::{self, ProfilerCategory, profile}; use script_traits::{AnimationState, AnimationTickType, ConstellationControlMsg}; -use script_traits::{ConstellationMsg, LayoutControlMsg, MouseButton, MouseEventType}; -use script_traits::{StackingContextScrollState, TouchpadPressurePhase, TouchEventType}; -use script_traits::{TouchId, WindowSizeData}; +use script_traits::{ConstellationMsg, LayoutControlMsg, LoadData, MouseButton}; +use script_traits::{MouseEventType, StackingContextScrollState}; +use script_traits::{TouchpadPressurePhase, TouchEventType, TouchId, WindowSizeData}; use script_traits::CompositorEvent::{self, MouseMoveEvent, MouseButtonEvent, TouchEvent, TouchpadPressureEvent}; use std::collections::HashMap; use std::fs::File; diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index fe7d033659e..9efbfb5b524 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -26,7 +26,7 @@ use ipc_channel::router::ROUTER; use layout_traits::LayoutThreadFactory; use log::{Log, LogLevel, LogLevelFilter, LogMetadata, LogRecord}; use msg::constellation_msg::{FrameId, FrameType, PipelineId}; -use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData}; +use msg::constellation_msg::{Key, KeyModifiers, KeyState}; use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, TraversalDirection}; use msg::constellation_msg::WindowSizeType; use net_traits::{self, IpcSend, ResourceThreads}; @@ -40,7 +40,7 @@ use profile_traits::time; use rand::{Rng, SeedableRng, StdRng, random}; use script_traits::{AnimationState, AnimationTickType, CompositorEvent}; use script_traits::{ConstellationControlMsg, ConstellationMsg as FromCompositorMsg}; -use script_traits::{DocumentState, LayoutControlMsg}; +use script_traits::{DocumentState, LayoutControlMsg, LoadData}; use script_traits::{IFrameLoadInfo, IFrameSandboxState, TimerEventRequest}; use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, ScriptThreadFactory}; use script_traits::{LogEntry, ServiceWorkerMsg, webdriver_msg}; diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs index 6f755489392..9dafef6c3e5 100644 --- a/components/constellation/pipeline.rs +++ b/components/constellation/pipeline.rs @@ -15,14 +15,15 @@ use gfx_traits::DevicePixel; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; use layout_traits::LayoutThreadFactory; -use msg::constellation_msg::{FrameId, FrameType, LoadData, PipelineId, PipelineNamespaceId}; +use msg::constellation_msg::{FrameId, FrameType, PipelineId, PipelineNamespaceId}; use net_traits::{IpcSend, ResourceThreads}; use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::image_cache_thread::ImageCacheThread; use profile_traits::mem as profile_mem; use profile_traits::time; -use script_traits::{ConstellationControlMsg, InitialScriptState, MozBrowserEvent}; -use script_traits::{LayoutControlMsg, LayoutMsg, NewLayoutInfo, SWManagerMsg, SWManagerSenders, ScriptMsg}; +use script_traits::{ConstellationControlMsg, InitialScriptState}; +use script_traits::{LayoutControlMsg, LayoutMsg, LoadData, MozBrowserEvent}; +use script_traits::{NewLayoutInfo, SWManagerMsg, SWManagerSenders, ScriptMsg}; use script_traits::{ScriptThreadFactory, TimerEventRequest, WindowSizeData}; use std::collections::HashMap; use std::env; diff --git a/components/msg/Cargo.toml b/components/msg/Cargo.toml index 452c4ea1716..cf283ea6e73 100644 --- a/components/msg/Cargo.toml +++ b/components/msg/Cargo.toml @@ -14,13 +14,10 @@ bitflags = "0.7" cssparser = {version = "0.7", features = ["heap_size", "serde-serialization"]} heapsize = "0.3.0" heapsize_plugin = "0.1.2" -hyper = "0.9.9" -hyper_serde = "0.1.4" ipc-channel = "0.5" plugins = {path = "../plugins"} serde = "0.8" serde_derive = "0.8" -url = {version = "1.2", features = ["heap_size", "serde"]} [dependencies.webrender_traits] git = "https://github.com/servo/webrender" diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index cc192b73f06..2aa8d19c8d2 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -5,12 +5,9 @@ //! The high-level interface from script to constellation. Using this abstract interface helps //! reduce coupling between these two components. -use hyper::header::Headers; -use hyper::method::Method; use ipc_channel::ipc::IpcSharedMemory; use std::cell::Cell; use std::fmt; -use url::Url; use webrender_traits; #[derive(Deserialize, Eq, PartialEq, Serialize, Copy, Clone, HeapSizeOf)] @@ -185,36 +182,6 @@ pub struct Image { pub id: Option, } -/// Similar to net::resource_thread::LoadData -/// can be passed to LoadUrl to load a page with GET/POST -/// parameters or headers -#[derive(Clone, Deserialize, Serialize)] -pub struct LoadData { - pub url: Url, - #[serde(deserialize_with = "::hyper_serde::deserialize", - serialize_with = "::hyper_serde::serialize")] - pub method: Method, - #[serde(deserialize_with = "::hyper_serde::deserialize", - serialize_with = "::hyper_serde::serialize")] - pub headers: Headers, - pub data: Option>, - pub referrer_policy: Option, - pub referrer_url: Option, -} - -impl LoadData { - pub fn new(url: Url, referrer_policy: Option, referrer_url: Option) -> LoadData { - LoadData { - url: url, - method: Method::Get, - headers: Headers::new(), - data: None, - referrer_policy: referrer_policy, - referrer_url: referrer_url, - } - } -} - #[derive(Clone, PartialEq, Eq, Copy, Hash, Debug, Deserialize, Serialize)] pub enum TraversalDirection { Forward(usize), diff --git a/components/msg/lib.rs b/components/msg/lib.rs index 6e0471e97ef..3918a7ada77 100644 --- a/components/msg/lib.rs +++ b/components/msg/lib.rs @@ -11,13 +11,10 @@ #[macro_use] extern crate bitflags; extern crate heapsize; -extern crate hyper; -extern crate hyper_serde; extern crate ipc_channel; extern crate serde; #[macro_use] extern crate serde_derive; -extern crate url; extern crate webrender_traits; pub mod constellation_msg; diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index 26a30d07599..78167022773 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -42,9 +42,10 @@ use encoding::all::UTF_8; use encoding::label::encoding_from_whatwg_label; use hyper::header::{Charset, ContentDisposition, ContentType, DispositionParam, DispositionType}; use hyper::method::Method; -use msg::constellation_msg::{LoadData, PipelineId}; +use msg::constellation_msg::PipelineId; use rand::random; use script_thread::{MainThreadScriptMsg, Runnable}; +use script_traits::LoadData; use std::borrow::ToOwned; use std::cell::Cell; use std::sync::mpsc::Sender; diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index c61ceb06156..cd18f86ee6a 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -38,10 +38,10 @@ use dom::window::{ReflowReason, Window}; use ipc_channel::ipc; use js::jsapi::{JSAutoCompartment, JSContext, MutableHandleValue}; use js::jsval::{NullValue, UndefinedValue}; -use msg::constellation_msg::{FrameType, FrameId, LoadData, PipelineId, TraversalDirection}; +use msg::constellation_msg::{FrameType, FrameId, PipelineId, TraversalDirection}; use net_traits::response::HttpsState; use script_layout_interface::message::ReflowQueryType; -use script_traits::{IFrameLoadInfo, MozBrowserEvent, ScriptMsg as ConstellationMsg}; +use script_traits::{IFrameLoadInfo, LoadData, MozBrowserEvent, ScriptMsg as ConstellationMsg}; use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed}; use std::cell::Cell; use string_cache::Atom; diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 739ca6aea9b..4a28bc3cd9f 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -49,7 +49,7 @@ use js::jsapi::{HandleObject, HandleValue, JSAutoCompartment, JSContext}; use js::jsapi::{JS_GC, JS_GetRuntime, SetWindowProxy}; use js::jsval::UndefinedValue; use js::rust::Runtime; -use msg::constellation_msg::{FrameType, LoadData, PipelineId, ReferrerPolicy, WindowSizeType}; +use msg::constellation_msg::{FrameType, PipelineId, ReferrerPolicy, WindowSizeType}; use net_traits::ResourceThreads; use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread}; @@ -68,7 +68,7 @@ use script_layout_interface::rpc::{MarginStyleResponse, ResolvedStyleResponse}; use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptThreadEventCategory}; use script_thread::{MainThreadScriptChan, MainThreadScriptMsg, Runnable, RunnableWrapper}; use script_thread::SendableMainThreadScriptChan; -use script_traits::{ConstellationControlMsg, MozBrowserEvent, UntrustedNodeAddress}; +use script_traits::{ConstellationControlMsg, LoadData, MozBrowserEvent, UntrustedNodeAddress}; use script_traits::{DocumentState, TimerEvent, TimerEventId}; use script_traits::{ScriptMsg as ConstellationMsg, TimerEventRequest, WindowSizeData}; use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult}; diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 6c05e9bfd88..0faa6dbb56c 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -71,7 +71,7 @@ use js::jsval::UndefinedValue; use js::rust::Runtime; use layout_wrapper::ServoLayoutNode; use mem::heap_size_of_self_and_children; -use msg::constellation_msg::{FrameType, LoadData, PipelineId, PipelineNamespace}; +use msg::constellation_msg::{FrameType, PipelineId, PipelineNamespace}; use msg::constellation_msg::{ReferrerPolicy, WindowSizeType}; use net_traits::{AsyncResponseTarget, CoreResourceMsg, LoadConsumer, LoadContext, Metadata, ResourceThreads}; use net_traits::{IpcSend, LoadData as NetLoadData}; @@ -84,7 +84,7 @@ use script_layout_interface::message::{self, NewLayoutThreadInfo, ReflowQueryTyp use script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory, EnqueuedPromiseCallback}; use script_runtime::{ScriptPort, StackRootTLS, get_reports, new_rt_and_cx, PromiseJobQueue}; use script_traits::{CompositorEvent, ConstellationControlMsg, EventResult}; -use script_traits::{InitialScriptState, MouseButton, MouseEventType, MozBrowserEvent}; +use script_traits::{InitialScriptState, LoadData, MouseButton, MouseEventType, MozBrowserEvent}; use script_traits::{NewLayoutInfo, ScriptMsg as ConstellationMsg}; use script_traits::{ScriptThreadFactory, TimerEvent, TimerEventRequest, TimerSource}; use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress, WindowSizeData}; diff --git a/components/script_traits/Cargo.toml b/components/script_traits/Cargo.toml index 5fb33f27625..fede5c350dc 100644 --- a/components/script_traits/Cargo.toml +++ b/components/script_traits/Cargo.toml @@ -18,6 +18,7 @@ euclid = "0.10.1" gfx_traits = {path = "../gfx_traits"} heapsize = "0.3.0" heapsize_plugin = "0.1.2" +hyper = "0.9.9" hyper_serde = "0.1.4" ipc-channel = "0.5" libc = "0.2" diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index c4395433383..38b35a07573 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -17,6 +17,7 @@ extern crate devtools_traits; extern crate euclid; extern crate gfx_traits; extern crate heapsize; +extern crate hyper; extern crate hyper_serde; extern crate ipc_channel; extern crate libc; @@ -46,9 +47,11 @@ use gfx_traits::DevicePixel; use gfx_traits::Epoch; use gfx_traits::StackingContextId; use heapsize::HeapSizeOf; +use hyper::header::Headers; +use hyper::method::Method; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use libc::c_void; -use msg::constellation_msg::{FrameId, FrameType, Image, Key, KeyModifiers, KeyState, LoadData}; +use msg::constellation_msg::{FrameId, FrameType, Image, Key, KeyModifiers, KeyState}; use msg::constellation_msg::{PipelineId, PipelineNamespaceId, ReferrerPolicy}; use msg::constellation_msg::{TraversalDirection, WindowSizeType}; use net_traits::{LoadOrigin, ResourceThreads}; @@ -119,6 +122,43 @@ pub enum LayoutControlMsg { GetWebFontLoadState(IpcSender), } +/// Similar to net::resource_thread::LoadData +/// can be passed to LoadUrl to load a page with GET/POST +/// parameters or headers +#[derive(Clone, Deserialize, Serialize)] +pub struct LoadData { + /// The URL. + pub url: Url, + /// The method. + #[serde(deserialize_with = "::hyper_serde::deserialize", + serialize_with = "::hyper_serde::serialize")] + pub method: Method, + /// The headers. + #[serde(deserialize_with = "::hyper_serde::deserialize", + serialize_with = "::hyper_serde::serialize")] + pub headers: Headers, + /// The data. + pub data: Option>, + /// The referrer policy. + pub referrer_policy: Option, + /// The referrer URL. + pub referrer_url: Option, +} + +impl LoadData { + /// Create a new `LoadData` object. + pub fn new(url: Url, referrer_policy: Option, referrer_url: Option) -> LoadData { + LoadData { + url: url, + method: Method::Get, + headers: Headers::new(), + data: None, + referrer_policy: referrer_policy, + referrer_url: referrer_url, + } + } +} + /// The initial data associated with a newly-created framed pipeline. #[derive(Deserialize, Serialize)] pub struct NewLayoutInfo { diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs index a4977286589..82b7af96f81 100644 --- a/components/script_traits/script_msg.rs +++ b/components/script_traits/script_msg.rs @@ -6,6 +6,7 @@ use AnimationState; use CompositorEvent; use DocumentState; use IFrameLoadInfo; +use LoadData; use MozBrowserEvent; use WorkerGlobalScopeInit; use WorkerScriptLoadOrigin; @@ -14,7 +15,7 @@ use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; use euclid::point::Point2D; use euclid::size::Size2D; use ipc_channel::ipc::IpcSender; -use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData}; +use msg::constellation_msg::{Key, KeyModifiers, KeyState}; use msg::constellation_msg::{PipelineId, TraversalDirection}; use net_traits::CoreResourceMsg; use offscreen_gl_context::{GLContextAttributes, GLLimits}; diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 6cbf4fb7f46..1642bd389d1 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -1385,13 +1385,10 @@ dependencies = [ "cssparser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper_serde 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "serde 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "webrender_traits 0.6.0 (git+https://github.com/servo/webrender)", ] @@ -2046,6 +2043,7 @@ dependencies = [ "gfx_traits 0.0.1", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", "hyper_serde 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index 93de252bda6..3bfdecd2368 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -33,12 +33,12 @@ use hyper::method::Method::{self, Post}; use image::{DynamicImage, ImageFormat, RgbImage}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use keys::keycodes_to_keys; -use msg::constellation_msg::{FrameId, LoadData, PipelineId}; +use msg::constellation_msg::{FrameId, PipelineId}; use msg::constellation_msg::{PixelFormat, TraversalDirection}; use regex::Captures; use rustc_serialize::base64::{CharacterSet, Config, Newline, ToBase64}; use rustc_serialize::json::{Json, ToJson}; -use script_traits::{ConstellationMsg, WebDriverCommandMsg}; +use script_traits::{ConstellationMsg, LoadData, WebDriverCommandMsg}; use script_traits::webdriver_msg::{LoadStatus, WebDriverCookieError, WebDriverFrameId}; use script_traits::webdriver_msg::{WebDriverJSError, WebDriverJSResult, WebDriverScriptCommand}; use std::borrow::ToOwned; diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index fa251d9d8c7..5b623988089 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -1285,13 +1285,10 @@ dependencies = [ "cssparser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper_serde 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "serde 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "webrender_traits 0.6.0 (git+https://github.com/servo/webrender)", ] @@ -1887,6 +1884,7 @@ dependencies = [ "gfx_traits 0.0.1", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", "hyper_serde 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",