diff options
author | Lucas Fantacuci <lucasfantacuci@gmail.com> | 2018-12-21 17:38:22 -0200 |
---|---|---|
committer | Lucas Sanches Fantacuci <lucasfantacuci@gmail.com> | 2019-04-10 14:01:30 -0300 |
commit | 6b2be9b31de1503e90a62cc7d597dc4bd467d998 (patch) | |
tree | 869e624bc018c9a7f97d40dccea6883f66d400da /components/script/script_thread.rs | |
parent | dd2deeabca7eeb40e6a8fe0c1ee4550d64e0c235 (diff) | |
download | servo-6b2be9b31de1503e90a62cc7d597dc4bd467d998.tar.gz servo-6b2be9b31de1503e90a62cc7d597dc4bd467d998.zip |
Implementing the builder pattern for RequestInit
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 28a9a52566f..135e05abd0b 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -110,7 +110,7 @@ use msg::constellation_msg::{BrowsingContextId, HistoryStateId, PipelineId}; use msg::constellation_msg::{HangAnnotation, MonitoredComponentId, MonitoredComponentType}; use msg::constellation_msg::{PipelineNamespace, TopLevelBrowsingContextId}; use net_traits::image_cache::{ImageCache, PendingImageResponse}; -use net_traits::request::{CredentialsMode, Destination, RedirectMode, RequestInit}; +use net_traits::request::{CredentialsMode, Destination, RedirectMode, RequestBuilder}; use net_traits::storage_thread::StorageType; use net_traits::{FetchMetadata, FetchResponseListener, FetchResponseMsg}; use net_traits::{ @@ -3327,21 +3327,18 @@ impl ScriptThread { /// argument until a notification is received that the fetch is complete. fn pre_page_load(&self, mut incomplete: InProgressLoad, load_data: LoadData) { let id = incomplete.pipeline_id.clone(); - let req_init = RequestInit { - url: load_data.url.clone(), - method: load_data.method, - destination: Destination::Document, - credentials_mode: CredentialsMode::Include, - use_url_credentials: true, - pipeline_id: Some(id), - referrer_url: load_data.referrer_url, - referrer_policy: load_data.referrer_policy, - headers: load_data.headers, - body: load_data.data, - redirect_mode: RedirectMode::Manual, - origin: incomplete.origin.immutable().clone(), - ..RequestInit::default() - }; + let req_init = RequestBuilder::new(load_data.url.clone()) + .method(load_data.method) + .destination(Destination::Document) + .credentials_mode(CredentialsMode::Include) + .use_url_credentials(true) + .pipeline_id(Some(id)) + .referrer_url(load_data.referrer_url) + .referrer_policy(load_data.referrer_policy) + .headers(load_data.headers) + .body(load_data.data) + .redirect_mode(RedirectMode::Manual) + .origin(incomplete.origin.immutable().clone()); let context = ParserContext::new(id, load_data.url); self.incomplete_parser_contexts |