From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Dylan Cutler Date: Fri, 5 May 2023 16:53:42 +0000 Subject: [PATCH] Use StorageKey method to convert to IsolationInfo in background fetch Now that this method was merged in https://crrev.com/c/4496124, I am cleaning up places where we derive IsolationInfo from a StorageKey so that we can have only one implementation of the casting logic. The logic used in StorageKey::ToPartialNetIsolationInfo is almost identical to the logic here. The only difference is in first-party contexts, it uses the full storage origin for the top-frame origin, instead of making an origin from the top-frame site. Bug: None Change-Id: Ia0c2d1b8e776be5b918af54770dcc9a9450ed66c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4500186 Commit-Queue: Dylan Cutler Reviewed-by: Peter Beverloo Cr-Commit-Position: refs/heads/main@{#1140174} --- .../background_fetch_service_impl.cc | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/content/browser/background_fetch/background_fetch_service_impl.cc b/content/browser/background_fetch/background_fetch_service_impl.cc index d3b8c441ed525..34efc195dc75c 100644 --- a/content/browser/background_fetch/background_fetch_service_impl.cc +++ b/content/browser/background_fetch/background_fetch_service_impl.cc @@ -67,16 +67,11 @@ void BackgroundFetchServiceImpl::CreateForWorker( return; } - mojo::MakeSelfOwnedReceiver( - std::make_unique( - std::move(context), info.storage_key, - net::IsolationInfo::Create( - net::IsolationInfo::RequestType::kOther, - url::Origin::Create(info.storage_key.top_level_site().GetURL()), - info.storage_key.origin(), info.storage_key.ToNetSiteForCookies(), - /*party_context=*/absl::nullopt, info.storage_key.nonce()), - render_process_host, /*rfh=*/nullptr), - std::move(receiver)); + mojo::MakeSelfOwnedReceiver(std::make_unique( + std::move(context), info.storage_key, + info.storage_key.ToPartialNetIsolationInfo(), + render_process_host, /*rfh=*/nullptr), + std::move(receiver)); } // static