[6.x] Fix browser crash when expanding a Bard set after a copy#14967
[6.x] Fix browser crash when expanding a Bard set after a copy#14967jasonvarga wants to merge 1 commit into
Conversation
Guards against a Chrome/Edge >= 148 renderer crash (CFI abort) that kills the tab when a ProseMirror editor is laid out in the same trusted-click turn that reveals it while a clipboard copy is pending. See #14946. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Hm, that's weird. I was able to reproduce the bug on macOS in Chrome & Chromium. But I can test the PR if this fixes the issue :) |
|
We're testing this too - will report feedback in next 24 hrs As a note - some people have reported the same exact error and said they didn't copy anything. So we'll see what happens. |
|
So gave this another test against my repro (Chrome 149 on macOS with my blueprint in the original issue) and unfortunately it still crashes the tab. The trigger is the container reveal and the CSS animation happening inside the same click (with Bard just mounted in there). If you disable the animations for instance, the tab is not crashing.. |
|
Still getting reports of crashes in Chrome after applying this patch |
Fixes #14946
The bug
Copying some text and then expanding a collapsed Replicator/Bard set that contains a Bard field crashes the whole browser tab on Chrome/Edge ≥ 148 (Edge shows Error code 5, Chrome "Aw, Snap!"), losing unsaved edits. It's an upstream Chromium renderer crash — a CFI (Control Flow Integrity) abort triggered by laying out a ProseMirror editor in the same trusted-click turn that reveals it while a clipboard copy is pending. There's nothing to fix on our side, only avoid.
The approach
Collapsed sets keep their fields mounted (
v-show), so the Bard editor already exists while hidden — the trigger is the reveal (goingdisplay:none→ visible), which forces ProseMirror to lay out during the click. Deferring that layout by one frame moves it off the trusted-click turn and the crash can't happen.Rather than deferring the reveal at every surface that can expose a Bard editor (Replicator sets, nested Bard sets, Group fields, the Revealer, tabs, sections, freshly-added sets…), this puts a single guard inside Bard itself. A
ResizeObserverwatches the field; when it becomes visible, the editor's content is shown one frame later. This covers every reveal path — current and future — in one place.Thanks to @o1y for #14951, which diagnosed the trigger and prototyped the per-surface deferral this builds on.
Testing