Crash in tile advance (Cannot destructure 'tile' from null) during measure on WebKit, since 6.39.0 #1720

Open
opened 2026-06-26 19:29:12 +02:00 by coldstone · 2 comments

Summary

@codemirror/view crashes during its measure/scroll cycle on WebKit (WKWebView /
Safari engine), throwing repeatedly:

TypeError: Cannot destructure property 'tile' from null or undefined value

The crash originates in the tile iterator's advance method, where
({ tile, index } = parents.pop()) is reached with an empty parents stack
(so parents.pop() is undefined). Each throw aborts the measure pass, which
corrupts the height map — scrollHeight then balloons (observed 4492 → 7682 →
10872, i.e. the document height added to itself each cycle) and the rendered
content "jumps". It is reliably retriggered by scrolling or drag-selecting.

Version bisection

  • Broken: 6.39.0 through 6.43.3 (latest).
  • Works: 6.38.8 and earlier.

Confirmed: 6.38.x dist/index.js contains no advance( / resolveBlock; the
crash appeared with the tile/block-wrapper rendering introduced in 6.39.0.
Pinning @codemirror/view to 6.38.8 fixes it completely with no other change.

Environment

  • WebKit only — Tauri WKWebView on macOS (AppleWebKit/605.1.15).
  • Not reproducible in Chrome/Blink with the identical document + config.
  • Read-only editor (EditorState.readOnly.of(true), EditorView.editable.of(false)).

Stack trace (top frames)

advance
forward
run
updateInner
update
measure
onScrollChanged
onScroll
listenForScroll
DOMObserver
EditorView (constructor)

Extensions in use

lineNumbers, highlightActiveLineGutter, foldGutter, highlightSpecialChars, drawSelection, bracketMatching, highlightActiveLine, highlightSelectionMatches, keymap(defaultKeymap+foldKeymap), syntaxHighlighting, EditorView.lineWrapping (compartment, was OFF when it crashed), a custom mark-decoration ViewPlugin, readOnly, editable=false. Document: a ~200-line Python file.

Notes

I don't yet have a minimal standalone reproduction (it only manifests under
WebKit, and I couldn't isolate which input triggers the empty parents stack),
but the version bisection above is precise and the stack points directly at the
parents.pop() in advance. Happy to test a patch or help narrow down a repro
in Safari.

### Summary `@codemirror/view` crashes during its measure/scroll cycle on **WebKit** (WKWebView / Safari engine), throwing repeatedly: > TypeError: Cannot destructure property 'tile' from null or undefined value The crash originates in the tile iterator's `advance` method, where `({ tile, index } = parents.pop())` is reached with an empty `parents` stack (so `parents.pop()` is `undefined`). Each throw aborts the measure pass, which corrupts the height map — `scrollHeight` then balloons (observed 4492 → 7682 → 10872, i.e. the document height added to itself each cycle) and the rendered content "jumps". It is reliably retriggered by scrolling or drag-selecting. ### Version bisection - **Broken:** 6.39.0 through 6.43.3 (latest). - **Works:** 6.38.8 and earlier. Confirmed: 6.38.x `dist/index.js` contains no `advance(` / `resolveBlock`; the crash appeared with the tile/block-wrapper rendering introduced in 6.39.0. Pinning `@codemirror/view` to 6.38.8 fixes it completely with no other change. ### Environment - WebKit only — Tauri WKWebView on macOS (AppleWebKit/605.1.15). - **Not reproducible in Chrome/Blink** with the identical document + config. - Read-only editor (`EditorState.readOnly.of(true)`, `EditorView.editable.of(false)`). ### Stack trace (top frames) ``` advance forward run updateInner update measure onScrollChanged onScroll listenForScroll DOMObserver EditorView (constructor) ``` ### Extensions in use `lineNumbers, highlightActiveLineGutter, foldGutter, highlightSpecialChars, drawSelection, bracketMatching, highlightActiveLine, highlightSelectionMatches, keymap(defaultKeymap+foldKeymap), syntaxHighlighting, EditorView.lineWrapping (compartment, was OFF when it crashed), a custom mark-decoration ViewPlugin, readOnly, editable=false`. Document: a ~200-line Python file. ### Notes I don't yet have a minimal standalone reproduction (it only manifests under WebKit, and I couldn't isolate which input triggers the empty `parents` stack), but the version bisection above is precise and the stack points directly at the `parents.pop()` in `advance`. Happy to test a patch or help narrow down a repro in Safari.
Owner

I don't yet have a minimal standalone reproduction

It would help a lot if you could take the time to create a reproduction. I wasn't able to get this to happen going from your description.

> I don't yet have a minimal standalone reproduction It would help a lot if you could take the time to create a reproduction. I wasn't able to get this to happen going from your description.
Owner

This might be the same as this report. Could you see if @codemirror/view 6.43.4 makes the issue go away?

This might be the same as [this report](https://discuss.codemirror.net/t/exception-when-editing-a-fenced-code-block-with-taghighlighter-enabled/9814). Could you see if @codemirror/view 6.43.4 makes the issue go away?
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/dev#1720
No description provided.