mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Remove unused LoadData and LoadOrigin types.
This commit is contained in:
parent
ffc2e09ea7
commit
d6db049a7f
3 changed files with 2 additions and 74 deletions
|
@ -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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue