Skip to content

fix(browser): match loading surfaces to the Orca theme - #18738

Merged
Jinwoo-H merged 4 commits into
mainfrom
sep04-browser-themed-loading
Sep 5, 2026
Merged

Jinwoo-H merged 4 commits into
mainfrom
sep04-browser-themed-loading

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Opening a browser pane in dark mode could briefly show a bright white rectangle. The empty surface now matches Orca's theme, while real webpages keep their own colors.

What Changed

  • Use var(--background) for the local webview host and Electron's transparent=false preference for the webpage canvas.
  • Keep synthetic blank documents and crashed guests unavailable until a document commits, preserving the themed New Tab/recovery surface.
  • Add a deterministic Electron oracle and focused coverage for guest reuse/remount and blank/recovery behavior.
  • Preserve retained content during normal reload/navigation. No new spinner, timers, theme subscriptions, or guest CSS/DOM injection.

Why

Main at 264c9ed8d27b reproduces the failure. The guest factory hard-coded white before Electron painted. A CSS-only correction makes unstyled webpages inherit Orca's dark canvas; native guest opacity preserves their normal readable white canvas.

The factory owns the affected surface across creation, parking, and recovery. Remote/client-hosted factories were traced and left unchanged; the remote viewport already uses the theme before a decoded frame.

Linked Issue

User-reported regression; no linked issue was supplied.

Visual Proof

Full-app screenshots from an isolated Orca dev instance, captured with Playwright CDP while the same controlled HTTP response was held.

Before After
White loading surface Themed loading surface

Unstyled webpage stays white · New Tab · Recovery

Testing

  • Manually tested locally in an isolated macOS Electron 43 instance; all 19 visual/state phases also pass in Linux Electron CI.
  • Automated tests added.

The same oracle checks raster pixels and guest/host state across attachment, held/streamed first responses, live dark/light/system changes, unstyled content, reload, park/unpark, renderer crash recovery, New Tab, and network failure/retry:

Version Result
Main baseline 11/19
Candidate 19/19
Candidate with fix reverted 11/19, identical eight failures

Passed: all 799 browser-pane unit tests (99 files), seven Electron tests, pnpm tc:web, changed-file oxlint, and pnpm run check:code-quality:changed.

Reproduce with pnpm run test:e2e -- tests/e2e/browser-loading-surface.spec.ts --workers=1. The artificial pre-attach gate pauses the renderer test clock so slower screenshot capture cannot trigger the missing-guest watchdog; normal time resumes when attachment is released. Painted-content captures wait for the compositor to present the page; held pre-content captures remain immediate. Screenshots and results are attached here; generated observation reports are kept outside the source diff.

Limits: Windows, live paired-host, and SSH/folder scenarios were not separately rendered. Optional whole-suite pnpm run typecheck:e2e reports unrelated suite diagnostics; neither added oracle file is named. The full lint/typecheck/test/build suite was not run.

Review

Three independent reviewers checked architecture/simplicity, visual/theme/accessibility, and lifecycle/regression risk. Two rounds completed with no proven in-scope issues remaining. Validation findings added network retry/committed-empty coverage and corrected transient-UI sampling.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material changed.

Notes

No protocol, execution-host, provider, path, shortcut, or permission changes. Cross-platform CI is recommended before merge.

Checklist

  • This PR is small and focused: one production file plus focused regression tests
  • Explained what changed and why, including ELI5
  • Before/after screenshots attached
  • Self-reviewed correctness, security, and performance
  • Cross-platform and SSH/remote impact considered
  • Full pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass; targeted local checks above passed, broader CI remains

@coderabbitai

coderabbitai Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: ebba5b96-8736-40b7-ab82-ec2a3ba619e8

📥 Commits

Reviewing files that changed from the base of the PR and between db04a32 and 0df6fa1.

📒 Files selected for processing (1)
  • tests/e2e/browser-loading-surface-oracle.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Browser webviews now use theme-aware backgrounds and opaque guest canvases. Blank documents remain hidden until a real main-frame document commits. Renderer loss hides the guest until recovery. Unit tests cover these states and webview preferences. New end-to-end coverage controls HTTP responses, captures visual and DOM state, verifies reload and worktree retention, tests renderer recovery, and validates navigation retry behavior.

Merge Risk: 🔵 Low · up to 0df6f

This updates browser loading surfaces so hosts follow the application theme while committed webpages render opaquely. The light-theme webpage check can still pass without a visible guest, so the change is mergeable with a bounded test-coverage follow-up.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ⚠️ Warning The description states that no linked issue was supplied, which violates the template requirement for an issue link. Link the relevant issue and update the description with a valid Fixes # reference.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description is detailed and covers the change, rationale, visual proof, testing, review, scope, and checklist. It records that no linked issue was supplied, although the repository template requir…
Out of Scope Changes check ✅ Passed The changes remain focused on browser loading surfaces, related lifecycle behavior, and targeted regression coverage. The scope matches the stated objectives.
Title check ✅ Passed The title clearly and concisely describes the primary change: aligning browser loading surfaces with the Orca theme.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 497b1bac-a843-4fe6-9d79-7d2ffe6f9d87

📥 Commits

Reviewing files that changed from the base of the PR and between 8064d1f and 186560e.

