From 09233cdaf3191a84f6a82eff0420231e7e48e606 Mon Sep 17 00:00:00 2001 From: astar76 Date: Wed, 18 Nov 2026 04:55:53 -0600 Subject: [PATCH] S061: site menus win on every right click, menu keys, pop-ups need a click, ad frames can't take the tab WebKit asks for a menu on cancelled right clicks once it has shown one; the bridge script's answer decides now. Script navigations that may be a frame's are no longer rewritten into loads in the tab (an ad frame took the tab over on the user's site). Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 1 + .../S061-site-menus-clickthrough.md | 12 +-- Plans/INDEX.md | 2 +- docs/DECISIONS.md | 1 + docs/PROGRESS.md | 9 +++ src/actions.rs | 24 +++++- src/app.rs | 66 +++++++++++++++-- src/engine/host.rs | 16 +++- src/engine/mod.rs | 10 ++- src/inject.rs | 4 + src/selftest.rs | 11 +++ src/tabs.rs | 18 +++++ src/ui/menus.rs | 38 +++++++++- tests/smoke/ctxmenu.txt | 74 ++++++++++++++++++- tests/smoke/net/server.py | 18 +++++ tests/smoke/pages/frame-ad.html | 6 ++ tests/smoke/pages/frame-hijack.html | 8 ++ tests/smoke/pages/player-ad.html | 18 +++++ tests/smoke/pages/site-menu.html | 27 +++++++ tests/smoke/player-ad.txt | 37 ++++++++++ 20 files changed, 372 insertions(+), 28 deletions(-) create mode 100644 tests/smoke/pages/frame-ad.html create mode 100644 tests/smoke/pages/frame-hijack.html create mode 100644 tests/smoke/pages/player-ad.html create mode 100644 tests/smoke/pages/site-menu.html create mode 100644 tests/smoke/player-ad.txt diff --git a/CLAUDE.md b/CLAUDE.md index 0c7154d..f817ff3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -78,6 +78,7 @@ Never modify: `~/Documents/Apps/Nacre` (the original Python Nacre, reference onl | `tools/engine-test/run.sh 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 | | `python3 tests/smoke/net/server.py &` + `tools/smoke.sh tests/smoke/site-data.txt`; `tools/smoke.sh tests/smoke/media-audio.txt` | site info cookie/data count, Clear data time range (stored data kept, cookies always whole); WebKit `is-playing-audio` โ†’ tab audible, tab mute via `set_is_muted` (`pages/sound.html`, `?element` plays `tone.ogg` with Media Session metadata; WebKit's MPRIS player shows on the run's bus: `busctl --address=unix:path=$(cat /session/runtime)/bus list`). Offline, hidden | now (S051) | | `tools/smoke.sh tests/smoke/pip.txt` (+ `tools/hidden.sh tests/smoke/pip.txt -- tests/smoke/pip-driver.sh`: `/windows.json` PiP floating), `bindings.txt` (side buttons, middle click; hidden only), `ctxmenu.txt` (site menu vs Nacre's; hidden only), `pip-return.txt` (page input after PiP and back; hidden only), `pip-loop.txt` (+ `-- tests/smoke/pip-loop-driver.sh`: PiP three rounds, ended by command, Escape, window close; `windows-.json`; hidden only), selftest `pick x y` (GTK's pick at a page point + view state), `python3 tests/smoke/net/server.py &` + `SMOKE_SIZE=1280x900 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, S056) | +| `python3 tests/smoke/net/server.py &` + `tools/smoke.sh tests/smoke/player-ad.txt`; `tools/smoke.sh tests/smoke/ctxmenu.txt` | video site ad tricks (click catcher over the player, pop-under on click, pop-up without a click, ad frame in a cross-site frame must not take the tab); site context menus (`pages/site-menu.html`: YouTube-like toggle, Discord-like, plain, each 3ร—) and Nacre's menu keys via selftest `realkey `. Hidden only, offline | now (S061) | | `tools/hidden.sh + diff --git a/tests/smoke/pages/frame-hijack.html b/tests/smoke/pages/frame-hijack.html new file mode 100644 index 0000000..b4e7445 --- /dev/null +++ b/tests/smoke/pages/frame-hijack.html @@ -0,0 +1,8 @@ +Frame hijack + + +

The page stays here.

+ + diff --git a/tests/smoke/pages/player-ad.html b/tests/smoke/pages/player-ad.html new file mode 100644 index 0000000..27e544a --- /dev/null +++ b/tests/smoke/pages/player-ad.html @@ -0,0 +1,18 @@ +Player ad + + + + + + diff --git a/tests/smoke/pages/site-menu.html b/tests/smoke/pages/site-menu.html new file mode 100644 index 0000000..b9b43d5 --- /dev/null +++ b/tests/smoke/pages/site-menu.html @@ -0,0 +1,27 @@ +Site menus + + +
Player: own menu, then the browser's
+
Chat: always its own menu
+
Plain text: the browser's menu
+ + + diff --git a/tests/smoke/player-ad.txt b/tests/smoke/player-ad.txt new file mode 100644 index 0000000..c368110 --- /dev/null +++ b/tests/smoke/player-ad.txt @@ -0,0 +1,37 @@ +# Video site ad tricks (S061): pages/player-ad.html has a transparent click catcher over the player (an ad the list +# hides), a pop-under that opens a listed ad window on the first click, and a window opened without any click. The +# content filter stops the listed one, Nacre the one without a click (a 'pop-up blocked' bar), and the click reaches +# the player. An ad frame's load never takes the tab over (frame-hijack.html). Hidden only +# (real clicks). Offline. Start the server first: +# python3 tests/smoke/net/server.py & then tools/smoke.sh tests/smoke/player-ad.txt +wait 3 +set /adblock/update_days 0 +set /adblock/lists [] +set /adblock/custom ["http://127.0.0.1:8766/popup-list.txt"] +wait 5 +expect /adblock/rules 3 +waitstatus 60 /adblock/filters_ready true +open http://127.0.0.1:8766/pages/player-ad.html +waitload +wait 3 +shot before +expect /tab_count 1 +expect /active/prompts 1 +assert getComputedStyle(document.querySelector(".nacre-click-ad")).display === "none" || getComputedStyle(document.querySelector(".nacre-click-ad")).pointerEvents === "none" +click 300 200 +wait 2 +shot after +status after +expect /tab_count 1 +assert window.popped === true && window.played === 1 && document.getElementById("v").paused === false +expect /active/prompts 1 +# An ad frame inside a cross-site frame loads an address with a tracking parameter: the tab stays on its page (before +# S061 Nacre stripped it and loaded it in the tab). +open http://127.0.0.1:8766/pages/frame-hijack.html +waitload +wait 3 +status frame +expect /active/url "http://127.0.0.1:8766/pages/frame-hijack.html" +expect /tab_count 1 +status done +quit