Disable Service and Shared workers on 3P iframe
Disabled by default due https://bugs.chromium.org/p/chromium/issues/detail?id=1147281 Workers can be reenabled per top-site-url using "Allow 3P Cookies" ("Block 3P Cookies" in ui to off) in site settings
This commit is contained in:
@@ -279,9 +279,9 @@ Timezone-customization.patch
|
||||
00Add-support-to-jxl.patch
|
||||
00Block-Intents-While-Locked.patch
|
||||
00Keep-Manta-Service-Disabled.patch
|
||||
00Disable-Service-and-Shared-workers-on-3P-iframe.patch
|
||||
|
||||
00Temp-PerformanceNavigationTiming-privacy-fix.patch
|
||||
00Temp-remove-support-for-shared-workers.patch
|
||||
|
||||
00Temp-Disable-kAutomaticLazyFrameLoadingToEmbeds.patch
|
||||
00Temp-disable-predictive-back-gesture.patch
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
From: uazo <uazo@users.noreply.github.com>
|
||||
Date: Sun, 5 Nov 2023 18:05:19 +0000
|
||||
Subject: Disable Service and Shared workers on 3P iframe
|
||||
|
||||
Disabled by default due https://bugs.chromium.org/p/chromium/issues/detail?id=1147281
|
||||
Workers can be reenabled per top-site-url using "Allow 3P Cookies"
|
||||
("Block 3P Cookies" in ui to off) in site settings
|
||||
|
||||
License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
|
||||
---
|
||||
.../content_settings_utils.cc | 39 +++++--------------
|
||||
1 file changed, 10 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/components/embedder_support/content_settings_utils.cc b/components/embedder_support/content_settings_utils.cc
|
||||
--- a/components/embedder_support/content_settings_utils.cc
|
||||
+++ b/components/embedder_support/content_settings_utils.cc
|
||||
@@ -29,16 +29,7 @@ namespace {
|
||||
// allowed by default, and access is only blocked due to general third-party
|
||||
// cookie blocking (and not due to a user specified pattern) then storage
|
||||
// access can be allowed.
|
||||
-bool PartitionedStorageByDefaultAllowed(
|
||||
- const content_settings::CookieSettingsBase::CookieSettingWithMetadata&
|
||||
- cookie_settings) {
|
||||
- return base::FeatureList::IsEnabled(
|
||||
- net::features::kThirdPartyStoragePartitioning) &&
|
||||
- base::FeatureList::IsEnabled(
|
||||
- net::features::kThirdPartyPartitionedStorageAllowedByDefault) &&
|
||||
- cookie_settings.BlockedByThirdPartyCookieBlocking();
|
||||
-}
|
||||
-
|
||||
+// (^^^ removed code)
|
||||
bool AllowWorkerStorageAccess(
|
||||
StorageType storage_type,
|
||||
const GURL& url,
|
||||
@@ -53,17 +44,11 @@ bool AllowWorkerStorageAccess(
|
||||
url, net::SiteForCookies::FromUrl(url), url::Origin::Create(url),
|
||||
net::CookieSettingOverrides(), &cookie_settings_metadata);
|
||||
|
||||
- if (!allow && PartitionedStorageByDefaultAllowed(cookie_settings_metadata)) {
|
||||
- allow = true;
|
||||
- }
|
||||
-
|
||||
// Allow storage when --test-third-party-cookie-phaseout is used, but ensure
|
||||
// that only partitioned storage is available. This developer flag is meant to
|
||||
// simulate Chrome's behavior when 3P cookies are turned down to help
|
||||
// developers test their site.
|
||||
- if (!allow && net::cookie_util::IsForceThirdPartyCookieBlockingEnabled()) {
|
||||
- allow = true;
|
||||
- }
|
||||
+ // (^^^^ removed code)
|
||||
|
||||
for (const auto& it : render_frames) {
|
||||
auto* rfh = content::RenderFrameHost::FromID(it);
|
||||
@@ -109,19 +94,16 @@ content::AllowServiceWorkerResult AllowServiceWorker(
|
||||
scope, site_for_cookies, top_frame_origin,
|
||||
cookie_settings->SettingOverridesForStorage(), &cookie_settings_metadata);
|
||||
|
||||
- if (!allow_cookies &&
|
||||
- PartitionedStorageByDefaultAllowed(cookie_settings_metadata)) {
|
||||
- allow_cookies = true;
|
||||
+ if (!allow_cookies && (!top_frame_origin.has_value()
|
||||
+ || !top_frame_origin->IsSameOriginWith(scope))) {
|
||||
+ return content::AllowServiceWorkerResult::No();
|
||||
}
|
||||
|
||||
// Allow storage when --test-third-party-cookie-phaseout is used, but ensure
|
||||
// that only partitioned storage is available. This developer flag is meant to
|
||||
// simulate Chrome's behavior when 3P cookies are turned down to help
|
||||
// developers test their site.
|
||||
- if (!allow_cookies &&
|
||||
- net::cookie_util::IsForceThirdPartyCookieBlockingEnabled()) {
|
||||
- allow_cookies = true;
|
||||
- }
|
||||
+ // (^^^^ removed code)
|
||||
|
||||
return content::AllowServiceWorkerResult::FromPolicy(!allow_javascript,
|
||||
!allow_cookies);
|
||||
@@ -143,17 +125,16 @@ bool AllowSharedWorker(
|
||||
worker_url, site_for_cookies, top_frame_origin,
|
||||
cookie_settings->SettingOverridesForStorage(), &cookie_settings_metadata);
|
||||
|
||||
- if (!allow && PartitionedStorageByDefaultAllowed(cookie_settings_metadata)) {
|
||||
- allow = true;
|
||||
+ if (!allow && (!top_frame_origin.has_value()
|
||||
+ || !top_frame_origin->IsSameOriginWith(worker_url))) {
|
||||
+ return false;
|
||||
}
|
||||
|
||||
// Allow storage when --test-third-party-cookie-phaseout is used, but ensure
|
||||
// that only partitioned storage is available. This developer flag is meant to
|
||||
// simulate Chrome's behavior when 3P cookies are turned down to help
|
||||
// developers test their site.
|
||||
- if (!allow && net::cookie_util::IsForceThirdPartyCookieBlockingEnabled()) {
|
||||
- allow = true;
|
||||
- }
|
||||
+ // (^^^^ removed code)
|
||||
|
||||
content_settings::PageSpecificContentSettings::SharedWorkerAccessed(
|
||||
render_process_id, render_frame_id, worker_url, name, storage_key,
|
||||
--
|
||||
2.25.1
|
||||
@@ -1,29 +0,0 @@
|
||||
From: uazo <uazo@users.noreply.github.com>
|
||||
Date: Wed, 11 Oct 2023 10:33:02 +0000
|
||||
Subject: Temp remove support for shared workers
|
||||
|
||||
Due to bugid 1147281 and 1490268 temporarily remove
|
||||
support for shared workers (active only in desktops)
|
||||
|
||||
Ref
|
||||
https://bugs.chromium.org/p/chromium/issues/detail?id=1147281
|
||||
https://bugs.chromium.org/p/chromium/issues/detail?id=1490268
|
||||
|
||||
Test with https://worker-playground.glitch.me/
|
||||
---
|
||||
chrome/browser/chrome_content_browser_client.cc | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
|
||||
--- a/chrome/browser/chrome_content_browser_client.cc
|
||||
+++ b/chrome/browser/chrome_content_browser_client.cc
|
||||
@@ -3164,6 +3164,7 @@ bool ChromeContentBrowserClient::AllowSharedWorker(
|
||||
content::BrowserContext* context,
|
||||
int render_process_id,
|
||||
int render_frame_id) {
|
||||
+ if ((true)) return false;
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
|
||||
// Check if cookies are allowed.
|
||||
--
|
||||
2.25.1
|
||||
Reference in New Issue
Block a user