From: uazo <uazo@users.noreply.github.com>
Date: Sat, 29 Jan 2022 15:25:19 +0000
Subject: Enable StrictOriginIsolation and SitePerProcess

Enable the StrictOriginIsolation feature and the SitePerProcess preference.
SitePerProcess: bypass any device memory size check.
SitePerProcess: always consider enterprise policies applicable.

Original License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
---
 chrome/browser/about_flags.cc                      | 3 ---
 chrome/browser/chrome_content_browser_client.cc    | 4 ++--
 components/site_isolation/site_isolation_policy.cc | 2 ++
 content/public/common/content_features.cc          | 4 ++--
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -4560,9 +4560,6 @@ const FeatureEntry kFeatureEntries[] = {
      flag_descriptions::kSiteIsolationForPasswordSitesDescription, kOsAndroid,
      FEATURE_VALUE_TYPE(
          site_isolation::features::kSiteIsolationForPasswordSites)},
-    {"enable-site-per-process", flag_descriptions::kStrictSiteIsolationName,
-     flag_descriptions::kStrictSiteIsolationDescription, kOsAndroid,
-     SINGLE_VALUE_TYPE(switches::kSitePerProcess)},
 #endif
     {"enable-isolated-web-apps", flag_descriptions::kEnableIsolatedWebAppsName,
      flag_descriptions::kEnableIsolatedWebAppsDescription, kOsAll,
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
@@ -1425,7 +1425,7 @@ void ChromeContentBrowserClient::RegisterLocalStatePrefs(
   registry->RegisterFilePathPref(prefs::kDiskCacheDir, base::FilePath());
   registry->RegisterIntegerPref(prefs::kDiskCacheSize, 0);
   registry->RegisterStringPref(prefs::kIsolateOrigins, std::string());
-  registry->RegisterBooleanPref(prefs::kSitePerProcess, false);
+  registry->RegisterBooleanPref(prefs::kSitePerProcess, true);
   registry->RegisterBooleanPref(prefs::kTabFreezingEnabled, true);
   registry->RegisterIntegerPref(prefs::kSCTAuditingHashdanceReportCount, 0);
 }
@@ -1439,7 +1439,7 @@ void ChromeContentBrowserClient::RegisterProfilePrefs(
   // user policy in addition to the same named ones in Local State (which are
   // used for mapping the command-line flags).
   registry->RegisterStringPref(prefs::kIsolateOrigins, std::string());
-  registry->RegisterBooleanPref(prefs::kSitePerProcess, false);
+  registry->RegisterBooleanPref(prefs::kSitePerProcess, true);
   registry->RegisterListPref(
       site_isolation::prefs::kUserTriggeredIsolatedOrigins);
   registry->RegisterDictionaryPref(
diff --git a/components/site_isolation/site_isolation_policy.cc b/components/site_isolation/site_isolation_policy.cc
--- a/components/site_isolation/site_isolation_policy.cc
+++ b/components/site_isolation/site_isolation_policy.cc
@@ -169,6 +169,7 @@ bool SiteIsolationPolicy::IsIsolationForOAuthSitesEnabled() {
 
 // static
 bool SiteIsolationPolicy::IsEnterprisePolicyApplicable() {
+  if ((true)) return true;
 #if BUILDFLAG(IS_ANDROID)
   // https://crbug.com/844118: Limiting policy to devices with > 1GB RAM.
   // Using 1077 rather than 1024 because 1) it helps ensure that devices with
@@ -184,6 +185,7 @@ bool SiteIsolationPolicy::IsEnterprisePolicyApplicable() {
 // static
 bool SiteIsolationPolicy::ShouldDisableSiteIsolationDueToMemoryThreshold(
     content::SiteIsolationMode site_isolation_mode) {
+  if ((true)) return false;
   static const bool cache_memory_threshold_decision =
       ShouldCacheMemoryThresholdDecision();
   if (!g_disallow_memory_threshold_caching && cache_memory_threshold_decision) {
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc
--- a/content/public/common/content_features.cc
+++ b/content/public/common/content_features.cc
@@ -1112,8 +1112,8 @@ BASE_FEATURE(kStopVideoCaptureOnScreenLock,
 // Controls whether site isolation should use origins instead of scheme and
 // eTLD+1.
 BASE_FEATURE(kStrictOriginIsolation,
-             "StrictOriginIsolation",
-             base::FEATURE_DISABLED_BY_DEFAULT);
+             "StrictOriginIsolation",              // must be enabled
+             base::FEATURE_ENABLED_BY_DEFAULT);    // in Bromite
 
 // Disallows window.{alert, prompt, confirm} if triggered inside a subframe that
 // is not same origin with the main frame.
--
2.25.1
