mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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>
This commit is contained in:
parent
b87a0db497
commit
8b115c246c
4 changed files with 28 additions and 7 deletions
|
@ -10,7 +10,7 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
|||
|
||||
use async_recursion::async_recursion;
|
||||
use base::cross_process_instant::CrossProcessInstant;
|
||||
use base::id::{HistoryStateId, PipelineId};
|
||||
use base::id::{HistoryStateId, PipelineId, TopLevelBrowsingContextId};
|
||||
use crossbeam_channel::Sender;
|
||||
use devtools_traits::{
|
||||
ChromeToDevtoolsControlMsg, DevtoolsControlMsg, HttpRequest as DevtoolsHttpRequest,
|
||||
|
@ -1571,8 +1571,10 @@ async fn http_network_or_cache_fetch(
|
|||
|
||||
// Step 14.3 If request’s use-URL-credentials flag is unset or isAuthenticationFetch is true, then:
|
||||
if !http_request.use_url_credentials || authentication_fetch_flag {
|
||||
let Some(credentials) = prompt_user_for_credentials(&context.state.embedder_proxy)
|
||||
else {
|
||||
let Some(credentials) = prompt_user_for_credentials(
|
||||
&context.state.embedder_proxy,
|
||||
http_request.target_browsing_context_id,
|
||||
) else {
|
||||
return response;
|
||||
};
|
||||
let Some(username) = credentials.username else {
|
||||
|
@ -1625,7 +1627,10 @@ async fn http_network_or_cache_fetch(
|
|||
|
||||
// Step 15.4 Prompt the end user as appropriate in request’s window
|
||||
// window and store the result as a proxy-authentication entry.
|
||||
let Some(credentials) = prompt_user_for_credentials(&context.state.embedder_proxy) else {
|
||||
let Some(credentials) = prompt_user_for_credentials(
|
||||
&context.state.embedder_proxy,
|
||||
http_request.target_browsing_context_id,
|
||||
) else {
|
||||
return response;
|
||||
};
|
||||
let Some(user_name) = credentials.username else {
|
||||
|
@ -1762,13 +1767,14 @@ impl Drop for ResponseEndTimer {
|
|||
|
||||
fn prompt_user_for_credentials(
|
||||
embedder_proxy: &Mutex<EmbedderProxy>,
|
||||
top_level_browsing_context_id: Option<TopLevelBrowsingContextId>,
|
||||
) -> Option<PromptCredentialsInput> {
|
||||
let proxy = embedder_proxy.lock().unwrap();
|
||||
|
||||
let (ipc_sender, ipc_receiver) = ipc::channel().unwrap();
|
||||
|
||||
proxy.send((
|
||||
None,
|
||||
top_level_browsing_context_id,
|
||||
EmbedderMsg::Prompt(
|
||||
PromptDefinition::Credentials(ipc_sender),
|
||||
PromptOrigin::Trusted,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue