Created
March 2, 2025 02:32
-
-
Save luke-jr/4d55ad3af657748cbe6a5535b8be8ba7 to your computer and use it in GitHub Desktop.
Chromium patch to add a setting for JAVASCRIPT_JIT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd | |
index 62900c285f..d2609cbd12 100644 | |
--- a/chrome/app/chromium_strings.grd | |
+++ b/chrome/app/chromium_strings.grd | |
@@ -2290,6 +2290,12 @@ Permissions you've already given to websites and apps may apply to this account. | |
<message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_OPTIMIZER_ALLOWED_SUB_LABEL" desc="Sub-label for the enabled option of the JavaScript optimizer content setting."> | |
Chromium runs faster and features that use JavaScript should work as designed (recommended) | |
</message> | |
+ <message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_DESCRIPTION" desc="Description of the JavaScript JIT content setting."> | |
+ V8 is Chromium’s JavaScript and WebAssembly engine used to improve site performance | |
+ </message> | |
+ <message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_ALLOWED_SUB_LABEL" desc="Sub-label for the enabled option of the JavaScript JIT content setting."> | |
+ Chromium runs faster and features that use JavaScript should work as designed (recommended) | |
+ </message> | |
<!-- ChromiumUpdater Strings --> | |
<if expr="is_win"> | |
diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd | |
index 4813d2973b..8ad7f788a4 100644 | |
--- a/chrome/app/google_chrome_strings.grd | |
+++ b/chrome/app/google_chrome_strings.grd | |
@@ -2469,6 +2469,12 @@ Permissions you've already given to websites and apps may apply to this account. | |
<message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_OPTIMIZER_ALLOWED_SUB_LABEL" desc="Sub-label for the enabled option of the JavaScript optimizer content setting."> | |
Chrome runs faster and features that use JavaScript should work as designed (recommended) | |
</message> | |
+ <message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_DESCRIPTION" desc="Description of the JavaScript JIT content setting."> | |
+ V8 is Chrome’s JavaScript and WebAssembly engine used to improve site performance | |
+ </message> | |
+ <message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_ALLOWED_SUB_LABEL" desc="Sub-label for the enabled option of the JavaScript JIT content setting."> | |
+ Chrome runs faster and features that use JavaScript should work as designed (recommended) | |
+ </message> | |
<!-- GoogleUpdater Strings --> | |
<if expr="is_win"> | |
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp | |
index fe3dd9cf87..e8fc63e726 100644 | |
--- a/chrome/app/settings_strings.grdp | |
+++ b/chrome/app/settings_strings.grdp | |
@@ -2900,6 +2900,21 @@ | |
<message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_OPTIMIZER_BLOCKED_EXCEPTIONS" desc="Label for the blocked exceptions site list of the JavaScript optimizer content setting."> | |
Not allowed to use V8 optimizer | |
</message> | |
+ <message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_ALLOWED" desc="Label for the enabled option of the JavaScript JIT content setting."> | |
+ Sites can use the V8 JIT | |
+ </message> | |
+ <message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_BLOCKED" desc="Label for the disabled option of the JavaScript JIT content setting."> | |
+ Don’t allow sites to use the V8 JIT | |
+ </message> | |
+ <message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_BLOCKED_SUB_LABEL" desc="Sub-label for the disabled option of the JavaScript JIT content setting."> | |
+ Reduces performance but makes V8 more resistant to attacks | |
+ </message> | |
+ <message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_ALLOWED_EXCEPTIONS" desc="Label for the allowed exceptions site list of the JavaScript JIT content setting."> | |
+ Always allowed to use the V8 JIT | |
+ </message> | |
+ <message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_BLOCKED_EXCEPTIONS" desc="Label for the blocked exceptions site list of the JavaScript JIT content setting."> | |
+ Not allowed to use V8 JIT | |
+ </message> | |
<message name="IDS_SETTINGS_SITE_SETTINGS_KEYBOARD_LOCK_DESCRIPTION" desc="Description of the keyboard lock content setting."> | |
Sites use this feature to capture and use the input of your keyboard, like for games or remote desktop apps | |
</message> | |
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.html b/chrome/browser/resources/settings/privacy_page/privacy_page.html | |
index 7d47622af8..4a84adb229 100644 | |
--- a/chrome/browser/resources/settings/privacy_page/privacy_page.html | |
+++ b/chrome/browser/resources/settings/privacy_page/privacy_page.html | |
@@ -110,6 +110,33 @@ | |
</template> | |
</if> | |
+ <template is="dom-if" route-path="/content/v8jit" no-search> | |
+ <settings-subpage | |
+ page-title="$i18n{siteSettingsCategoryJavascriptJit}" | |
+ search-label="$i18n{siteSettingsAllSitesSearch}" | |
+ search-term="{{searchFilter_}}"> | |
+ <div class="content-settings-header secondary"> | |
+ $i18n{siteSettingsJavascriptJitDescription} | |
+ </div> | |
+ <settings-category-default-radio-group | |
+ category="[[contentSettingsTypesEnum_.JAVASCRIPT_JIT]]" | |
+ allow-option-label= | |
+ "$i18n{siteSettingsJavascriptJitAllowed}" | |
+ allow-option-sub-label= | |
+ "$i18n{siteSettingsJavascriptJitAllowedSubLabel}" | |
+ block-option-label="$i18n{siteSettingsJavascriptJitBlocked}" | |
+ block-option-sub-label= | |
+ "$i18n{siteSettingsJavascriptJitBlockedSubLabel}"> | |
+ </settings-category-default-radio-group> | |
+ <category-setting-exceptions | |
+ category="[[contentSettingsTypesEnum_.JAVASCRIPT_JIT]]" | |
+ allow-header="$i18n{siteSettingsJavascriptJitAllowedExceptions}" | |
+ block-header="$i18n{siteSettingsJavascriptJitBlockedExceptions}" | |
+ search-filter="[[searchFilter_]]"> | |
+ </category-setting-exceptions> | |
+ </settings-subpage> | |
+ </template> | |
+ | |
<template is="dom-if" route-path="/content/v8" no-search> | |
<settings-subpage | |
page-title="$i18n{siteSettingsCategoryJavascriptOptimizer}" | |
diff --git a/chrome/browser/resources/settings/privacy_page/security_page.ts b/chrome/browser/resources/settings/privacy_page/security_page.ts | |
index 552f3b5534..e5678861c2 100644 | |
--- a/chrome/browser/resources/settings/privacy_page/security_page.ts | |
+++ b/chrome/browser/resources/settings/privacy_page/security_page.ts | |
@@ -307,6 +307,16 @@ export class SettingsSecurityPageElement extends | |
}); | |
} | |
+ if (routes.SITE_SETTINGS_JAVASCRIPT_JIT) { | |
+ this.focusConfig.set( | |
+ routes.SITE_SETTINGS_JAVASCRIPT_JIT.path, () => { | |
+ const toFocus = | |
+ this.shadowRoot!.querySelector<HTMLElement>('#v8jit-setting-link'); | |
+ assert(toFocus); | |
+ focusWithoutInk(toFocus); | |
+ }); | |
+ } | |
+ | |
if (routes.SITE_SETTINGS_JAVASCRIPT_OPTIMIZER) { | |
this.focusConfig.set( | |
routes.SITE_SETTINGS_JAVASCRIPT_OPTIMIZER.path, () => { | |
diff --git a/chrome/browser/resources/settings/route.ts b/chrome/browser/resources/settings/route.ts | |
index 12390b9590..6b581f412e 100644 | |
--- a/chrome/browser/resources/settings/route.ts | |
+++ b/chrome/browser/resources/settings/route.ts | |
@@ -110,6 +110,7 @@ function addPrivacyChildRoutes(r: Partial<SettingsRoutes>) { | |
r.SITE_SETTINGS_IMAGES = r.SITE_SETTINGS.createChild('images'); | |
r.SITE_SETTINGS_MIXEDSCRIPT = r.SITE_SETTINGS.createChild('insecureContent'); | |
r.SITE_SETTINGS_JAVASCRIPT = r.SITE_SETTINGS.createChild('javascript'); | |
+ r.SITE_SETTINGS_JAVASCRIPT_JIT = r.SITE_SETTINGS.createChild('v8jit'); | |
r.SITE_SETTINGS_JAVASCRIPT_OPTIMIZER = r.SITE_SETTINGS.createChild('v8'); | |
if (loadTimeData.getBoolean('enableKeyboardAndPointerLockPrompt')) { | |
r.SITE_SETTINGS_KEYBOARD_LOCK = r.SITE_SETTINGS.createChild('keyboardLock'); | |
diff --git a/chrome/browser/resources/settings/router.ts b/chrome/browser/resources/settings/router.ts | |
index afe6eb3c61..4bbf50c31b 100644 | |
--- a/chrome/browser/resources/settings/router.ts | |
+++ b/chrome/browser/resources/settings/router.ts | |
@@ -85,6 +85,7 @@ export interface SettingsRoutes { | |
SITE_SETTINGS_LOCAL_FONTS: Route; | |
SITE_SETTINGS_MIXEDSCRIPT: Route; | |
SITE_SETTINGS_JAVASCRIPT: Route; | |
+ SITE_SETTINGS_JAVASCRIPT_JIT: Route; | |
SITE_SETTINGS_JAVASCRIPT_OPTIMIZER: Route; | |
SITE_SETTINGS_SENSORS: Route; | |
SITE_SETTINGS_SOUND: Route; | |
diff --git a/chrome/browser/resources/settings/site_settings/constants.ts b/chrome/browser/resources/settings/site_settings/constants.ts | |
index 4ed920a8aa..6ac3619144 100644 | |
--- a/chrome/browser/resources/settings/site_settings/constants.ts | |
+++ b/chrome/browser/resources/settings/site_settings/constants.ts | |
@@ -34,6 +34,7 @@ export enum ContentSettingsTypes { | |
IDLE_DETECTION = 'idle-detection', | |
IMAGES = 'images', | |
JAVASCRIPT = 'javascript', | |
+ JAVASCRIPT_JIT = 'javascript-jit', | |
JAVASCRIPT_OPTIMIZER = 'javascript-optimizer', | |
KEYBOARD_LOCK = 'keyboard-lock', | |
LOCAL_FONTS = 'local-fonts', | |
diff --git a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts | |
index f41407671c..d42337f98c 100644 | |
--- a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts | |
+++ b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts | |
@@ -132,6 +132,7 @@ export class SettingsCategoryDefaultRadioGroupElement extends | |
case ContentSettingsTypes.FEDERATED_IDENTITY_API: | |
case ContentSettingsTypes.IMAGES: | |
case ContentSettingsTypes.JAVASCRIPT: | |
+ case ContentSettingsTypes.JAVASCRIPT_JIT: | |
case ContentSettingsTypes.JAVASCRIPT_OPTIMIZER: | |
case ContentSettingsTypes.MIXEDSCRIPT: | |
case ContentSettingsTypes.PAYMENT_HANDLER: | |
diff --git a/chrome/browser/resources/settings/site_settings/site_details.html b/chrome/browser/resources/settings/site_settings/site_details.html | |
index ada08944de..21cb982b99 100644 | |
--- a/chrome/browser/resources/settings/site_settings/site_details.html | |
+++ b/chrome/browser/resources/settings/site_settings/site_details.html | |
@@ -246,6 +246,11 @@ | |
icon="privacy:warning" | |
label="$i18n{siteSettingsInsecureContent}"> | |
</site-details-permission> | |
+ <site-details-permission | |
+ category="[[contentSettingsTypesEnum_.JAVASCRIPT_JIT]]" | |
+ icon="privacy:v8jit" | |
+ label="$i18n{siteSettingsJavascriptJit}"> | |
+ </site-details-permission> | |
<site-details-permission | |
category="[[contentSettingsTypesEnum_.JAVASCRIPT_OPTIMIZER]]" | |
icon="privacy:v8" | |
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts | |
index dfb10f1a48..31ce31ca1d 100644 | |
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts | |
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts | |
@@ -223,6 +223,14 @@ function getCategoryItemMap(): Map<ContentSettingsTypes, CategoryListItem> { | |
enabledLabel: 'siteSettingsJavascriptAllowed', | |
disabledLabel: 'siteSettingsJavascriptBlocked', | |
}, | |
+ { | |
+ route: routes.SITE_SETTINGS_JAVASCRIPT_JIT, | |
+ id: Id.JAVASCRIPT_JIT, | |
+ label: 'siteSettingsJavascriptJit', | |
+ icon: 'privacy:v8', | |
+ enabledLabel: 'siteSettingsJavascriptJitAllowed', | |
+ disabledLabel: 'siteSettingsJavascriptJitBlocked', | |
+ }, | |
{ | |
route: routes.SITE_SETTINGS_JAVASCRIPT_OPTIMIZER, | |
id: Id.JAVASCRIPT_OPTIMIZER, | |
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts b/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts | |
index 0c615bb7e5..754fd07a0d 100644 | |
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts | |
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts | |
@@ -99,6 +99,7 @@ export function getLocalizationStringForContentType( | |
return 'siteSettingsZoomLevelsMidSentence'; | |
// The following members do not have a mid-sentence localization. | |
case ContentSettingsTypes.ANTI_ABUSE: | |
+ case ContentSettingsTypes.JAVASCRIPT_JIT: | |
case ContentSettingsTypes.PDF_DOCUMENTS: | |
case ContentSettingsTypes.PERFORMANCE: | |
case ContentSettingsTypes.PRIVATE_NETWORK_DEVICES: | |
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc | |
index c3faec081e..93ab3d38f8 100644 | |
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc | |
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc | |
@@ -2576,6 +2576,8 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source, | |
{"siteSettingsCategoryJavascript", IDS_SITE_SETTINGS_TYPE_JAVASCRIPT}, | |
{"siteSettingsCategoryJavascriptOptimizer", | |
IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_OPTIMIZER}, | |
+ {"siteSettingsCategoryJavascriptJit", | |
+ IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_JIT}, | |
{"siteSettingsCategoryMicrophone", IDS_SITE_SETTINGS_TYPE_MIC}, | |
{"siteSettingsMicrophoneLabel", IDS_SITE_SETTINGS_TYPE_MIC}, | |
{"siteSettingsCategoryNotifications", | |
@@ -2667,6 +2669,11 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source, | |
{"siteSettingsJavascriptOptimizerMidsentence", | |
IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_OPTIMIZER}, // Deliberately the same | |
// form. | |
+ {"siteSettingsJavascriptJit", | |
+ IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_JIT}, | |
+ {"siteSettingsJavascriptJitMidsentence", | |
+ IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_JIT}, // Deliberately the same | |
+ // form. | |
{"siteSettingsSound", IDS_SITE_SETTINGS_TYPE_SOUND}, | |
{"siteSettingsSoundMidSentence", | |
IDS_SITE_SETTINGS_TYPE_SOUND_MID_SENTENCE}, | |
@@ -3095,6 +3102,20 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source, | |
IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_OPTIMIZER_ALLOWED_EXCEPTIONS}, | |
{"siteSettingsJavascriptOptimizerBlockedExceptions", | |
IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_OPTIMIZER_BLOCKED_EXCEPTIONS}, | |
+ {"siteSettingsJavascriptJitDescription", | |
+ IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_DESCRIPTION}, | |
+ {"siteSettingsJavascriptJitAllowed", | |
+ IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_ALLOWED}, | |
+ {"siteSettingsJavascriptJitAllowedSubLabel", | |
+ IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_ALLOWED_SUB_LABEL}, | |
+ {"siteSettingsJavascriptJitBlocked", | |
+ IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_BLOCKED}, | |
+ {"siteSettingsJavascriptJitBlockedSubLabel", | |
+ IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_BLOCKED_SUB_LABEL}, | |
+ {"siteSettingsJavascriptJitAllowedExceptions", | |
+ IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_ALLOWED_EXCEPTIONS}, | |
+ {"siteSettingsJavascriptJitBlockedExceptions", | |
+ IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_BLOCKED_EXCEPTIONS}, | |
{"siteSettingsKeyboardLock", IDS_SITE_SETTINGS_TYPE_KEYBOARD_LOCK}, | |
{"siteSettingsKeyboardLockAllowed", | |
IDS_SETTINGS_SITE_SETTINGS_KEYBOARD_LOCK_ALLOWED}, | |
diff --git a/components/content_settings/core/browser/content_settings_default_provider.cc b/components/content_settings/core/browser/content_settings_default_provider.cc | |
index 88b4ff4c0a..8dbda9014d 100644 | |
--- a/components/content_settings/core/browser/content_settings_default_provider.cc | |
+++ b/components/content_settings/core/browser/content_settings_default_provider.cc | |
@@ -154,7 +154,7 @@ void DefaultProvider::RegisterProfilePrefs( | |
#if !BUILDFLAG(IS_IOS) | |
// TODO(https://crbug.com/367181093): clean this up. | |
- registry->RegisterBooleanPref(kBug364820109AlreadyWorkedAroundPref, false); | |
+ registry->RegisterBooleanPref(kBug364820109AlreadyWorkedAroundPref, true); | |
#endif // !BUILDFLAG(IS_IOS) | |
} | |
diff --git a/components/content_settings/core/browser/content_settings_pref_provider.cc b/components/content_settings/core/browser/content_settings_pref_provider.cc | |
index 58d8b0db8f..7d8bc54eb6 100644 | |
--- a/components/content_settings/core/browser/content_settings_pref_provider.cc | |
+++ b/components/content_settings/core/browser/content_settings_pref_provider.cc | |
@@ -108,7 +108,7 @@ void PrefProvider::RegisterProfilePrefs( | |
kObsoleteFederatedIdentityActiveSesssionExceptionsPref); | |
#if !BUILDFLAG(IS_IOS) | |
// TODO(https://crbug.com/367181093): clean this up. | |
- registry->RegisterBooleanPref(kBug364820109AlreadyWorkedAroundPref, false); | |
+ registry->RegisterBooleanPref(kBug364820109AlreadyWorkedAroundPref, true); | |
#endif // !BUILDFLAG(IS_IOS) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment