From f574696eb2072f67496e7ecc111496dcef381315 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Tue, 2 Jun 2026 03:56:07 -0700 Subject: [PATCH] [eric] browser: one-shot crash-safe trial switch for webview on Windows electron 42 --- .../app/pages/Dashboard/cards/BrowserCard.tsx | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/pages/Dashboard/cards/BrowserCard.tsx b/frontend/src/app/pages/Dashboard/cards/BrowserCard.tsx index a2d68b54..2f772130 100644 --- a/frontend/src/app/pages/Dashboard/cards/BrowserCard.tsx +++ b/frontend/src/app/pages/Dashboard/cards/BrowserCard.tsx @@ -73,8 +73,29 @@ const HANDLE_DEFS: { dir: ResizeDir; sx: Record }[] = [ { dir: 'se', sx: { bottom: -EDGE_THICKNESS / 2, right: -EDGE_THICKNESS / 2, width: CORNER_SIZE, height: CORNER_SIZE } }, ]; -// On Windows, force iframe fallback path: the tag mount segfaults the renderer during commit on Chromium 144 + this Electron 40 CastLabs build. iframe renders blank for sites with X-Frame-Options but does not crash. Mac keeps webview (full browser). -const isElectron = navigator.userAgent.includes('Electron') && !navigator.userAgent.includes('Windows'); +// Windows forces the iframe fallback: the tag mount segfaults the +// renderer during Chromium's commit phase on the CastLabs build (added 1.1.55, +// same commit-phase crash family as the ablated and the +// Onboarding Framer-Motion subtrees). The Electron 42 bump brought its own +// Windows native crash (the en-US.pak locale fix) and never re-verified this +// one, so the guard stays until a real Windows run proves the webview survives. +// +// One-shot trial switch to do exactly that test (can't be tested on Mac): in +// DevTools run localStorage.setItem('openswarm_try_win_webview','1') then +// reload. The flag is CONSUMED on read, so if the webview still segfaults on +// commit the crash-reload lands back on the safe iframe path instead of +// boot-looping. Mac is unaffected (always gets the full webview + CDP agent). +function windowsWebviewTrialArmed(): boolean { + try { + if (localStorage.getItem('openswarm_try_win_webview') === '1') { + localStorage.removeItem('openswarm_try_win_webview'); + return true; + } + } catch {} + return false; +} +const isWindows = navigator.userAgent.includes('Windows'); +const isElectron = navigator.userAgent.includes('Electron') && (!isWindows || windowsWebviewTrialArmed()); const chromeUserAgent = navigator.userAgent .replace(/\s*Electron\/\S+/, '')