commit 195873d7f314e2e03c04be36fda58483cb5919b3
parent c3e0176a09450e8a87c029c0cbdec0fca8f87a26
Author: Nika Layzell <nika@thelayzells.com>
Date: Tue, 16 Dec 2025 04:53:47 +0000
Bug 1927599 - Part 5: Disable JIT on iOS in LockdownMode, r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D229402
Diffstat:
1 file changed, 21 insertions(+), 0 deletions(-)
diff --git a/xpcom/build/XPCOMInit.cpp b/xpcom/build/XPCOMInit.cpp
@@ -110,6 +110,10 @@
#include "mozilla/GeckoTrace.h"
+#ifdef XP_IOS
+# include <CoreFoundation/CoreFoundation.h>
+#endif
+
using base::AtExitManager;
using mozilla::ipc::IOThreadParent;
@@ -221,6 +225,18 @@ class OggReporter final : public nsIMemoryReporter,
NS_IMPL_ISUPPORTS(OggReporter, nsIMemoryReporter)
+#ifdef XP_IOS
+// Check if iOS LockdownMode is enabled, which blocks the JIT everywhere.
+static bool IsLockdownModeEnabled() {
+ CFPropertyListRef prefValue = CFPreferencesCopyValue(
+ CFSTR("LDMGlobalEnabled"), kCFPreferencesAnyApplication,
+ kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+ bool enabled = prefValue == kCFBooleanTrue;
+ if (prefValue) CFRelease(prefValue);
+ return enabled;
+}
+#endif
+
static bool sInitializedJS = false;
static void InitializeJS() {
@@ -235,6 +251,11 @@ static void InitializeJS() {
mozilla::StaticPrefs::javascript_options_main_process_disable_jit()) {
JS::DisableJitBackend();
}
+#ifdef XP_IOS
+ else if (IsLockdownModeEnabled()) {
+ JS::DisableJitBackend();
+ }
+#endif
// Set all JS::Prefs.
SET_JS_PREFS_FROM_BROWSER_PREFS;