mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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.
|
||||
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.
|
||||
// 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(
|
||||
request: &mut Request,
|
||||
cache: &mut CorsCache,
|
||||
cors_flag: bool,
|
||||
recursive_flag: bool,
|
||||
target: Target<'_>,
|
||||
done_chan: &mut DoneChannel,
|
||||
|
@ -323,18 +322,21 @@ pub async fn main_fetch(
|
|||
false
|
||||
};
|
||||
|
||||
if (same_origin && !cors_flag) ||
|
||||
current_scheme == "chrome" ||
|
||||
context.protocols.is_fetchable(current_scheme) ||
|
||||
// request's current URL's origin is same origin with request's origin, and request's
|
||||
// response tainting is "basic"
|
||||
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!(
|
||||
request.mode,
|
||||
RequestMode::Navigate | RequestMode::WebSocket { .. }
|
||||
)
|
||||
{
|
||||
// Substep 1.
|
||||
// Substep 1. Set request’s response tainting to "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
|
||||
} else if request.mode == RequestMode::SameOrigin {
|
||||
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;
|
||||
|
||||
// Step 22: Return the result of running main fetch given fetchParams and recursive.
|
||||
let fetch_response = main_fetch(
|
||||
request,
|
||||
cache,
|
||||
cors_flag,
|
||||
recursive_flag,
|
||||
target,
|
||||
done_chan,
|
||||
context,
|
||||
)
|
||||
.await;
|
||||
let fetch_response =
|
||||
main_fetch(request, cache, recursive_flag, target, done_chan, context).await;
|
||||
|
||||
// TODO: timing allow check
|
||||
context
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
[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]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
[redirect-back-to-original-origin.any.html]
|
||||
[original => remote => original with mode: "no-cors"]
|
||||
expected: FAIL
|
||||
|
||||
|
||||
[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]
|
||||
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