Skip to content

emrg: GUI workspace panel P2.3+P3.4 — WebContentsView HTML preview (rant 2026-08-11T12:20:35) - #671

Merged
argszero merged 1 commit into
masterfrom
feature/gui-workspace-panel-p34-html-preview
Aug 11, 2026
Merged

emrg: GUI workspace panel P2.3+P3.4 — WebContentsView HTML preview (rant 2026-08-11T12:20:35)#671
argszero merged 1 commit into
masterfrom
feature/gui-workspace-panel-p34-html-preview

Conversation

@argszero

Copy link
Copy Markdown
Owner

GUI right-column workspace panel: final major slice — embedded-browser HTML preview via WebContentsView (last remaining item of the rant's P2.3 framework + P3.4 preview content, which the design allows to land together).

P2.3 WebContentsView framework (main.js)

  • Lazy creation on first HTML tab (R7-⑤): new WebContentsView({ sandbox: true, contextIsolation: true, nodeIntegration: false }), single instance reused (one preview at a time)
  • Bounds sync (R4-②): right-aligned rect {x: winW-panelW, y: contentTop, w: panelW, h: winH-contentTop}; contentTop = viewer pane top reported by renderer; updated on win resize + emrg:panelResized IPC (width / collapse / narrow-screen)
  • Security checklist (gap 8): setWindowOpenHandler → deny; will-frame-navigate → main-frame navigations restricted to file: (remote URLs blocked)
  • Collapse → view hidden (bounds to offscreen, setVisible false)
  • Renderer crash recovery (R5-④): main keeps preview path as source of truth; renderer pulls via emrg:getPreviewState after reload and reopens the tab

P3.4 HTML preview (renderer)

  • .html/.htm → embedded preview (no read_file call); DOM placeholder (mixed model) visible when collapsed
  • Tab switch semantics: HTML→HTML = reload (loadURL replace), HTML→non-HTML = closePreview, close tab = closePreview
  • i18n zh/en result.htmlPreview; CSS .viewer-html placeholder

Verification: GUI 212/212 (+7 renderer smoke tests: IPC calls, html-path detection both states, html→html reload semantics, close/switch closePreview, panelResized reporting on init/collapse/expand, crash-recovery reopen, idempotent reopen), pytest 694/694, doc-count guard 3/3, import + --help ✓.

Rant 2026-08-11T12:20:35 acceptance: P1-P3 all slices now merged/submitted (P3.3 viewer #670 merged; this PR closes the last item).

…ant 2026-08-11T12:20:35)
- main.js: lazy WebContentsView (sandbox+contextIsolation), right-aligned
bounds sync via emrg:panelResized + win resize; will-frame-navigate
file:-only gate + setWindowOpenHandler deny (security checklist); preview
path kept in main as source of truth for renderer crash recovery
- preload.js: previewHtml / closePreview / panelResized / getPreviewState
- result-panel.js: .html/.htm → embedded preview (no read_file), DOM
placeholder (mixed model), syncPreview on tab switch, panelResized on
width/collapse changes, crash-recovery reopen via getPreviewState
- i18n zh/en result.htmlPreview; layout.css .viewer-html placeholder
- +7 renderer smoke tests (IPC calls, html detection both states,
html→html reload semantics, close/switch closePreview, panelResized
reporting, crash recovery, idempotent reopen); GUI 205→212

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

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

✅ LGTM — cycle

P2.3+P3.4 WebContentsView HTML preview — final major workspace-panel slice. Verified locally:

  • main.js: lazy WebContentsView (sandbox+contextIsolation+nodeIntegration:false), right-aligned bounds via previewRect (win resize + emrg:panelResized), will-frame-navigate file:-only main-frame gate + setWindowOpenHandler deny, preview path held in main as crash-recovery source of truth
  • renderer: .html/.htm → embedded preview (no read_file), DOM placeholder mixed model, HTML→HTML reload / HTML→non-HTML closePreview semantics, panelResized on init/width/collapse, getPreviewState reopen after renderer crash
  • GUI 212/212 (+7 renderer smoke), pytest 694/694, doc guard 3/3, import + --help ✓
    CI test PASS (31464133515).

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

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

✅ LGTM — cycle

Verified in worktree (head 7036193): GUI 212/212 (+7 renderer smoke: previewHtml IPC, html-path detection both states (.html/.htm/.HTM → preview; .py → readFile), html→html reload semantics, close/switch closePreview, panelResized init+collapse/expand, crash-recovery reopen, idempotent handlePreviewState), pytest 694/694, doc-count guard 3/3, node --check clean, CI test SUCCESS, MERGEABLE.

Security checklist confirmed: WebContentsView sandbox+contextIsolation+nodeIntegration:false (mirrors main window), setWindowOpenHandler deny, will-frame-navigate restricts main-frame to file: URLs, lazy create/single instance reuse, collapse → offscreen bounds, renderer-crash recovery with main as source of truth (emrg:getPreviewState). Closes the final rant slice (P2.3+P3.4) after #670.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

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

✅ LGTM — cycle

Third LGTM. Verified at head 7036193 (merge base = master 80ab4a0, MERGEABLE):

  • main.js: WebContentsView lazy creation (sandbox + contextIsolation + nodeIntegration:false), right-aligned previewRect bounds synced via emrg:panelResized + win resize, will-frame-navigate file:-only main-frame gate + setWindowOpenHandler deny, crash-recovery source of truth via emrg:getPreviewState
  • renderer: .html/.htm embedded preview (no read_file) with DOM placeholder, syncPreview (HTML→HTML reload / non-HTML closePreview), panelResized reporting, idempotent handlePreviewState
  • Tests: GUI 212/212 (+7 renderer smoke), pytest 694/694, doc guard 3/3
    CI test PASS (31464133515). Mergeable CLEAN.

@argszero
argszero merged commit c6b5872 into masterAug 11, 2026
1 check passed
argszero added a commit that referenced this pull request Aug 11, 2026
argszero added a commit that referenced this pull request Aug 11, 2026
@argszero
argszero deleted the feature/gui-workspace-panel-p34-html-preview branch August 17, 2026 09:44
Sign up for freeto 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

@argszero