Files
magpie/internal/gui/webkit_other.go
T
yetone 6af83172d3 gui: the masking demo shows no video where WebKitGTK can't play one (avk458 on X)
On Omarchy (Arch + Hyprland) without gst-plugins-good, opening Masking's
"How masking works" aborted WebKitWebProcess about 3s later: WebKitGTK
2.52.6 gives every <video>, muted ones too, an autoaudiosink, which lives
in libgstautodetect.so ("no such element factory autoaudiosink", then a
SIGABRT). The window was left frozen on its last frame ("一点就崩溃再点
magpie就卡死了").

Cause: b90e81da1's noVideo was only in GET /api/settings. The page's
state.settings comes from /api/state, which never carried it, so a demo
opened before Settings was visited set the webm src. The GUI fixture put
noVideo into /api/state's settings and hid it.

Now boot.js says noVideo (app only, not a browser tab) before the page
paints, and demo.js reads window.bootPrefs.noVideo; the poster shows
instead. Also, for BoyC338's memory question: folded, or with the page
left, the video lets go of its source (removeAttribute src + load), so
no decoder or buffer is held; opened again it goes on from where it was.

Run:
- mote: GUI masking-demo, masking-records, i18n-keys in Chromium and
  WebKit: 116 pass, 0 fail.
- mote: go test -run 'TestBootSaysNoVideo|TestBoot|TestSettings|
  TestFontSettingsAPIAndBoot|Budget' ./internal/gui ok; gofmt -l none;
  vet for darwin, GOOS=windows, GOOS=linux -tags nogui ok.
- WSL magpie-desktop: go test -tags gtk3 -run 'TestBootSaysNoVideo|
  TestGstAutodetect|TestWebkitDefaults|TestSettings' ./internal/gui ok.
- Real app on omarchy, v0.1.1840 release: Masking > demo row aborted
  WebKitWebProcess (coredump 07:10:10 UTC), window frozen. Built this
  tree with make release-linux in WSL and ran it there: demo opens with
  the poster and animates, fold/reopen, Agents and back to Masking all
  respond; no coredump, no autoaudiosink line, both web processes alive.
These ran at base ea53eb126; rebased onto 05ed578bd (redact/gateway
changes, none in internal/gui) and the budgets run again before push.

Broken by hand:
- demo.js reading state.settings?.noVideo: the poster test is red in
  both engines.
- hold() commented out: the folded test is red in WebKit.
- boot flag removed: TestBootSaysNoVideo is red.

Not tried: a Linux system with gst-plugins-good (the video path there
is unchanged); arm64 Linux. Recovering a window whose web process died
(web-process-terminated) is not handled by magpie or Wails; not in this
commit.
2026-10-28 15:25:53 +08:00

10 lines
224 B
Go

//go:build !linux
package gui
// webkitDefaults: only Linux's webview is WebKitGTK.
func webkitDefaults() {}
// webkitPlaysVideo: the other systems' webviews play video.
var webkitPlaysVideo = func() bool { return true }