mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Implementing the builder pattern for RequestInit
This commit is contained in:
parent
dd2deeabca
commit
6b2be9b31d
27 changed files with 578 additions and 546 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue