mirror of
https://github.com/servo/servo
synced 2026-04-26 01:25:32 +02:00
script: Consolidate global initialization for fetch requests (#41663)
Rather than having each callside specifying the relevant information from the GlobalScope, do this via a trait instead. This would have saved us quite a bit of test debugging since we would often forget to set relevant information from the global context for a request. Now, in the future when we need additional information from the globalscope for a request, we only need to update this method to make that happen. Previously it would also sometimes use `document`, but calling the relevant information on either `document` or `globalscope` doesn't matter, since the `globalscope` defers to the value from the `document` anyways. Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
committed by
GitHub
parent
69169b7edd
commit
e2d62531f5
@@ -101,7 +101,7 @@ use crate::dom::url::URL;
|
||||
use crate::dom::videotrack::VideoTrack;
|
||||
use crate::dom::videotracklist::VideoTrackList;
|
||||
use crate::dom::virtualmethods::VirtualMethods;
|
||||
use crate::fetch::{FetchCanceller, create_a_potential_cors_request};
|
||||
use crate::fetch::{FetchCanceller, RequestWithGlobalScope, create_a_potential_cors_request};
|
||||
use crate::microtask::{Microtask, MicrotaskRunnable};
|
||||
use crate::network_listener::{self, FetchResponseListener, ResourceTimingListener};
|
||||
use crate::realms::{InRealm, enter_realm};
|
||||
@@ -1433,14 +1433,9 @@ impl HTMLMediaElement {
|
||||
cors_setting,
|
||||
None,
|
||||
global.get_referrer(),
|
||||
document.insecure_requests_policy(),
|
||||
document.has_trustworthy_ancestor_or_current_origin(),
|
||||
global.policy_container(),
|
||||
global.request_client(),
|
||||
)
|
||||
.with_global_scope(&global)
|
||||
.headers(headers)
|
||||
.origin(document.origin().immutable().clone())
|
||||
.pipeline_id(Some(self.global().pipeline_id()))
|
||||
.referrer_policy(document.get_referrer_policy());
|
||||
|
||||
let mut current_fetch_context = self.current_fetch_context.borrow_mut();
|
||||
|
||||
Reference in New Issue
Block a user