📒 Files selected for processing (10)
  • docs/assets/browser-themed-loading/README.md
  • docs/assets/browser-themed-loading/baseline-observations.json
  • docs/assets/browser-themed-loading/candidate-observations.json
  • docs/assets/browser-themed-loading/matrix.json
  • docs/assets/browser-themed-loading/reverted-observations.json
  • src/renderer/src/components/browser-pane/host-guest/browser-page-webview-surface.test.ts
  • src/renderer/src/components/browser-pane/host-guest/browser-page-webview.ts
  • src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-viewport.test.tsx
  • tests/e2e/browser-loading-surface-oracle.ts
  • tests/e2e/browser-loading-surface.spec.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.

? state.background === state.theme ||
state.visibility === 'hidden' ||
state.display === 'none'
: state.url.startsWith('http://127.0.0.1:')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Require the white-page guest to remain rendered. When expected === 'white', also require state.attached, state.visibility === 'visible', and state.display !== 'none'. Otherwise a hidden webview can expose the white host surface while retaining the loopback URL and pass the oracle.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
: state.url.startsWith('http://127.0.0.1:')
: state.url.startsWith('http://127.0.0.1:') &&
state.attached &&
state.visibility === 'visible' &&
state.display !== 'none'

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

One cross-platform concern to resolve before merge — the blank/crash suppression hinges on visibility: hidden, which is validated only on macOS (see the inline comment on browser-page-webview.ts).

Reviewed changes

  • Themed guest surface — ensureBrowserPageWebview replaces the hard-coded #ffffff host background with var(--background) and appends transparent=false to the shared webpreferences so unstyled pages keep a readable white canvas instead of inheriting Orca's dark theme.
  • Blank/recovery suppression — guest-owned load-commit and render-process-gone listeners hide the guest for synthetic blank documents (about:blank / data:text/html,) and reveal it once a non-blank main frame commits, preserving the themed New Tab and recovery surfaces.
  • Focused coverage — a happy-dom unit suite for surface ownership/reuse/remount, a remote-viewport regression test, and a deterministic Playwright oracle that gates/holds responses and samples raster pixels across 19 phases (11/19 on main and reverted, 19/19 on candidate).

ℹ️ Nitpicks

  • The three *-observations.json files under docs/assets/browser-themed-loading/ (~1500 lines) are one-shot evidence that no tooling reads; consider keeping the README plus matrix.json and dropping the raw dumps so future diffs aren't polluted.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

// A committed synthetic blank document belongs to New Tab, including while its first URL waits.
guest.addEventListener('load-commit', (event) => {
if (event.isMainFrame) {
guest.style.visibility =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blank/crash suppression depends on visibility: hidden suppressing the guest's composited frame, but browser-page-pane.tsx:324 sets display: none on this same guest specifically because "some Electron builds keep painting a hidden guest layer". Validation was macOS-only; please confirm visibility: hidden actually hides the white canvas on Linux/Windows before merge.

Technical details
# Verify `visibility: hidden` suppresses guest compositing cross-platform

## Affected sites
- `src/renderer/src/components/browser-pane/host-guest/browser-page-webview.ts:79` (and `:84`) — the new blank/crash hiding mechanism.
- `src/renderer/src/components/browser-pane/assemble-chrome/browser-page-pane.tsx:324-325` — pre-existing code that uses `display: none` for the failure overlay on this same guest, with the comment "some Electron builds keep painting a hidden guest layer, so drop it from layout (display:none) instead of just hiding it".

## Required outcome
- Demonstrate that a `visibility: hidden` `<webview>` stops painting its (now opaque-white) canvas on Linux and Windows too, or switch the blank/crash states to a mechanism that provably suppresses compositing without blanking the in-flight navigation (note `attach-browser-page-webview.ts:124` warns that navigating a `display: none` guest can leave it blank).

## Suggested approach (optional)
- Run the `browser-loading-surface` oracle on the Linux/Windows CI runners before merge; the author's checklist already flags full CI as unrun.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The test-only delta is clean, but the previously raised cross-platform concern is still open and blocks merge.

Reviewed changes

  • Synced the webpreferences assertion — BrowserPane.webview-preferences.test.ts now expects the transparent=false suffix the factory appends, keeping the pre-existing suite green against the prod change.
  • Froze the renderer clock during the attach gate — the e2e oracle now pauses the page clock (page.clock.pauseAt) so the missing-guest watchdog does not fire while src is held for the pre-attach screenshot, resuming on release and in the finally block.

The blank/crash suppression still hinges on visibility: hidden on browser-page-webview.ts:79, validated only on macOS; the production file is byte-identical since that thread was raised, so it must still be confirmed on Linux/Windows before merging.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The test-only delta is clean, but the cross-platform concern raised in the initial review is still open and blocks merge.

Reviewed changes

  • Await painted content after network recovery — the e2e oracle now retries raster sampling for white phases via expect.poll after isLoading() settles, because loading can stop before the compositor presents the recovered guest's first frame, instead of failing on a single pre-paint sample.

The production file browser-page-webview.ts is byte-identical since the first review, so the blank/crash suppression still hinges on visibility: hidden (browser-page-webview.ts:79), validated only on macOS. That thread remains open and must be confirmed on Linux/Windows before merging.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H
Jinwoo-H merged commit 040c3e5 into main Sep 5, 2026
87 of 92 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix(browser): theme unavailable guest surfaces without recoloring pages

* test(browser): keep generated loading evidence out of the PR diff

* test(browser): freeze recovery clock during artificial attach gate

* test(browser): await painted content after network recovery
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