diff options
Diffstat (limited to 'components/net_traits/request.rs')
-rw-r--r-- | components/net_traits/request.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/components/net_traits/request.rs b/components/net_traits/request.rs index 1fbcdabe868..bf7e22d2d0b 100644 --- a/components/net_traits/request.rs +++ b/components/net_traits/request.rs @@ -4,7 +4,7 @@ use hyper::header::Headers; use hyper::method::Method; -use msg::constellation_msg::ReferrerPolicy; +use msg::constellation_msg::{PipelineId, ReferrerPolicy}; use std::cell::{Cell, RefCell}; use std::mem::swap; use url::{Origin as UrlOrigin, Url}; @@ -130,6 +130,7 @@ pub struct RequestInit { // XXXManishearth these should be part of the client object pub referer_url: Option<Url>, pub referrer_policy: Option<ReferrerPolicy>, + pub pipeline_id: Option<PipelineId>, } /// A [Request](https://fetch.spec.whatwg.org/#requests) as defined by the Fetch spec @@ -159,6 +160,7 @@ pub struct Request { /// https://fetch.spec.whatwg.org/#concept-request-referrer pub referer: RefCell<Referer>, pub referrer_policy: Cell<Option<ReferrerPolicy>>, + pub pipeline_id: Cell<Option<PipelineId>>, pub synchronous: bool, pub mode: RequestMode, pub use_cors_preflight: bool, @@ -178,7 +180,8 @@ pub struct Request { impl Request { pub fn new(url: Url, origin: Option<Origin>, - is_service_worker_global_scope: bool) -> Request { + is_service_worker_global_scope: bool, + pipeline_id: Option<PipelineId>) -> Request { Request { method: RefCell::new(Method::Get), local_urls_only: false, @@ -198,6 +201,7 @@ impl Request { same_origin_data: Cell::new(false), referer: RefCell::new(Referer::Client), referrer_policy: Cell::new(None), + pipeline_id: Cell::new(pipeline_id), synchronous: false, mode: RequestMode::NoCORS, use_cors_preflight: false, @@ -216,7 +220,7 @@ impl Request { pub fn from_init(init: RequestInit) -> Request { let mut req = Request::new(init.url, Some(Origin::Origin(init.origin.origin())), - false); + false, init.pipeline_id); *req.method.borrow_mut() = init.method; *req.headers.borrow_mut() = init.headers; req.unsafe_request = init.unsafe_request; @@ -234,6 +238,7 @@ impl Request { Referer::NoReferer }; req.referrer_policy.set(init.referrer_policy); + req.pipeline_id.set(init.pipeline_id); req } @@ -241,7 +246,8 @@ impl Request { pub fn potential_cors_request(url: Url, cors_attribute_state: Option<CORSSettings>, is_service_worker_global_scope: bool, - same_origin_fallback: bool) -> Request { + same_origin_fallback: bool, + pipeline_id: Option<PipelineId>) -> Request { Request { method: RefCell::new(Method::Get), local_urls_only: false, @@ -281,6 +287,7 @@ impl Request { url_list: RefCell::new(vec![url]), redirect_count: Cell::new(0), response_tainting: Cell::new(ResponseTainting::Basic), + pipeline_id: Cell::new(pipeline_id), done: Cell::new(false) } } |