aboutsummaryrefslogtreecommitdiffstats
path: root/components/shared/net/request.rs
diff options
context:
space:
mode:
authorJason Tsai <git@pews.dev>2025-01-03 14:35:16 +0800
committerGitHub <noreply@github.com>2025-01-03 06:35:16 +0000
commit8b115c246c752f5a06b33fe7abb492bb2b8919c4 (patch)
tree9eaec87878469cf3f35abc2c3ddb32077b17a38b /components/shared/net/request.rs
parentb87a0db49707d79aeddd825b3374e67d46f02da7 (diff)
downloadservo-8b115c246c752f5a06b33fe7abb492bb2b8919c4.tar.gz
servo-8b115c246c752f5a06b33fe7abb492bb2b8919c4.zip
fix: add source browsing context to `Request` and HTTP credentials prompt (#34808)
* fix: add source browsing ctx id to request when initiate navigation Signed-off-by: Jason Tsai <git@pews.dev> * chore: clippy Signed-off-by: Jason Tsai <git@pews.dev> * Update components/net/http_loader.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Jason Tsai <git@pews.dev> * chore: apply suggestions Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Jason Tsai <git@pews.dev> * chore: fix naming Signed-off-by: Jason Tsai <git@pews.dev> * refactor: set request browsing ctx id on pre page load Signed-off-by: Jason Tsai <git@pews.dev> --------- Signed-off-by: Jason Tsai <git@pews.dev> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/shared/net/request.rs')
-rw-r--r--components/shared/net/request.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/components/shared/net/request.rs b/components/shared/net/request.rs
index ac4844ef6f6..4f298ce9368 100644
--- a/components/shared/net/request.rs
+++ b/components/shared/net/request.rs
@@ -5,7 +5,7 @@
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
-use base::id::PipelineId;
+use base::id::{PipelineId, TopLevelBrowsingContextId};
use content_security_policy::{self as csp};
use http::header::{HeaderName, AUTHORIZATION};
use http::{HeaderMap, Method};
@@ -267,6 +267,7 @@ pub struct RequestBuilder {
pub referrer: Referrer,
pub referrer_policy: ReferrerPolicy,
pub pipeline_id: Option<PipelineId>,
+ pub target_browsing_context_id: Option<TopLevelBrowsingContextId>,
pub redirect_mode: RedirectMode,
pub integrity_metadata: String,
// to keep track of redirects
@@ -301,6 +302,7 @@ impl RequestBuilder {
referrer,
referrer_policy: ReferrerPolicy::EmptyString,
pipeline_id: None,
+ target_browsing_context_id: None,
redirect_mode: RedirectMode::Follow,
integrity_metadata: "".to_owned(),
url_list: vec![],
@@ -382,6 +384,14 @@ impl RequestBuilder {
self
}
+ pub fn target_browsing_context_id(
+ mut self,
+ target_browsing_context_id: Option<TopLevelBrowsingContextId>,
+ ) -> RequestBuilder {
+ self.target_browsing_context_id = target_browsing_context_id;
+ self
+ }
+
pub fn redirect_mode(mut self, redirect_mode: RedirectMode) -> RequestBuilder {
self.redirect_mode = redirect_mode;
self
@@ -452,6 +462,7 @@ impl RequestBuilder {
request.response_tainting = self.response_tainting;
request.crash = self.crash;
request.policy_container = self.policy_container;
+ request.target_browsing_context_id = self.target_browsing_context_id;
request
}
}
@@ -479,7 +490,7 @@ pub struct Request {
pub body: Option<RequestBody>,
// TODO: client object
pub window: Window,
- // TODO: target browsing context
+ pub target_browsing_context_id: Option<TopLevelBrowsingContextId>,
/// <https://fetch.spec.whatwg.org/#request-keepalive-flag>
pub keep_alive: bool,
/// <https://fetch.spec.whatwg.org/#request-service-workers-mode>
@@ -555,6 +566,7 @@ impl Request {
referrer,
referrer_policy: ReferrerPolicy::EmptyString,
pipeline_id,
+ target_browsing_context_id: None,
synchronous: false,
mode: RequestMode::NoCors,
use_cors_preflight: false,