Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the legacy networking stack. #14360

Merged
merged 9 commits into from Nov 24, 2016

Remove unused LoadData and LoadOrigin types.

  • Loading branch information
Ms2ger committed Nov 24, 2016
commit d6db049a7f57304d55d0474ad23efe683a6b8654
@@ -40,7 +40,6 @@ use filemanager_thread::FileManagerThreadMsg;
use heapsize::HeapSizeOf;
use hyper::header::{ContentType, Headers};
use hyper::http::RawStatus;
use hyper::method::Method;
use hyper::mime::{Attr, Mime};
use hyper_serde::Serde;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
@@ -134,61 +133,6 @@ pub enum ReferrerPolicy {
StrictOriginWhenCrossOrigin,
}

#[derive(Clone, Deserialize, Serialize, HeapSizeOf)]
pub struct LoadData {
pub url: ServoUrl,
#[ignore_heap_size_of = "Defined in hyper"]
#[serde(deserialize_with = "::hyper_serde::deserialize",
serialize_with = "::hyper_serde::serialize")]
pub method: Method,
#[ignore_heap_size_of = "Defined in hyper"]
#[serde(deserialize_with = "::hyper_serde::deserialize",
serialize_with = "::hyper_serde::serialize")]
/// Headers that will apply to the initial request only
pub headers: Headers,
#[ignore_heap_size_of = "Defined in hyper"]
#[serde(deserialize_with = "::hyper_serde::deserialize",
serialize_with = "::hyper_serde::serialize")]
/// Headers that will apply to the initial request and any redirects
/// Unused in fetch
pub preserved_headers: Headers,
pub data: Option<Vec<u8>>,
pub cors: Option<ResourceCorsData>,
pub pipeline_id: Option<PipelineId>,
// https://fetch.spec.whatwg.org/#concept-http-fetch step 4.3
pub credentials_flag: bool,
pub context: LoadContext,
/// The policy and referring URL for the originator of this request
pub referrer_policy: Option<ReferrerPolicy>,
pub referrer_url: Option<ServoUrl>
}

impl LoadData {
pub fn new(context: LoadContext,
url: ServoUrl,
load_origin: &LoadOrigin) -> LoadData {
LoadData {
url: url,
method: Method::Get,
headers: Headers::new(),
preserved_headers: Headers::new(),
data: None,
cors: None,
pipeline_id: load_origin.pipeline_id(),
credentials_flag: true,
context: context,
referrer_policy: load_origin.referrer_policy(),
referrer_url: load_origin.referrer_url().clone(),
}
}
}

pub trait LoadOrigin {
fn referrer_url(&self) -> Option<ServoUrl>;
fn referrer_policy(&self) -> Option<ReferrerPolicy>;
fn pipeline_id(&self) -> Option<PipelineId>;
}

#[derive(Deserialize, Serialize)]
pub enum FetchResponseMsg {
// todo: should have fields for transmitted/total bytes
@@ -47,9 +47,8 @@ use ipc_channel::router::ROUTER;
use js::jsapi::{JSContext, JS_ParseJSON};
use js::jsapi::JS_ClearPendingException;
use js::jsval::{JSVal, NullValue, UndefinedValue};
use msg::constellation_msg::PipelineId;
use net_traits::{FetchMetadata, FilteredMetadata};
use net_traits::{FetchResponseListener, LoadOrigin, NetworkError, ReferrerPolicy};
use net_traits::{FetchResponseListener, NetworkError, ReferrerPolicy};
use net_traits::CoreResourceMsg::Fetch;
use net_traits::request::{CredentialsMode, Destination, RequestInit, RequestMode};
use net_traits::trim_http_whitespace;
@@ -272,20 +271,6 @@ impl XMLHttpRequest {
}
}

impl LoadOrigin for XMLHttpRequest {
fn referrer_url(&self) -> Option<ServoUrl> {
return self.referrer_url.clone();
}

fn referrer_policy(&self) -> Option<ReferrerPolicy> {
return self.referrer_policy;
}

fn pipeline_id(&self) -> Option<PipelineId> {
Some(self.global().pipeline_id())
}
}

impl XMLHttpRequestMethods for XMLHttpRequest {
// https://xhr.spec.whatwg.org/#handler-xhr-onreadystatechange
event_handler!(readystatechange, GetOnreadystatechange, SetOnreadystatechange);
@@ -597,7 +582,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
origin: self.global().get_url(),
referrer_url: self.referrer_url.clone(),
referrer_policy: self.referrer_policy.clone(),
pipeline_id: self.pipeline_id(),
pipeline_id: Some(self.global().pipeline_id()),
.. RequestInit::default()
};

@@ -125,7 +125,6 @@ pub enum LayoutControlMsg {
GetWebFontLoadState(IpcSender<bool>),
}

/// 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)]
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.