[eric] revert: drop the five windows ablations now that electron 42 (chromium 146) erases the chromium-144 crashes they were working around

This commit is contained in:
Eric
2026-05-27 20:51:14 -07:00
parent 7ce71cb29c
commit 2ec69427d0
5 changed files with 57 additions and 147 deletions
@@ -443,11 +443,11 @@ const StepCardBody: React.FC<StepCardProps> = ({
: undefined,
}}
>
{step.videoSrc && !(typeof navigator !== 'undefined' && navigator.userAgent.includes('Windows')) ? (
{step.videoSrc ? (
<Box
component="video"
src={step.videoSrc}
autoPlay
autoPlay={typeof navigator === 'undefined' || !navigator.userAgent.includes('Windows')}
muted
loop
playsInline
@@ -321,62 +321,32 @@ const RichPromptEditor: React.FC<RichPromptEditorProps> = ({
)}
<Box sx={{ px: 1.75, pt: label ? 2 : 1.25, pb: 1.25, position: 'relative' }}>
{(typeof navigator !== 'undefined' && navigator.userAgent.includes('Windows') && navigator.userAgent.includes('Electron')) ? (
// Windows-Electron: <div contentEditable> hits the Chromium 144 TSF native crash; fall back to a plain textarea (loses inline pills but stays alive).
<textarea
ref={editorRef as unknown as React.RefObject<HTMLTextAreaElement>}
onInput={handleInput as unknown as React.FormEventHandler<HTMLTextAreaElement>}
onClick={handleEditorClick as unknown as React.MouseEventHandler<HTMLTextAreaElement>}
onKeyDown={handleKeyDown as unknown as React.KeyboardEventHandler<HTMLTextAreaElement>}
onPaste={handlePaste as unknown as React.ClipboardEventHandler<HTMLTextAreaElement>}
onFocus={() => setFocused(true)}
onBlur={() => setFocused(false)}
spellCheck={false}
style={{
width: '100%',
minHeight: `${minHeight}rem`,
maxHeight: `${maxHeight}rem`,
overflowY: 'auto',
background: 'transparent',
border: 'none',
outline: 'none',
resize: 'none',
color: c.text.primary,
fontSize: `${FONT_SIZE}rem`,
lineHeight: `${LINE_HEIGHT}`,
fontFamily: 'inherit',
wordBreak: 'break-word',
whiteSpace: 'pre-wrap',
}}
/>
) : (
<div
ref={editorRef}
contentEditable
suppressContentEditableWarning
onInput={handleInput}
onClick={handleEditorClick}
onKeyDown={handleKeyDown}
onPaste={handlePaste}
onFocus={() => setFocused(true)}
onBlur={() => setFocused(false)}
style={{
width: '100%',
minHeight: `${minHeight}rem`,
maxHeight: `${maxHeight}rem`,
overflowY: 'auto',
background: 'transparent',
border: 'none',
outline: 'none',
color: c.text.primary,
fontSize: `${FONT_SIZE}rem`,
lineHeight: `${LINE_HEIGHT}`,
fontFamily: 'inherit',
wordBreak: 'break-word',
whiteSpace: 'pre-wrap',
}}
/>
)}
<div
ref={editorRef}
contentEditable
suppressContentEditableWarning
onInput={handleInput}
onClick={handleEditorClick}
onKeyDown={handleKeyDown}
onPaste={handlePaste}
onFocus={() => setFocused(true)}
onBlur={() => setFocused(false)}
style={{
width: '100%',
minHeight: `${minHeight}rem`,
maxHeight: `${maxHeight}rem`,
overflowY: 'auto',
background: 'transparent',
border: 'none',
outline: 'none',
color: c.text.primary,
fontSize: `${FONT_SIZE}rem`,
lineHeight: `${LINE_HEIGHT}`,
fontFamily: 'inherit',
wordBreak: 'break-word',
whiteSpace: 'pre-wrap',
}}
/>
{!hasContent && (
<div
style={{
@@ -18,9 +18,6 @@ interface Props {
onPaste: (e: React.ClipboardEvent) => void;
}
// Windows-Electron: <div contentEditable> mounts hit a Chromium 144 TSF native crash on commit; the textarea ablation the handlers/draft already route for has to land here too or the renderer segfaults.
const IS_WIN_ELECTRON = typeof navigator !== 'undefined' && navigator.userAgent.includes('Windows') && navigator.userAgent.includes('Electron');
export const EditorSurface: React.FC<Props> = ({
c, editorRef, disabled, hasContent, hasAttachments, autoRunMode, isRunning, queueLength,
placeholderLabel, onInput, onClick, onKeyDown, onPaste,
@@ -35,62 +32,32 @@ export const EditorSurface: React.FC<Props> = ({
return (
<Box sx={{ px: 1.5, pt: hasAttachments ? 0.5 : 1.25, pb: 0.25, position: 'relative' }}>
{IS_WIN_ELECTRON ? (
<textarea
ref={editorRef as unknown as RefObject<HTMLTextAreaElement>}
data-onboarding="chat-input"
disabled={disabled}
spellCheck={false}
onInput={onInput}
onClick={onClick}
onKeyDown={onKeyDown as unknown as React.KeyboardEventHandler<HTMLTextAreaElement>}
onPaste={onPaste as unknown as React.ClipboardEventHandler<HTMLTextAreaElement>}
rows={1}
style={{
width: '100%',
minHeight: '1.5em',
maxHeight: 220,
overflowY: 'auto',
background: 'transparent',
border: 'none',
outline: 'none',
color: c.text.primary,
fontSize: '0.95rem',
lineHeight: '1.55',
fontFamily: 'inherit',
wordBreak: 'break-word',
whiteSpace: 'pre-wrap',
resize: 'none',
}}
/>
) : (
<div
ref={editorRef}
data-onboarding="chat-input"
contentEditable={!disabled}
suppressContentEditableWarning
spellCheck={false}
onInput={onInput}
onClick={onClick}
onKeyDown={onKeyDown}
onPaste={onPaste}
style={{
width: '100%',
minHeight: '1.5em',
maxHeight: 220,
overflowY: 'auto',
background: 'transparent',
border: 'none',
outline: 'none',
color: c.text.primary,
fontSize: '0.95rem',
lineHeight: '1.55',
fontFamily: 'inherit',
wordBreak: 'break-word',
whiteSpace: 'pre-wrap',
}}
/>
)}
<div
ref={editorRef}
data-onboarding="chat-input"
contentEditable={!disabled}
suppressContentEditableWarning
spellCheck={false}
onInput={onInput}
onClick={onClick}
onKeyDown={onKeyDown}
onPaste={onPaste}
style={{
width: '100%',
minHeight: '1.5em',
maxHeight: 220,
overflowY: 'auto',
background: 'transparent',
border: 'none',
outline: 'none',
color: c.text.primary,
fontSize: '0.95rem',
lineHeight: '1.55',
fontFamily: 'inherit',
wordBreak: 'break-word',
whiteSpace: 'pre-wrap',
}}
/>
{!hasContent && (
<div
style={{
+1 -28
View File
@@ -26,9 +26,6 @@ const langExtension = (lang: Language) => {
}
};
// Windows-Electron: CodeMirror's EditorView mounts a contenteditable surface internally; same Chromium 144 TSF crash as EditorSurface. Skip CodeMirror entirely on Windows and render a plain <textarea> (no syntax highlighting, but no segfault).
const IS_WIN_ELECTRON = typeof navigator !== 'undefined' && navigator.userAgent.includes('Windows') && navigator.userAgent.includes('Electron');
const CodeEditor: React.FC<Props> = ({ value, onChange, language, placeholder }) => {
const containerRef = useRef<HTMLDivElement>(null);
const viewRef = useRef<EditorView | null>(null);
@@ -59,7 +56,7 @@ const CodeEditor: React.FC<Props> = ({ value, onChange, language, placeholder })
}, [language, mode, placeholder]);
useEffect(() => {
if (IS_WIN_ELECTRON || !containerRef.current) return;
if (!containerRef.current) return;
const state = EditorState.create({ doc: value, extensions });
const view = new EditorView({ state, parent: containerRef.current });
@@ -73,7 +70,6 @@ const CodeEditor: React.FC<Props> = ({ value, onChange, language, placeholder })
}, [extensions]);
useEffect(() => {
if (IS_WIN_ELECTRON) return;
const view = viewRef.current;
if (!view) return;
const current = view.state.doc.toString();
@@ -84,29 +80,6 @@ const CodeEditor: React.FC<Props> = ({ value, onChange, language, placeholder })
}
}, [value]);
if (IS_WIN_ELECTRON) {
return (
<textarea
value={value}
onChange={(e) => onChange(e.target.value)}
placeholder={placeholder}
spellCheck={false}
style={{
width: '100%',
height: '100%',
background: 'transparent',
border: 'none',
outline: 'none',
resize: 'none',
padding: '8px',
fontFamily: 'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',
fontSize: '13px',
color: mode === 'dark' ? '#fff' : '#000',
}}
/>
);
}
return <div ref={containerRef} style={{ height: '100%', width: '100%', overflow: 'hidden' }} />;
};
+2 -2
View File
@@ -7,8 +7,8 @@ import { useIframeElementSelector } from './useIframeElementSelector';
import { getAuthToken, ensureAuthToken } from '@/shared/config';
import { useClaudeTokens } from '@/shared/styles/ThemeContext';
// In Electron use <webview> to escape iframe restrictions (popups, mic/camera, WebAuthn, cookied fetch); outside Electron fall back to iframe. Windows-Electron also falls back: the <webview> tag mount segfaults the renderer on Chromium 144 + Electron 40 CastLabs (same crash as BrowserCard.tsx:77).
const isElectron = navigator.userAgent.includes('Electron') && !navigator.userAgent.includes('Windows');
// In Electron use <webview> to escape iframe restrictions (popups, mic/camera, WebAuthn, cookied fetch); outside Electron fall back to iframe.
const isElectron = navigator.userAgent.includes('Electron');
// Card previews render small; downscale + JPEG so thumbnails don't bloat the output JSON or every list fetch.
const THUMB_WIDTH = 600;