From 72709e07b90c0989b1320f624b210bba0c334dfb Mon Sep 17 00:00:00 2001 From: astar76 Date: Fri, 13 Nov 2026 08:03:51 -0600 Subject: [PATCH] S048: WebKit UI callbacks: pop-ups, dialogs, context menu, permissions, full screen, Web Inspector, PiP - Pop-ups as related-view tabs; a blocked one's URL opens on "Allow" - Closing a tab runs beforeunload (try_close, 3 s fallback); HTTP sign-in checked - egui takes the pointer over the page while a dialog or menu is open; colour picker closes on Escape/outside - Permission reasons recomputed for WebKit; media stream/WebRTC on; saved notification answers given to WebKit - Notifications no longer dropped after a non-remembered allow - F12 opens Web Inspector; nacre://devtools lists tabs and remote inspection (D-046); console/network page removed - PiP moves the tab's own view into the PiP window and back (no reload) - Smokes: dialogs, basics extended; pip.txt, auth.txt (server /auth), visible-ui.txt Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 1 + Plans/08 WebKit engine/S048-ui-callbacks.md | 20 +-- Plans/INDEX.md | 2 +- docs/DECISIONS.md | 1 + docs/PROGRESS.md | 9 ++ src/actions.rs | 135 ++++++++++------ src/app.rs | 65 +++++--- src/engine/host.rs | 30 +++- src/engine/mod.rs | 15 +- src/inject.rs | 16 +- src/selftest.rs | 3 +- src/store/permissions.rs | 15 +- src/tabs.rs | 28 +--- src/ui/chrome.rs | 8 +- src/ui/dialogs.rs | 8 +- src/ui/mod.rs | 4 - src/ui/pages/devtools.rs | 165 +++----------------- src/ui/pages/mod.rs | 2 - src/ui/pages/settings.rs | 2 +- src/window.rs | 21 ++- tests/smoke/auth.txt | 23 +++ tests/smoke/basics.txt | 12 ++ tests/smoke/dialogs.txt | 78 ++++++++- tests/smoke/net/server.py | 6 + tests/smoke/pages/auth-login.csv | 2 + tests/smoke/pages/dialogs.html | 5 +- tests/smoke/pip.txt | 25 +++ tests/smoke/visible-ui.txt | 32 ++++ 28 files changed, 436 insertions(+), 297 deletions(-) create mode 100644 tests/smoke/auth.txt create mode 100644 tests/smoke/pages/auth-login.csv create mode 100644 tests/smoke/pip.txt create mode 100644 tests/smoke/visible-ui.txt diff --git a/CLAUDE.md b/CLAUDE.md index 16c3b8a..09e435a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -79,6 +79,7 @@ Never modify: `~/Documents/Apps/Nacre` (the original Python Nacre, reference onl | `tools/smoke.sh tests/smoke/privacy-mode.txt` (+ `SMOKE_ARGS=--incognito … privacy-incognito.txt`) | privacy mode: `pages/fingerprint.html` read off/on, `fp-off.json`/`fp-on.json` + shots (offline); `privacy-net.txt` (needs `tests/smoke/net/server.py`) frame cookies, per-site pause, Accept-Language; `SMOKE_TIMEOUT=700 … coveryourtracks.txt` EFF's test off/on (internet, direct). Selftest `save ` writes a JS string result to `.json`; `SMOKE_ARGS` passes browser arguments | now (S024) | | `python tools/icons.py` | rebuilds the icon font subset and `src/ui/icons.rs` from `tools/icons.txt` (needs fontTools and Arch's ttf-material-symbols-variable) | now (S015) | | `tools/engine-test/run.sh servo\|chromium\|webkit` + `analyze.py` | engine comparison: one browser visible on DP-1, throwaway profile, sites from `sites.txt`, per-second RAM (PSS), CPU, GPU of the whole process tree into `docs/engine/runs//samples.csv`; `webkit_shell.py` is the WebKitGTK 6.0 shell (needs `webkitgtk-6.0`); report `docs/engine/engine-comparison.md`. Never run two at once or alongside cargo | now | +| `tools/smoke.sh tests/smoke/pip.txt`, `python3 tests/smoke/net/server.py &` + `NACRE_NO_BRIDGE=1 tools/smoke.sh tests/smoke/auth.txt`, `tests/smoke/visible-ui.txt` (by hand, header) | PiP moves the live view and back (offline); HTTP sign-in cancel + saved login (offline); visible: portal file chooser, notification, page full screen, Web Inspector (`dialogs.txt` now also checks dialog answers, context menu, leave page, permission bars, notifications count) | now (S048) | | `tools/hidden.sh +

+

A link to hello

+

Some text to right click on.

+ diff --git a/tests/smoke/pip.txt b/tests/smoke/pip.txt new file mode 100644 index 0000000..4cf8cfe --- /dev/null +++ b/tests/smoke/pip.txt @@ -0,0 +1,25 @@ +# Picture in picture (S048): the tab's own view moves into the PiP window and back; the page keeps its state (no +# reload, video keeps playing). Offline. Run with tools/smoke.sh; read the PNGs. +wait 3 +open @PAGES@/video.html +waitload +waitfor 10 document.getElementById('v').currentTime > 0.5 +js window.marker = 42 +cmd pip +wait 2 +expect /active/pip true +expect /windows 2 +shot pip-window pip +shot pip-tab +assert window.marker === 42 && !document.getElementById('v').paused && document.documentElement.classList.contains('__nacre_pip') +js window.t0 = document.getElementById('v').currentTime +wait 1.5 +assert document.getElementById('v').currentTime !== window.t0 +cmd exitpip +wait 1.5 +expect /windows 1 +expect /active/pip false +assert window.marker === 42 && !document.getElementById('v').paused && !document.documentElement.classList.contains('__nacre_pip') +shot pip-back +status done +quit diff --git a/tests/smoke/visible-ui.txt b/tests/smoke/visible-ui.txt new file mode 100644 index 0000000..179ab57 --- /dev/null +++ b/tests/smoke/visible-ui.txt @@ -0,0 +1,32 @@ +# Visible UI callbacks (S048, D-045): what a hidden run can't show. Run by hand on the user's screen with the user's +# Wayland display and session bus (portal, notifications) but a throwaway home, e.g. +# HOME=$t XDG_CONFIG_HOME=$t/.config XDG_DATA_HOME=$t/.local/share XDG_CACHE_HOME=$t/.cache NACRE_SCRIPT= nacre +# and grab DP-1 with grim meanwhile: the portal's file chooser (cancelled by the user or left to close with Nacre), +# a system notification, the page's own full screen (chrome hidden), Web Inspector attached (F12). +wait 3 +open @PAGES@/dialogs.html +waitload +js document.getElementById('f').click() +wait 6 +shot file-request +js Notification.requestPermission().then(p => { window.np = p; }) +wait 1 +prompt allow +wait 1 +assert window.np === "granted" +js new Notification("Nacre test", { body: "S048 visible run" }), 1 +js window.onbeforeunload = null +wait 4 +open @PAGES@/basics.html +waitload +js document.documentElement.requestFullscreen() +wait 2 +status fullscreen-page +shot fullscreen-page +js document.exitFullscreen() +wait 2 +do devtools +wait 6 +shot inspector +status done +quit