From 47f03c3a9ab383b711b51d45f9e8c6dfc588eef9 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Sun, 9 Apr 2023 03:42:31 +0300 Subject: [PATCH] LibWeb/Fetch: Use a basic filtered response for redirect navigations Match following change in the spec: https://github.com/whatwg/fetch/commit/8f109835dcff90d19caed4b551a0da32d9d0f57e --- Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp index 718f6d52724..3cb82cf0483 100644 --- a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp @@ -920,15 +920,18 @@ WebIDL::ExceptionOr> 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 - // request’s mode is "navigate", then set fetchParams’s controller’s next manual redirect steps to run - // HTTP-redirect fetch given fetchParams and response. - response = Infrastructure::OpaqueRedirectFilteredResponse::create(vm, *actual_response); + // 1. If request’s mode is "navigate", then set fetchParams’s controller’s 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: