webviewprobe

command
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: BSD-3-Clause Imports: 25 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command webviewprobe is the live-verify probe for the native-view-embedding spike (#45) and the bridge and navigation API designed on top of it (#66): widget.NativeViewHost hosting the platform's real web engine — a WKWebView on macOS, a WebView2 on Windows (#65).

go run ./hack/webviewprobe

The window shows a web view inside a container.Scroll, with controls to exercise every case the spike has to answer for: scrolling it under the viewport edge, hiding it, resizing the window, opening a bellui popup over it, and typing into a bellui Entry beside it.

PASS, by eye:

  • the web page renders at the host's rectangle and follows the scroll;
  • it is cut off cleanly at the scroll's edges (native clipping works);
  • scrolling it fully out of the viewport makes it disappear, and scrolling back brings it back;
  • Hide/Show removes and restores it;
  • resizing the window keeps it glued to its widget;
  • closing the window does not crash.

FAIL, and the point of the spike:

  • the bellui popup opened with "Popup over web view" is OCCLUDED where it overlaps the web view. That is the hole punch working as designed, and it is the limitation the spike exists to price.

Two-way logic, by eye: "Recolour page from bellui" drives the page from a bellui button, "Call the page's greet()" asks the page a question and shows its answer, and "Post to the page" pushes a notification the page renders. The page's own buttons post a message a bellui Label displays, and call a Go handler whose answer the page renders.

Navigation, by eye: load the second page, walk back and forward through the history while the load state label follows along, and press "Try a blocked navigation" to watch the policy hook refuse one — the page does not move.

Focus, by eye: type in the Entry, click into the page (the Entry's caret stops — bellui has released the focus), then click back in the Entry and type again (the keys reach it, not the page). "Focus the web view" does the same move programmatically, and Tab never lands on the web view.

-auto measures those claims instead of asserting them by eye:

go run ./hack/webviewprobe -auto

The trick is to capture the same window twice — once through bellui (Canvas.Capture, which reads bellui's GPU surface) and once through the OS (which reads the real composited screen) — and compare. The difference between the two *is* the hole. Only that second capture is per-platform (see capture.go). It reports:

  • HOLE — the host's rectangle is web content on screen and empty widget in Canvas.Capture.
  • OCCLUSION — showing a bellui popup over the host changes bellui's surface and does not change the screen at all.
  • CLIP — no web content appears outside the scroll viewport.
  • SCROLLOUT — scrolling the host past the viewport removes the view.
  • HIDE — Hide() removes the native view and Show() restores it.
  • RESIZE — after a window resize the view is still on its widget and still clipped.
  • FOCUS — the #59 bridge in both directions: handing the OS focus to the web engine releases bellui's focused Entry, and focusing the Entry again pulls the keyboard back out of the web engine.
  • BRIDGE — the whole #66 channel: a bellui widget restyles the live page, an eval reports its value and its errors, the page posts a message back, a correlated call round-trips with a hostile argument carried as data, and a call nothing can answer fails instead of hanging. The hole punch constrains what can be drawn over the view and who owns the keyboard, not data flow.
  • NAV — session history, load state reporting, and a navigation the policy hook refuses: it never starts, and it is reported as cancelled.
  • TRUST — the bridge is opt-in. A second view attached with the bridge off has no window.bellui and no message handler at all, and a page loaded from a genuinely different origin (a local HTTP server) is dropped before any handler runs.
  • COST — how many per-frame geometry evaluations actually reached the platform.

-dump <dir> keeps every capture for inspection.

-auto needs to be able to read the screen. On macOS that means Screen Recording permission for the terminal running it (System Settings > Privacy & Security > Screen Recording); on Windows it means an interactive session, not the session-0 window station an SSH command lands in (pre-rebrand tracker #487's trap — schtasks /IT is the way out). Without it the capture comes back blank and the probe says so rather than measuring bellui's surface against itself.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL