Skip to content

Instantly share code, notes, and snippets.

@luke-jr
Created March 2, 2025 02:33
Show Gist options
  • Save luke-jr/0788d6ade5262a8b74bd18c0bf600022 to your computer and use it in GitHub Desktop.
Save luke-jr/0788d6ade5262a8b74bd18c0bf600022 to your computer and use it in GitHub Desktop.
Chromium patch to add a quick toggle to the page info popup for JAVASCRIPT_JIT
diff --git a/chrome/browser/ui/views/page_info/page_info_view_factory.cc b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
index 8870181e11..38bb8e5508 100644
--- a/chrome/browser/ui/views/page_info/page_info_view_factory.cc
+++ b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
@@ -278,6 +278,7 @@ const ui::ImageModel PageInfoViewFactory::GetPermissionIcon(
: &vector_icons::kPhotoChromeRefreshIcon;
break;
case ContentSettingsType::JAVASCRIPT:
+ case ContentSettingsType::JAVASCRIPT_JIT:
icon = show_blocked_badge ? &vector_icons::kCodeOffChromeRefreshIcon
: &vector_icons::kCodeChromeRefreshIcon;
break;
@@ -436,6 +437,7 @@ const ui::ImageModel PageInfoViewFactory::GetPermissionIcon(
icon = &vector_icons::kPhotoIcon;
break;
case ContentSettingsType::JAVASCRIPT:
+ case ContentSettingsType::JAVASCRIPT_JIT:
icon = &vector_icons::kCodeIcon;
break;
case ContentSettingsType::POPUPS:
diff --git a/components/page_info/page_info.cc b/components/page_info/page_info.cc
index 5f276a1cbf..a2107bd26b 100644
--- a/components/page_info/page_info.cc
+++ b/components/page_info/page_info.cc
@@ -106,6 +106,7 @@ ContentSettingsType kPermissionType[] = {
ContentSettingsType::SENSORS,
ContentSettingsType::NOTIFICATIONS,
ContentSettingsType::JAVASCRIPT,
+ ContentSettingsType::JAVASCRIPT_JIT,
#if !BUILDFLAG(IS_ANDROID)
ContentSettingsType::IMAGES,
#endif
@@ -1274,6 +1275,10 @@ bool PageInfo::ShouldShowPermission(
return false;
}
+ if (info.type == ContentSettingsType::JAVASCRIPT_JIT) {
+ return true;
+ }
+
const bool is_incognito =
web_contents_->GetBrowserContext()->IsOffTheRecord();
#if BUILDFLAG(IS_ANDROID)
diff --git a/components/page_info/page_info_ui.cc b/components/page_info/page_info_ui.cc
index 0da8528411..5a6b6b5559 100644
--- a/components/page_info/page_info_ui.cc
+++ b/components/page_info/page_info_ui.cc
@@ -145,6 +145,8 @@ base::span<const PageInfoUI::PermissionUIInfo> GetContentSettingsUIInfo() {
IDS_SITE_SETTINGS_TYPE_COOKIES_MID_SENTENCE},
{ContentSettingsType::JAVASCRIPT, IDS_SITE_SETTINGS_TYPE_JAVASCRIPT,
IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_MID_SENTENCE},
+ {ContentSettingsType::JAVASCRIPT_JIT, IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_JIT,
+ IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_JIT},
{ContentSettingsType::POPUPS, IDS_SITE_SETTINGS_TYPE_POPUPS_REDIRECTS,
IDS_SITE_SETTINGS_TYPE_POPUPS_REDIRECTS_MID_SENTENCE},
{ContentSettingsType::GEOLOCATION, IDS_SITE_SETTINGS_TYPE_LOCATION,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment