mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Update response handling in main_fetch (#34570)
Signed-off-by: Shane Handley <shanehandley@fastmail.com>
This commit is contained in:
parent
3f85a27097
commit
bd37d5496d
5 changed files with 11 additions and 30 deletions
|
@ -176,7 +176,7 @@ pub async fn fetch_with_cors_cache(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 17: Run main fetch given fetchParams.
|
// Step 17: Run main fetch given fetchParams.
|
||||||
main_fetch(request, cache, false, false, target, &mut None, context).await;
|
main_fetch(request, cache, false, target, &mut None, context).await;
|
||||||
|
|
||||||
// Step 18: Return fetchParams’s controller.
|
// Step 18: Return fetchParams’s controller.
|
||||||
// TODO: We don't implement fetchParams as defined in the spec
|
// TODO: We don't implement fetchParams as defined in the spec
|
||||||
|
@ -215,7 +215,6 @@ pub fn should_request_be_blocked_by_csp(
|
||||||
pub async fn main_fetch(
|
pub async fn main_fetch(
|
||||||
request: &mut Request,
|
request: &mut Request,
|
||||||
cache: &mut CorsCache,
|
cache: &mut CorsCache,
|
||||||
cors_flag: bool,
|
|
||||||
recursive_flag: bool,
|
recursive_flag: bool,
|
||||||
target: Target<'_>,
|
target: Target<'_>,
|
||||||
done_chan: &mut DoneChannel,
|
done_chan: &mut DoneChannel,
|
||||||
|
@ -323,18 +322,21 @@ pub async fn main_fetch(
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
|
|
||||||
if (same_origin && !cors_flag) ||
|
// request's current URL's origin is same origin with request's origin, and request's
|
||||||
current_scheme == "chrome" ||
|
// response tainting is "basic"
|
||||||
context.protocols.is_fetchable(current_scheme) ||
|
if (same_origin && request.response_tainting == ResponseTainting::Basic) ||
|
||||||
|
// request's current URL's scheme is "data"
|
||||||
|
current_scheme == "data" ||
|
||||||
|
// request's mode is "navigate" or "websocket"
|
||||||
matches!(
|
matches!(
|
||||||
request.mode,
|
request.mode,
|
||||||
RequestMode::Navigate | RequestMode::WebSocket { .. }
|
RequestMode::Navigate | RequestMode::WebSocket { .. }
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Substep 1.
|
// Substep 1. Set request’s response tainting to "basic".
|
||||||
request.response_tainting = ResponseTainting::Basic;
|
request.response_tainting = ResponseTainting::Basic;
|
||||||
|
|
||||||
// Substep 2.
|
// Substep 2. Return the result of running scheme fetch given fetchParams.
|
||||||
scheme_fetch(request, cache, target, done_chan, context).await
|
scheme_fetch(request, cache, target, done_chan, context).await
|
||||||
} else if request.mode == RequestMode::SameOrigin {
|
} else if request.mode == RequestMode::SameOrigin {
|
||||||
Response::network_error(NetworkError::Internal("Cross-origin response".into()))
|
Response::network_error(NetworkError::Internal("Cross-origin response".into()))
|
||||||
|
|
|
@ -1086,16 +1086,8 @@ pub async fn http_redirect_fetch(
|
||||||
let recursive_flag = request.redirect_mode != RedirectMode::Manual;
|
let recursive_flag = request.redirect_mode != RedirectMode::Manual;
|
||||||
|
|
||||||
// Step 22: Return the result of running main fetch given fetchParams and recursive.
|
// Step 22: Return the result of running main fetch given fetchParams and recursive.
|
||||||
let fetch_response = main_fetch(
|
let fetch_response =
|
||||||
request,
|
main_fetch(request, cache, recursive_flag, target, done_chan, context).await;
|
||||||
cache,
|
|
||||||
cors_flag,
|
|
||||||
recursive_flag,
|
|
||||||
target,
|
|
||||||
done_chan,
|
|
||||||
context,
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
|
|
||||||
// TODO: timing allow check
|
// TODO: timing allow check
|
||||||
context
|
context
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
[stylesheet-same-origin.sub.html]
|
[stylesheet-same-origin.sub.html]
|
||||||
[Origin-clean check in cross-origin CSSOM Stylesheets (redirect from cross-origin to same-origin)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Origin-clean check in loading error CSSOM Stylesheets]
|
[Origin-clean check in loading error CSSOM Stylesheets]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
[redirect-back-to-original-origin.any.html]
|
[redirect-back-to-original-origin.any.html]
|
||||||
[original => remote => original with mode: "no-cors"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
|
|
||||||
[redirect-back-to-original-origin.any.worker.html]
|
[redirect-back-to-original-origin.any.worker.html]
|
||||||
[original => remote => original with mode: "no-cors"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
|
|
||||||
[redirect-back-to-original-origin.any.serviceworker.html]
|
[redirect-back-to-original-origin.any.serviceworker.html]
|
||||||
expected: ERROR
|
expected: ERROR
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
[canvas-remote-read-remote-image-redirect.html]
|
|
||||||
[Load a no-cors image from a same-origin URL that redirects to a cross-origin URL that redirects to the initial origin]
|
|
||||||
expected: FAIL
|
|
Loading…
Add table
Add a link
Reference in a new issue