From 185dbf0bf1787ed9acf84cb31fac8e90ae468720 Mon Sep 17 00:00:00 2001 From: Carmelo Messina Date: Wed, 10 Sep 2025 11:38:47 +0200 Subject: [PATCH] Keep disabled FetchLaterAPI: fix net::ERR_TIMED_OUT (#2308) also activates the API but denies the actual sending of the request --- .../patches/Keep-disabled-FetchLaterAPI.patch | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/build/patches/Keep-disabled-FetchLaterAPI.patch b/build/patches/Keep-disabled-FetchLaterAPI.patch index 398ca21b..71af2a5c 100644 --- a/build/patches/Keep-disabled-FetchLaterAPI.patch +++ b/build/patches/Keep-disabled-FetchLaterAPI.patch @@ -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 | 2 ++ .../renderer/core/fetch/fetch_manager.cc | 21 ++++++++++-- - .../loader/child_url_loader_factory_bundle.cc | 14 ++++---- + .../loader/child_url_loader_factory_bundle.cc | 16 +++++---- .../platform/loader/fetch/resource_fetcher.cc | 2 +- .../platform/runtime_enabled_features.json5 | 4 +-- - 7 files changed, 63 insertions(+), 16 deletions(-) + 7 files changed, 65 insertions(+), 16 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 @@ -146,20 +146,22 @@ diff --git a/third_party/blink/renderer/core/fetch/fetch_manager.cc b/third_part diff --git a/third_party/blink/renderer/platform/loader/child_url_loader_factory_bundle.cc b/third_party/blink/renderer/platform/loader/child_url_loader_factory_bundle.cc --- a/third_party/blink/renderer/platform/loader/child_url_loader_factory_bundle.cc +++ b/third_party/blink/renderer/platform/loader/child_url_loader_factory_bundle.cc -@@ -250,6 +250,12 @@ void ChildURLLoaderFactoryBundle::CreateLoaderAndStart( +@@ -250,6 +250,14 @@ void ChildURLLoaderFactoryBundle::CreateLoaderAndStart( return; } + bool keepalive = request.keepalive; -+ if (keepalive && !request.is_fetch_later_api && -+ url::IsSameOriginWith(request.url, request.referrer)) { -+ keepalive = false; ++ if (keepalive && !request.is_fetch_later_api) { ++ if (request.request_initiator && request.request_initiator->IsSameOriginWith(request.url)) ++ keepalive = false; ++ else if (url::IsSameOriginWith(request.url, request.referrer)) ++ keepalive = false; + } + // Use |keep_alive_loader_factory_| to send the keepalive requests to the // KeepAliveURLLoaderService in the browser process and trigger the special // keepalive request handling. -@@ -258,12 +264,8 @@ void ChildURLLoaderFactoryBundle::CreateLoaderAndStart( +@@ -258,12 +266,8 @@ void ChildURLLoaderFactoryBundle::CreateLoaderAndStart( if (request.keepalive) { FetchUtils::LogFetchKeepAliveRequestSentToServiceMetric(request); } @@ -195,8 +197,8 @@ diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 // https://chromestatus.com/feature/4654499737632768 - name: "FetchLaterAPI", - status: "stable", -+ name: "FetchLaterAPI", // disable -+ status: "experimental", // by default ++ name: "FetchLaterAPI", // disabled ++ status: "stable", // by default (note: idl must be active) }, { // The retry ability for Fetch keepalive requests.