From 3986b07493fc023087a73cee218fec2acdd30014 Mon Sep 17 00:00:00 2001 From: Rootkit404 <175176948+RKNF404@users.noreply.github.com> Date: Wed, 27 Nov 2024 13:45:39 -0500 Subject: [PATCH 1/2] feat: add strict popup blocking --- patches/strict-popup-blocking.patch | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 patches/strict-popup-blocking.patch diff --git a/patches/strict-popup-blocking.patch b/patches/strict-popup-blocking.patch new file mode 100644 index 00000000..7c7e13ee --- /dev/null +++ b/patches/strict-popup-blocking.patch @@ -0,0 +1,18 @@ +diff --git a/components/blocked_content/popup_blocker.cc b/components/blocked_content/popup_blocker.cc +index 8b12c7dd441f3..9c13ac10a6f1a 100644 +--- a/components/blocked_content/popup_blocker.cc ++++ b/components/blocked_content/popup_blocker.cc +@@ -81,11 +81,8 @@ PopupBlockType ShouldBlockPopup(content::WebContents* web_contents, + return PopupBlockType::kNotBlocked; + } + +- auto* safe_browsing_blocker = +- SafeBrowsingTriggeredPopupBlocker::FromWebContents(web_contents); +- if (safe_browsing_blocker && +- safe_browsing_blocker->ShouldApplyAbusivePopupBlocker( +- GetSourcePageForPopup(open_url_params, web_contents))) { ++ if (!base::CommandLine::ForCurrentProcess()->HasSwitch( ++ "disable-strict-popup-blocking")) { + return PopupBlockType::kAbusive; + } + return PopupBlockType::kNotBlocked; From c8e41e8a3e172c4bc5e6a3b15d7f408ac924400f Mon Sep 17 00:00:00 2001 From: Root <175176948+RKNF404@users.noreply.github.com> Date: Wed, 27 Nov 2024 18:45:07 -0500 Subject: [PATCH 2/2] feat: add flag to control behavior --- patches/expose-flags.patch | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/patches/expose-flags.patch b/patches/expose-flags.patch index af68d860..04e8a5e7 100644 --- a/patches/expose-flags.patch +++ b/patches/expose-flags.patch @@ -2,7 +2,7 @@ diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 9d0181f447a1a..8e10017c678f9 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc -@@ -4220,6 +4220,36 @@ const FeatureEntry kFeatureEntries[] = { +@@ -4220,6 +4220,40 @@ const FeatureEntry kFeatureEntries[] = { // //tools/flags/generate_unexpire_flags.py. #include "build/chromeos_buildflags.h" #include "chrome/browser/unexpire_flags_gen.inc" @@ -23,6 +23,10 @@ index 9d0181f447a1a..8e10017c678f9 100644 + "Defaults to enabled. This feature is exposed by hardened-chromium.", + kOsAll, + FEATURE_VALUE_TYPE(net::features::kCapReferrerToOriginOnCrossOrigin)}, ++ {"strict-popup-blocking", "Strict Popup Blocking", ++ "Controls the strictness of the popup blocker. This switch is provided " ++ "by hardened-chromium.", kOsAll, ++ SINGLE_DISABLE_VALUE_TYPE("disable-strict-popup-blocking"}, + {"hide-profile-icon", "Hide profile icon in toolbar", + "Hides the profile icon in the toolbar in regular profiles. Defaults " + "to enabled. This feature is provided by hardened-chromium." , kOsAll,