From 9a60e2c532cd1341c2d1dd585c7dcfdc761f2b06 Mon Sep 17 00:00:00 2001 From: ownedbywuigi Date: Mon, 30 Mar 2026 11:43:16 +0100 Subject: [PATCH] Update process count preference to a fixed value and enhance content parent selection logic --- application/basilisk/app/profile/basilisk.js | 6 ++---- dom/ipc/ContentParent.cpp | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/application/basilisk/app/profile/basilisk.js b/application/basilisk/app/profile/basilisk.js index 1d8b0c6c26..739aa43038 100644 --- a/application/basilisk/app/profile/basilisk.js +++ b/application/basilisk/app/profile/basilisk.js @@ -923,10 +923,8 @@ pref("browser.tabs.remote.force-disable", false); pref("browser.tabs.remote.desktopbehavior", true); pref("browser.tabs.remote.ignoreBlockPolicy", true); // Number of web content processes used by e10s. -// -1 means automatic tab-isolation mode: try one process per tab. -pref("dom.ipc.processCount", -1); -// Safety ceiling used by automatic tab-isolation mode. -pref("dom.ipc.processCount.webIsolatedMax", 64); +// Keep this at a fixed value in this tree; automatic -1 mode is not supported. +pref("dom.ipc.processCount", 4); // This pref governs whether we attempt to work around problems caused by // plugins using OS calls to manipulate the cursor while running out-of- diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 6dab0bbc82..2d02593dd2 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -602,14 +602,27 @@ ContentParent::GetNewOrUsedBrowserProcess(bool aForBrowserElement, static_cast(maxContentParents)); uint32_t startIdx = rand() % maxSelectable; uint32_t currIdx = startIdx; + RefPtr fallback; do { RefPtr p = (*contentParents)[currIdx]; - NS_ASSERTION(p->IsAlive(), "Non-alive contentparent in sBrowserContntParents?"); + if (!p->IsAlive()) { + currIdx = (currIdx + 1) % maxSelectable; + continue; + } + + if (!fallback) { + fallback = p; + } + if (p->mOpener == aOpener) { return p.forget(); } currIdx = (currIdx + 1) % maxSelectable; } while (currIdx != startIdx); + + if (fallback) { + return fallback.forget(); + } } RefPtr p = new ContentParent(aOpener, aForBrowserElement);