Skip to content

error dialog (TypeError: null contentWindow) when rearranging panes on short windows #17954

Closed

Description

@kevinushey

On windows short enough to trigger pane snap-to-minimize churn (observed at 1024x640; CI-runner-sized displays), rearranging panes -- e.g. swapping quadrants in Global Options > Pane Layout -- can raise an error dialog:

(TypeError) : Cannot read properties of null (reading 'document')

ImageFrame.replaceLocation (the Plots pane's image host) dereferences el.contentWindow unconditionally; while the iframe is detached or being re-parented during the layout change, contentWindow is null and the read throws an uncaught exception. The onLoad path already probes for readiness and retries (its comment even notes "sometimes contentWindow is null"); only the direct setImageUrl path lacked the guard.

Found while pinning the e2e test window geometry to the CI runner's display size: pane_layout.test.ts failed 16/16 -> 15/16 at 1024x640 and the failure screenshots showed this dialog.

Activity

  1. self-assigned this
    on Jun 12, 2026
  2. kevinushey commented on Jun 12, 2026

    @kevinushey
    CollaboratorAuthor

    Reopening note (for the record -- fix is committed, see below): the ImageFrame guard in #17956 fixed one instance of this "TypeError: Cannot read properties of null (reading 'document')" dialog, but not the only one. AceEditorPreview (the theme preview in Global Options > Appearance) schedules setLineHeight() on a 100ms timer; if the preview iframe is detached before it fires (preferences dialog closed, or a pane relayout reparents it -- more likely on short windows), getDocument() dereferences a null contentWindow and raises the same dialog.

    This second instance was caught by the fail-on-client-exception harness added in #17956 (via pane_layout.test.ts at CI window geometry) and fixed in commit 4b30336 on the data-viewer-filter-coverage branch (PR pending): stop the scheduled callback when the widget is detached, and null-check both the window and document in setLineHeight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions