Keep disabled FetchLaterAPI: fix the bypass for same-site requests (#2456)

This commit is contained in:
Carmelo Messina
2025-11-16 17:26:27 +01:00
parent ec71bf728c
commit f44cbf8576
@@ -13,10 +13,10 @@ License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
.../browser/loader/keep_alive_url_loader.h | 3 --
.../Keep-disabled-FetchLaterAPI.inc | 1 +
.../renderer/core/fetch/fetch_manager.cc | 21 ++++++++++--
.../loader/child_url_loader_factory_bundle.cc | 16 +++++++++
.../loader/child_url_loader_factory_bundle.cc | 20 +++++++++--
.../platform/loader/fetch/resource_fetcher.cc | 2 +-
.../platform/runtime_enabled_features.json5 | 4 +--
7 files changed, 70 insertions(+), 10 deletions(-)
7 files changed, 72 insertions(+), 12 deletions(-)
create mode 100644 cromite_flags/third_party/blink/common/features_cc/Keep-disabled-FetchLaterAPI.inc
diff --git a/content/browser/loader/keep_alive_url_loader.cc b/content/browser/loader/keep_alive_url_loader.cc
@@ -153,7 +153,7 @@ diff --git a/third_party/blink/renderer/platform/loader/child_url_loader_factory
#include "services/network/public/cpp/record_ontransfersizeupdate_utils.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/early_hints.mojom.h"
@@ -250,6 +251,20 @@ void ChildURLLoaderFactoryBundle::CreateLoaderAndStart(
@@ -250,16 +251,31 @@ void ChildURLLoaderFactoryBundle::CreateLoaderAndStart(
return;
}
@@ -174,9 +174,14 @@ diff --git a/third_party/blink/renderer/platform/loader/child_url_loader_factory
// Use |keep_alive_loader_factory_| to send the keepalive requests to the
// KeepAliveURLLoaderService in the browser process and trigger the special
// keepalive request handling.
@@ -260,6 +275,7 @@ void ChildURLLoaderFactoryBundle::CreateLoaderAndStart(
// |keep_alive_loader_factory_| only presents when
// features::kKeepAliveInBrowserMigration is true.
- if (request.keepalive) {
+ if (keepalive) {
FetchUtils::LogFetchKeepAliveRequestSentToServiceMetric(request);
}
if (request.keepalive && keep_alive_loader_factory_ &&
- if (request.keepalive && keep_alive_loader_factory_ &&
+ if (keepalive && keep_alive_loader_factory_ &&
base::FeatureList::IsEnabled(features::kKeepAliveInBrowserMigration)) {
+ // use keep alive loader on the browser side
keep_alive_loader_factory_->CreateLoaderAndStart(