Skip to content

Wait for the Browser pane's initial load before navigating - #1382

Merged
currentbits merged 1 commit into
mainfrom
fix/preview-navigate-initial-load
Sep 29, 2026
Merged

currentbits merged 1 commit into
mainfrom
fix/preview-navigate-initial-load

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Problem

The Browser pane binds its guest on did-attach, while the guest's initial about:blank is still loading. A loadURL issued in that window resolves on the initial load's did-finish-load, not ours. So preview.navigate (the pane's Go button, the suggested-URL auto-load and the MCP preview navigate tool) returned about:blank, and an immediate screenshot captured an empty page. The real page committed about 1 ms later.

Event trace from a real Electron 35.7.5 guest:

0   before loadURL isLoading=true url=""
1   did-start-navigation http://127.0.0.1:…/
35  did-navigate about:blank
41  did-finish-load            <- loadURL resolves here
41  loadURL resolved url=about:blank
42  did-navigate http://127.0.0.1:…/

Fix

In navigate, if the guest is still on its initial load (isLoading() with an empty or about:blank URL), wait for did-stop-loading (bounded to 2 s) before calling loadURL. It's one guard in the shared path.

Verification

  • New unit test navigate waits for the guest's initial about:blank load to stop: fails without the fix (6/7), passes with it (7/7).
  • Isolated Electron probe using the real electron/preview.js and a real <webview> bound on did-attach (same as BrowserPane). It runs bind → info → navigate → click → type → screenshot, refuses an external URL, and returns PANE_CLOSED after the pane is removed. Before: immediate navigate reported about:blank 3/3 times. After: 11/11 checks pass on 3/3 runs.

Found while finishing the Browser→MCP verification for #1369.

🤖 Generated with Claude Code

The pane binds on did-attach while its initial about:blank is still
loading. A loadURL issued then resolves on that load's did-finish-load,
so preview navigate (UI Go, auto-load, MCP tool) reported about:blank
and an immediate screenshot captured an empty page. Let the initial
load stop (bounded to 2s) before calling loadURL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@currentbits
currentbits merged commit 4423803 into main Sep 29, 2026
6 checks passed
@currentbits
currentbits deleted the fix/preview-navigate-initial-load branch September 29, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant