Move LoadData to script_traits.

This commit is contained in:
Ms2ger 2016-10-18 15:12:44 +02:00
parent bb271ef4af
commit e97f06800e
16 changed files with 67 additions and 66 deletions

View file

@ -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"

View file

@ -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<webrender_traits::ImageKey>,
}
/// 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<Vec<u8>>,
pub referrer_policy: Option<ReferrerPolicy>,
pub referrer_url: Option<Url>,
}
impl LoadData {
pub fn new(url: Url, referrer_policy: Option<ReferrerPolicy>, referrer_url: Option<Url>) -> 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),

View file

@ -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;