LibWeb/Fetch: Use a basic filtered response for redirect navigations

Match following change in the spec:
8f109835dc
This commit is contained in:
Aliaksandr Kalenik 2023-04-09 03:42:31 +03:00 committed by Linus Groh
parent c94924691d
commit 47f03c3a9a
Notes: sideshowbarker 2024-07-17 04:32:07 +09:00

View File

@ -920,15 +920,18 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_fetch(JS::Realm& rea
break;
// -> "manual"
case Infrastructure::Request::RedirectMode::Manual:
// Set response to an opaque-redirect filtered response whose internal response is actualResponse. If
// requests mode is "navigate", then set fetchParamss controllers next manual redirect steps to run
// HTTP-redirect fetch given fetchParams and response.
response = Infrastructure::OpaqueRedirectFilteredResponse::create(vm, *actual_response);
// 1. If requests mode is "navigate", then set fetchParamss controllers next manual redirect steps
// to run HTTP-redirect fetch given fetchParams and response.
if (request->mode() == Infrastructure::Request::Mode::Navigate) {
fetch_params.controller()->set_next_manual_redirect_steps([&realm, &fetch_params, response] {
(void)http_redirect_fetch(realm, fetch_params, *response);
});
}
// 2. Otherwise, set response to an opaque-redirect filtered response whose internal response is
// actualResponse.
else {
response = Infrastructure::OpaqueRedirectFilteredResponse::create(vm, *actual_response);
}
break;
// -> "follow"
case Infrastructure::Request::RedirectMode::Follow: