Skip to content

Commit

Permalink
adapt to v118
Browse files Browse the repository at this point in the history
  • Loading branch information
uazo committed Oct 11, 2023
1 parent 1385f9d commit 3d7a50f
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 18 deletions.
63 changes: 61 additions & 2 deletions build/patches/00Partitioning-all-cookies-by-top-frame-domain.patch
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ samesite=none first-party cookies are sent in third-party contexts.

License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
---
net/base/features.cc | 8 ++++----
.../browser/net/profile_network_context_service.cc | 8 ++++----
.../core/common/cookie_settings_base.cc | 2 +-
net/base/features.cc | 12 ++++++------
net/cookies/canonical_cookie.cc | 12 +-----------
net/cookies/cookie_deletion_info.cc | 3 ++-
net/cookies/parsed_cookie.h | 7 ++++++-
Expand All @@ -19,8 +21,43 @@ License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
.../renderer/modules/cookie_store/cookie_init.idl | 2 +-
.../renderer/modules/cookie_store/cookie_store.cc | 12 ++++++++++++
.../cookie_store/cookie_store_delete_options.idl | 2 +-
10 files changed, 50 insertions(+), 21 deletions(-)
ui/webui/webui_allowlist.cc | 1 +
13 files changed, 58 insertions(+), 28 deletions(-)

diff --git a/chrome/browser/net/profile_network_context_service.cc b/chrome/browser/net/profile_network_context_service.cc
--- a/chrome/browser/net/profile_network_context_service.cc
+++ b/chrome/browser/net/profile_network_context_service.cc
@@ -628,14 +628,14 @@ ProfileNetworkContextService::CreateCookieManagerParams(
// UI to interact with SameSite cookies on accounts.google.com, which is used
// for displaying a list of available accounts on the NTP
// (chrome://new-tab-page), etc.
- out->secure_origin_cookies_allowed_schemes.push_back(
- content::kChromeUIScheme);
+ // out->secure_origin_cookies_allowed_schemes.push_back(
+ // content::kChromeUIScheme);
#if BUILDFLAG(ENABLE_EXTENSIONS)
// TODO(chlily): To be consistent with the content_settings version of
// CookieSettings, we should probably also add kExtensionScheme to the list of
// matching_scheme_cookies_allowed_schemes.
- out->third_party_cookies_allowed_schemes.push_back(
- extensions::kExtensionScheme);
+ // out->third_party_cookies_allowed_schemes.push_back(
+ // extensions::kExtensionScheme);
#endif

HostContentSettingsMap* host_content_settings_map =
diff --git a/components/content_settings/core/common/cookie_settings_base.cc b/components/content_settings/core/common/cookie_settings_base.cc
--- a/components/content_settings/core/common/cookie_settings_base.cc
+++ b/components/content_settings/core/common/cookie_settings_base.cc
@@ -326,7 +326,7 @@ CookieSettingsBase::GetCookieSettingInternal(
absl::optional<ThirdPartyBlockingScope> scope;
if (block_third) {
scope = IsAllowed(setting)
- ? ThirdPartyBlockingScope::kUnpartitionedOnly
+ ? ThirdPartyBlockingScope::kUnpartitionedAndPartitioned
: ThirdPartyBlockingScope::kUnpartitionedAndPartitioned;
}
return {block_third ? CONTENT_SETTING_BLOCK : setting, scope,
diff --git a/net/base/features.cc b/net/base/features.cc
--- a/net/base/features.cc
+++ b/net/base/features.cc
Expand All @@ -46,6 +83,17 @@ diff --git a/net/base/features.cc b/net/base/features.cc

// Enables partitioning of third party storage (IndexedDB, CacheStorage, etc.)
// by the top level site to reduce fingerprinting.
@@ -490,8 +490,8 @@ BASE_FEATURE(kDigestAuthEnableSecureAlgorithms,
// third-party cookies are disabled due to a specific rule.
// TODO(crbug.com/1468277): Default enable when UI work is complete.
BASE_FEATURE(kThirdPartyPartitionedStorageAllowedByDefault,
- "ThirdPartyPartitionedStorageAllowedByDefault",
- base::FEATURE_DISABLED_BY_DEFAULT);
+ "ThirdPartyPartitionedStorageAllowedByDefault", // must be
+ base::FEATURE_DISABLED_BY_DEFAULT); // disabled

BASE_FEATURE(kCookieDeprecationFacilitatedTestingLabels,
"CookieDeprecationFacilitatedTestingLabels",
diff --git a/net/cookies/canonical_cookie.cc b/net/cookies/canonical_cookie.cc
--- a/net/cookies/canonical_cookie.cc
+++ b/net/cookies/canonical_cookie.cc
Expand Down Expand Up @@ -233,5 +281,16 @@ diff --git a/third_party/blink/renderer/modules/cookie_store/cookie_store_delete
- [RuntimeEnabled=PartitionedCookies] boolean partitioned = false;
+ [RuntimeEnabled=PartitionedCookies] boolean partitioned = true;
};
diff --git a/ui/webui/webui_allowlist.cc b/ui/webui/webui_allowlist.cc
--- a/ui/webui/webui_allowlist.cc
+++ b/ui/webui/webui_allowlist.cc
@@ -74,6 +74,7 @@ void WebUIAllowlist::RegisterAutoGrantedPermissions(
void WebUIAllowlist::RegisterAutoGrantedThirdPartyCookies(
const url::Origin& top_level_origin,
const std::vector<ContentSettingsPattern>& origin_patterns) {
+ if ((true)) return;
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);

--
2.25.1
63 changes: 47 additions & 16 deletions build/patches/Disable-all-predictors-code.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ Original License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
---
chrome/browser/BUILD.gn | 8 +--
chrome/browser/browser_features.cc | 16 +++---
chrome/browser/browser_features.cc | 16 ++---
.../preloading_model_keyed_service.cc | 8 ---
.../preloading_model_keyed_service_factory.cc | 4 +-
.../ranking/history_clusters_module_ranker.cc | 3 +-
.../chrome_hints_manager.cc | 1 +
.../optimization_guide_keyed_service.cc | 1 -
.../browser/predictors/loading_predictor.cc | 4 +-
.../predictors/loading_predictor_config.cc | 4 +-
.../browser/predictors/predictors_features.cc | 14 ++---
chrome/common/chrome_features.cc | 10 ++--
.../browser/predictors/predictors_features.cc | 14 +---
chrome/common/chrome_features.cc | 10 +--
.../optimization_guide/core/hints_fetcher.cc | 1 +
.../optimization_guide/core/hints_manager.cc | 5 ++
.../core/optimization_guide_features.cc | 53 ++++++++-----------
.../core/prediction_model_download_manager.cc | 6 ++-
.../core/optimization_guide_features.cc | 72 +++++++------------
.../core/prediction_model_download_manager.cc | 6 +-
.../core/prediction_model_fetcher_impl.cc | 1 +
components/optimization_guide/features.gni | 3 +-
components/permissions/features.cc | 8 +--
third_party/blink/common/features.cc | 12 ++---
third_party/blink/common/features.cc | 12 ++--
.../platform/runtime_enabled_features.json5 | 2 +-
20 files changed, 70 insertions(+), 94 deletions(-)
20 files changed, 76 insertions(+), 107 deletions(-)

diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
--- a/chrome/browser/BUILD.gn
Expand Down Expand Up @@ -297,7 +297,21 @@ diff --git a/components/optimization_guide/core/hints_manager.cc b/components/op
diff --git a/components/optimization_guide/core/optimization_guide_features.cc b/components/optimization_guide/core/optimization_guide_features.cc
--- a/components/optimization_guide/core/optimization_guide_features.cc
+++ b/components/optimization_guide/core/optimization_guide_features.cc
@@ -47,13 +47,6 @@ constexpr auto enabled_by_default_mobile_only =
@@ -33,13 +33,6 @@ namespace features {

namespace {

-constexpr auto enabled_by_default_desktop_only =
-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
- base::FEATURE_DISABLED_BY_DEFAULT;
-#else
- base::FEATURE_ENABLED_BY_DEFAULT;
-#endif
-
constexpr auto enabled_by_default_mobile_only =
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
true;
@@ -47,13 +40,6 @@ constexpr auto enabled_by_default_mobile_only =
false;
#endif

Expand All @@ -311,7 +325,7 @@ diff --git a/components/optimization_guide/core/optimization_guide_features.cc b
// Returns whether |locale| is a supported locale for |feature|.
//
// This matches |locale| with the "supported_locales" feature param value in
@@ -99,17 +92,17 @@ bool IsSupportedLocaleForFeature(
@@ -99,17 +85,17 @@ bool IsSupportedLocaleForFeature(
// Enables the syncing of the Optimization Hints component, which provides
// hints for what optimizations can be applied on a page load.
BASE_FEATURE(kOptimizationHints,
Expand All @@ -335,7 +349,7 @@ diff --git a/components/optimization_guide/core/optimization_guide_features.cc b

// Enables performance info in the context menu and fetching from a remote
// Optimization Guide Service.
@@ -119,17 +112,13 @@ BASE_FEATURE(kContextMenuPerformanceInfoAndRemoteHintFetching,
@@ -119,33 +105,29 @@ BASE_FEATURE(kContextMenuPerformanceInfoAndRemoteHintFetching,

// Enables the prediction of optimization targets.
BASE_FEATURE(kOptimizationTargetPrediction,
Expand All @@ -357,7 +371,11 @@ diff --git a/components/optimization_guide/core/optimization_guide_features.cc b
);

// Enables page content to be annotated.
@@ -139,8 +128,8 @@ BASE_FEATURE(kPageContentAnnotations,
BASE_FEATURE(kPageContentAnnotations,
- "PageContentAnnotations",
- enabled_by_default_desktop_only);
+ "PageContentAnnotations", // disabled
+ base::FEATURE_DISABLED_BY_DEFAULT); // by default

// Enables fetching page metadata from the remote Optimization Guide service.
BASE_FEATURE(kRemotePageMetadata,
Expand All @@ -368,7 +386,14 @@ diff --git a/components/optimization_guide/core/optimization_guide_features.cc b

// Enables the page entities model to be annotated on every page load.
BASE_FEATURE(kPageEntitiesPageContentAnnotations,
@@ -168,8 +157,8 @@ BASE_FEATURE(kPageEntitiesModelResetOnShutdown,
- "PageEntitiesPageContentAnnotations",
- enabled_by_default_desktop_only);
+ "PageEntitiesPageContentAnnotations", // disabled
+ base::FEATURE_DISABLED_BY_DEFAULT); // by default
// Enables the page visibility model to be annotated on every page load.
BASE_FEATURE(kPageVisibilityPageContentAnnotations,
"PageVisibilityPageContentAnnotations",
@@ -168,8 +150,8 @@ BASE_FEATURE(kPageEntitiesModelResetOnShutdown,

// Enables push notification of hints.
BASE_FEATURE(kPushNotifications,
Expand All @@ -379,7 +404,7 @@ diff --git a/components/optimization_guide/core/optimization_guide_features.cc b

// This feature flag does not turn off any behavior, it is only used for
// experiment parameters.
@@ -182,9 +171,9 @@ BASE_FEATURE(kOptimizationGuideMetadataValidation,
@@ -182,21 +164,21 @@ BASE_FEATURE(kOptimizationGuideMetadataValidation,
"OptimizationGuideMetadataValidation",
base::FEATURE_DISABLED_BY_DEFAULT);

Expand All @@ -392,7 +417,13 @@ diff --git a/components/optimization_guide/core/optimization_guide_features.cc b

BASE_FEATURE(kTextEmbeddingBatchAnnotations,
"TextEmbeddingBatchAnnotations",
@@ -196,7 +185,7 @@ BASE_FEATURE(kPageContentAnnotationsValidation,
base::FEATURE_DISABLED_BY_DEFAULT);

BASE_FEATURE(kPageContentAnnotationsValidation,
- "PageContentAnnotationsValidation",
- base::FEATURE_DISABLED_BY_DEFAULT);
+ "PageContentAnnotationsValidation", // disabled
+ base::FEATURE_DISABLED_BY_DEFAULT); // by default

BASE_FEATURE(kPreventLongRunningPredictionModels,
"PreventLongRunningPredictionModels",
Expand All @@ -401,7 +432,7 @@ diff --git a/components/optimization_guide/core/optimization_guide_features.cc b

BASE_FEATURE(kOptimizationGuideUseContinueOnShutdownForPageContentAnnotations,
"OptimizationGuideUseContinueOnShutdownForPageContentAnnotations",
@@ -231,8 +220,8 @@ BASE_FEATURE(kPageContentAnnotationsPersistSalientImageMetadata,
@@ -231,8 +213,8 @@ BASE_FEATURE(kPageContentAnnotationsPersistSalientImageMetadata,
// Killswitch for fetching on search results from a remote Optimization Guide
// Service.
BASE_FEATURE(kOptimizationGuideFetchingForSRP,
Expand All @@ -412,7 +443,7 @@ diff --git a/components/optimization_guide/core/optimization_guide_features.cc b

// Enables the model store to save relative paths computed from the base model
// store dir. Storing as relative path in the model store is needed for IOS,
@@ -511,7 +500,7 @@ size_t MaxURLKeyedHintCacheSize() {
@@ -511,7 +493,7 @@ size_t MaxURLKeyedHintCacheSize() {

bool ShouldPersistHintsToDisk() {
return GetFieldTrialParamByFeatureAsBool(kOptimizationHints,
Expand Down

0 comments on commit 3d7a50f

Please sign in to comment.