diff --git a/chrome/browser/web_applications/extensions/extension_status_utils.cc b/chrome/browser/web_applications/extensions/extension_status_utils.cc index 64c84164c082b..0e2cd102f0c20 100644 --- a/chrome/browser/web_applications/extensions/extension_status_utils.cc +++ b/chrome/browser/web_applications/extensions/extension_status_utils.cc @@ -96,6 +96,10 @@ bool IsExternalExtensionUninstalled(content::BrowserContext* context, #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) bool IsExtensionUnsupportedDeprecatedApp(content::BrowserContext* context, const std::string& extension_id) { + // POC: allow platform apps so the POC app can launch on Linux. + if (!testing::g_enable_chrome_apps_for_testing) { + return false; + } if (testing::g_enable_chrome_apps_for_testing) { return false; } diff --git a/content/browser/preloading/prefetch/prefetch_streaming_url_loader.cc b/content/browser/preloading/prefetch/prefetch_streaming_url_loader.cc index 065c5503df617..2a25fe1069074 100644 --- a/content/browser/preloading/prefetch/prefetch_streaming_url_loader.cc +++ b/content/browser/preloading/prefetch/prefetch_streaming_url_loader.cc @@ -380,6 +380,10 @@ void PrefetchStreamingURLLoader::StartServiceWorkerInterceptor( static_cast( browser_context->GetDefaultStoragePartition() ->GetServiceWorkerContext()); + LOG(ERROR) << "[POC] PrefetchStreamingURLLoader: SW interceptor for prefetch " + "url=" << request.url + << " using DEFAULT partition sw_context=" + << static_cast(service_worker_context); service_worker_handle_ = std::make_unique( service_worker_context, base::DoNothing(), std::move(fetch_event_client_id)); diff --git a/content/browser/service_worker/service_worker_main_resource_handle.cc b/content/browser/service_worker/service_worker_main_resource_handle.cc index 4cd3f0044247e..d335ab6729978 100644 --- a/content/browser/service_worker/service_worker_main_resource_handle.cc +++ b/content/browser/service_worker/service_worker_main_resource_handle.cc @@ -6,6 +6,7 @@ #include +#include "base/debug/stack_trace.h" #include "base/functional/bind.h" #include "content/browser/preloading/prefetch/prefetch_features.h" #include "content/browser/renderer_host/policy_container_host.h" @@ -109,6 +110,35 @@ bool ServiceWorkerMainResourceHandle::InitializeForRequest( client_for_prefetch->key() != key) { return false; } + // === POC INSTRUMENTATION =================================== + // The top_frame_origin/key check above just passed. Now verify whether the + // prefetch's ServiceWorkerClient lives in the same StoragePartition as this + // navigation's handle. They MUST match for correct isolation; if they + // differ, a cross-partition ServiceWorker controller is about to be + // installed on the navigation's client below. + ServiceWorkerContextCore* nav_ctx = context_wrapper_->context(); + ServiceWorkerContextCore* prefetch_ctx = + client_for_prefetch->context().get(); + LOG(ERROR) << "[POC] InitializeForRequest url=" << url + << " key=" << key.GetDebugString() + << " nav_partition=" + << static_cast(context_wrapper_->storage_partition()) + << " nav_sw_context=" << static_cast(nav_ctx) + << " prefetch_sw_context=" << static_cast(prefetch_ctx); + if (nav_ctx != prefetch_ctx) { + LOG(ERROR) + << "[POC] *** CROSS-PARTITION SERVICEWORKER CONTROLLER ADOPTION ***"; + LOG(ERROR) + << "[POC] The prefetch's ServiceWorkerClient belongs to a different " + "ServiceWorkerContextCore (i.e. a different StoragePartition) " + "than the navigation handle. About to install a " + "default-partition ServiceWorkerRegistration as the controller " + "of a non-default-partition client."; + base::debug::StackTrace().Print(); + // Intentionally fall through so the cross-partition adoption proceeds + // and its impact is observable in the guest WebView. + } + // === END POC INSTRUMENTATION =============================== } isolation_info_ = std::move(new_isolation_info);