diff --git a/Plans/02 Verify/S008-verify-stores.md b/Plans/02 Verify/S008-verify-stores.md index 73cedc0..95f7ec6 100644 --- a/Plans/02 Verify/S008-verify-stores.md +++ b/Plans/02 Verify/S008-verify-stores.md @@ -11,14 +11,15 @@ Verify passwords/vault and autofill, permissions prompts, history/bookmarks/down - `src/ui/pages/mod.rs` (list of pages) ## Steps -- [ ] Script: open every nacre:// page and take a shot; check none panics or renders empty -- [ ] Vault: create, lock/unlock, save a login from a local form page, autofill it, export/import; check the vault file is encrypted -- [ ] Permissions: a local page asking for notifications/geolocation/camera; allow/deny/remember; check `permissions` store -- [ ] History, bookmarks (add, folder, bookmarks bar, import/export HTML), downloads page lists entries -- [ ] User scripts/styles apply on matching pages; install a site as an app and launch it -- [ ] Importer: build a fake old-Nacre profile from `~/Documents/Apps/Nacre` config format in a temp dir (never the user's real profile) and import it -- [ ] Change a sample of settings via `set` and via clicks; check `settings.json` and the effect; mark FEATURES rows -- [ ] PROGRESS entry, INDEX line, commit `S008: …` and push +- [x] Script: open every nacre:// page and take a shot; check none panics or renders empty +- [x] Vault: create, lock/unlock, save a login from a local form page, autofill it, export/import; check the vault file is encrypted +- [x] Permissions: a local page asking for notifications/geolocation/camera; allow/deny/remember; check `permissions` store +- [x] History, bookmarks (add, folder, bookmarks bar, import/export HTML), downloads page lists entries +- [x] User scripts/styles apply on matching pages; install a site as an app and launch it +- [x] Importer: build a fake old-Nacre profile from `~/Documents/Apps/Nacre` config format in a temp dir (never the user's real profile) and import it +- [x] R1-20 per-site memory and enforcement: set per-site zoom, ad blocker on/off, privacy-mode flag (flag persistence only; internals are D-011) and other per-site choices; set per-site permissions (camera, mic, location, notifications, pop-ups, autoplay, …); quit, relaunch with `SMOKE_HOME=/home`, check values are in the stores and apply again on reopening the site; check each permission is enforced (blocked/allowed/asked per its stored value), not only stored; fix what is not +- [x] Change a sample of settings via `set` and via clicks; check `settings.json` and the effect; mark FEATURES rows +- [x] PROGRESS entry, INDEX line, commit `S008: …` and push ## End criteria - Every nacre:// page has a non-blank screenshot in the run dir. diff --git a/Plans/02 Verify/S009-verify-integrations.md b/Plans/02 Verify/S009-verify-integrations.md index d4e884c..e9ce494 100644 --- a/Plans/02 Verify/S009-verify-integrations.md +++ b/Plans/02 Verify/S009-verify-integrations.md @@ -17,6 +17,7 @@ Verify Discord Rich Presence, media session and visualizer, spell check, update - [ ] Updates: point the update URL at a local JSON file; check the notice and that nothing downloads automatically - [ ] Gamepad: check it enumerates without a device and doesn't spin the CPU; single instance: second launch forwards a URL - [ ] Performance: freeze/discard idle tabs and memory saver numbers; mark FEATURES rows verified/broken +- [ ] R4-09 Discord site icon: `icon_url` in `src/discord.rs` (https image/favicon, else the origin's /favicon.ico) is written, **not compiled yet**; build, run `nice cargo test --release -j 2 icon_prefers`, see the icon in the fake-IPC `SET_ACTIVITY` frame (`assets.large_image`), user confirms in real Discord; app ID stays in Settings, never in code - [ ] PROGRESS entry, INDEX line, commit `S009: …` and push ## End criteria diff --git a/Plans/05 Engine/S026-gst-mse-fixes.md b/Plans/05 Engine/S026-gst-mse-fixes.md index b4335d3..fe965c1 100644 --- a/Plans/05 Engine/S026-gst-mse-fixes.md +++ b/Plans/05 Engine/S026-gst-mse-fixes.md @@ -24,27 +24,27 @@ branch lands on main at the end of S028 (see S028), not here. all init segments), the MSE spec "init segment received" and HAVE_METADATA steps. ## Steps -- [ ] `git merge main` into `s022-mse-proto` (worktree), build, `tools/smoke.sh tests/smoke/mse.txt` still green -- [ ] Vendor the gst_mse library + mse plugin sources (1.28.9, LGPL-2.1, keep headers and COPYING) into +- [x] `git merge main` into `s022-mse-proto` (worktree), build, `tools/smoke.sh tests/smoke/mse.txt` still green +- [x] Vendor the gst_mse library + mse plugin sources (1.28.9, LGPL-2.1, keep headers and COPYING) into `vendor/gst-mse/` with a small meson (or cc) build; `tools/gst-mse.sh` builds `libgstmse-1.0.so.0` and the plugin into `target/gst-mse/`. Mark every change "Nacre patch". -- [ ] Load our copy: the library ahead of the system one (rpath or `LD_LIBRARY_PATH` set before GStreamer +- [x] Load our copy: the library ahead of the system one (rpath or `LD_LIBRARY_PATH` set before GStreamer init — check which works with gstreamer-mse-sys) and the plugin via `GST_PLUGIN_PATH`/registry; log the loaded path once. Decide and record how release builds find it. -- [ ] Bug 1: signal update/update-end only after the end-of-append for that append has been consumed +- [x] Bug 1: signal update/update-end only after the end-of-append for that append has been consumed (`consume_all_samples` done); C test: buffered is non-empty at the first update-end after a media segment -- [ ] Bug 2: no update/update-end without an outstanding append/removal; C test: no signals while idle for 3 s -- [ ] Bug 3: msesrc exposes no streams (and stays HAVE_NOTHING) until every SourceBuffer of the attached +- [x] Bug 2: no update/update-end without an outstanding append/removal; C test: no signals while idle for 3 s +- [x] Bug 3: msesrc exposes no streams (and stays HAVE_NOTHING) until every SourceBuffer of the attached MediaSource has received its first init segment; C test with two SourceBuffers (audio fMP4 + video WebM), video init appended 2 s before audio, then both play -- [ ] Remove the settle work-around (`SETTLE`, `pending`) from `vendor/servo-media-gstreamer/mse.rs`; rebuild; +- [x] Remove the settle work-around (`SETTLE`, `pending`) from `vendor/servo-media-gstreamer/mse.rs`; rebuild; `tests/smoke/mse.txt` green -- [ ] Add a two-SourceBuffer case to `tests/smoke/pages/mse-basic.html` (`?split`: audio-only + video-only clips, +- [x] Add a two-SourceBuffer case to `tests/smoke/pages/mse-basic.html` (`?split`: audio-only + video-only clips, video appended first); smoke asserts it plays -- [ ] YouTube probe (heavy-web.txt watch-page steps): record codecs, readyState, currentTime, picture in the shot -- [ ] Write the patches up for upstream (`docs/engine/gst-mse-patches.md`: what, why, test), no MR opened +- [x] YouTube probe (heavy-web.txt watch-page steps): record codecs, readyState, currentTime, picture in the shot +- [x] Write the patches up for upstream (`docs/engine/gst-mse-patches.md`: what, why, test), no MR opened without the user's OK -- [ ] PROGRESS entry, DECISIONS if the loading scheme binds S030, INDEX line, commit `S026: …` on the branch, push the branch +- [x] PROGRESS entry, DECISIONS if the loading scheme binds S030, INDEX line, commit `S026: …` on the branch, push the branch ## End criteria - `tools/gst-mse.sh` builds; the C tests for bugs 1–3 pass (command in the plan's PROGRESS entry). diff --git a/Plans/INDEX.md b/Plans/INDEX.md index 2ec6d95..f7895b6 100644 --- a/Plans/INDEX.md +++ b/Plans/INDEX.md @@ -14,7 +14,7 @@ Tracker: https://claude.ai/artifact/9AD7fPfwJ4ASFzVTJGKU4h - [x] [S005 — Per-tab painters on one GL context](02%20Verify/S005-gl-painters.md) · Opus high - [x] [S006 — Browser basics pass](02%20Verify/S006-verify-basics.md) · Opus medium - [x] [S007 — Network pass](02%20Verify/S007-verify-network.md) · Opus medium -- [ ] [S008 — Stores and pages pass](02%20Verify/S008-verify-stores.md) · Sonnet high +- [x] [S008 — Stores and pages pass](02%20Verify/S008-verify-stores.md) · Sonnet high - [ ] [S009 — Integrations pass](02%20Verify/S009-verify-integrations.md) · Sonnet high - [ ] [S010 — Phase 2 review with the user](02%20Verify/S010-phase2-review.md) · Sonnet medium · 🧑 @@ -35,7 +35,7 @@ Tracker: https://claude.ai/artifact/9AD7fPfwJ4ASFzVTJGKU4h ## 05 Engine - [x] [S022 — MediaSource (MSE) spike](05%20Engine/S022-mse-spike.md) · Opus high · 🧑 -- [ ] [S026 — Fix gst_mse for split audio/video MSE](05%20Engine/S026-gst-mse-fixes.md) · Opus high +- [x] [S026 — Fix gst_mse for split audio/video MSE](05%20Engine/S026-gst-mse-fixes.md) · Opus high - [ ] [S027 — MSE DOM to spec](05%20Engine/S027-mse-dom-spec.md) · Opus high - [ ] [S028 — MSE player integration and merge to main](05%20Engine/S028-mse-player.md) · Opus high - [ ] [S029 — YouTube and Reddit video pass](05%20Engine/S029-youtube-reddit-pass.md) · Opus high · 🧑 diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md index 1c6fcf3..ac8bc73 100644 --- a/docs/DECISIONS.md +++ b/docs/DECISIONS.md @@ -18,3 +18,4 @@ - D-013 — 2026-11-12 — New plans: S022 MSE spike (05 Engine) runs right after S006; privacy plans S023 (request headers + third-party cookies in the vendored servo-net), S024 (privacy mode, R1-16), S025 (encrypted cookies, R1-19) run after S009, before the S010 review. — The user wants real YouTube playback in the page (no yt-dlp workaround) and asked whether missing Servo features can be added from reference engines; the spike sizes MSE before committing weeks to it. — S006–S025 run order - D-014 — 2026-11-12 — Two more Nacre patches in the vendored servo-net (D-012), marked "Nacre patch": `fetch/methods.rs` lets the certificate warning's `chrome:allowcert` request through (it ended as UnsupportedScheme, so "Open anyway" never worked); `http_cache.rs` `flush_to_disk` + `resource_thread.rs` Exit write the memory HTTP cache to the disk cache at quit (Servo only wrote evicted entries, so a session's cache was lost). — Both are Servo 0.7 bugs the embedder can't work around. — any plan that upgrades Servo: re-check both, re-run `tests/smoke/net-privacy.txt` and `cache.txt` + `cache-restart.txt` - D-015 — 2026-11-12 — MSE: go, option A (S022). Keep GStreamer's gst_mse library for parsing and coded frame processing; Nacre fixes its three 1.28.9 defects (early update-end, idle ticks, split A/V init segments) in its own copy of the library and plugin, plus a thin MSE DOM in the vendored `servo-script`/`servo-script-bindings`/`servo-media*` crates (`[patch.crates-io]`, like D-012). Option B (an own MSE core in Rust feeding appsrc) is the fallback only if bug 3 can't be fixed in msesrc. Plans S026–S030 run after S009 and before S023–S025. The prototype branch `s022-mse-proto` carries S026–S027 and merges into main in S028. — Decided by the orchestrator overnight on the user's standing OK; the user wants engine fixes, not workarounds (no yt-dlp). The spike showed gst_mse does the hard parts, and the blockers are concrete (docs/engine/mse-spike.md). — S026–S030, any Servo upgrade (drop the patches when Servo ships MSE) +- D-016 — 2026-11-12 — Patched gst_mse loading (S026). Nacre ships its own `libgstmse-1.0.so.0` and `mse` plugin built from `vendor/gst-mse` (`tools/gst-mse.sh`). Release layout: library in `/lib/`, plugin in `/lib/gstreamer-1.0/`; a dev build uses `target/gst-mse/{lib,gstreamer-1.0}`. The binary's RUNPATH (`$ORIGIN/lib:$ORIGIN/../gst-mse/lib`, from `build.rs`) finds the library ahead of the system copy (same soname), and `main.rs` prepends the plugin dir to `GST_PLUGIN_PATH` before GStreamer starts (paths in GST_PLUGIN_PATH beat the system plugin of the same name). Windows: the DLLs sit next to `nacre.exe` / in `lib\gstreamer-1.0` (unverified). — RUNPATH needs no wrapper script or re-exec; LD_LIBRARY_PATH would have to be set before the process starts. — S030 packaging (AppImage, tarball, Windows), S028 merge diff --git a/docs/FEATURES.md b/docs/FEATURES.md index 5acffa4..d34e47f 100644 --- a/docs/FEATURES.md +++ b/docs/FEATURES.md @@ -12,7 +12,7 @@ Every item of the settings screenshot and of the original Nacre's `config.py`, w | Address bar: URL or search, suggestions (history, bookmarks, tabs, pages, engine), Alt+Enter new tab | `ui/chrome.rs`, `util::address_to_url` | verified S006 (URL, search: basics.txt; suggestions: chrome.txt); Alt+Enter not checked | | Back/forward (with history list), reload, hard reload, home | `actions.rs` | verified S006 (back, forward, reload, hard reload, home: basics.txt, keys.txt); history list not checked; "stop" has no Servo API | | Find in page (count, next/previous, match case) | `inject.rs` FIND_JS, `ui/dialogs.rs` | verified S006 (count, next, previous: basics.txt, keys.txt); match case not checked | -| Zoom per site, Ctrl+wheel | `actions.rs`, settings `web.zoom_sites` | verified S006 (in, out, reset: basics.txt, keys.txt); per site and Ctrl+wheel not checked | +| Zoom per site, Ctrl+wheel | `actions.rs`, settings `web.zoom_sites` | verified S006 (in, out, reset: basics.txt, keys.txt), S008 (per site: saved, back after a restart, applied to a new tab: site-memory*.txt; the tab's zoom now follows the site's value, was stale on new tabs); Ctrl+wheel not checked | | Full screen (F11 and page fullscreen) | `app.rs` | verified S006 (basics.txt: F11, page request, Escape leaves) | | Context menu (links, images, media, selection, spelling, page) | `ui/menus.rs` | verified S006 (page menu: input.txt rclick); link/image/media/selection/spelling menus not checked | | Page dialogs: alert/confirm/prompt, HTTP sign-in, select, colour, file picker, leave page | `ui/dialogs.rs`, `app.rs` | verified S006 (alert, confirm, prompt, select, colour: dialogs.txt); HTTP sign-in, file picker, leave page not checked | @@ -26,7 +26,7 @@ Every item of the settings screenshot and of the original Nacre's `config.py`, w | Task manager, free up memory | `ui/pages/misc.rs` | verified S006 (task manager opens: keys.txt); free memory not checked | | Keyboard shortcuts, rebindable | `keys.rs`, settings | verified S006 (every action by `do` in basics.txt + keys.txt except save page, print, incognito, quit; key parsing unit test); rebinding not checked | | Gamepads (W3C standard mapping), Web Bluetooth device picker | `app.rs poll_gamepads`, `ui/dialogs.rs` | not checked in S006 (no device in tests); rumble reports unsupported | -| Notifications (notify-send or in-app) | `app.rs` | not checked in S006 | +| Notifications (notify-send or in-app) | `app.rs` | permission asked, remembered, denied/granted to the page verified S008 (site-memory*.txt); showing the notification itself (notify-send) not checked | ## General (screenshot) | Setting | State | @@ -38,11 +38,18 @@ Every item of the settings screenshot and of the original Nacre's `config.py`, w | Profiles (list, add, delete, open) | written | | Spell check (languages, dictionaries downloaded, suggestions, add word) | written (`spell.rs`, SPELL_JS) | | Keyboard shortcuts | written | -| Import from another browser (Chromium/Firefox families; bookmarks file; passwords CSV) | written (`importer.rs`) | +| Import from another browser (Chromium/Firefox families; bookmarks file; passwords CSV) | verified S008 (stores-import.txt on fake Chrome + Firefox profiles in a throwaway home: bookmarks, folders, history, home page, search engine; bookmarks HTML and passwords CSV: stores-lists.txt, stores-vault.txt through the store, not the file dialog); no importer for the old Python Nacre's JSON stores; Windows paths not checked | | New tab shortcuts and page elements, backgrounds, weather, notes | written (`ui/pages/newtab.rs`) | | Custom title bar | written (restart) | | Floating content card | written | +**Stores and pages (S008):** every nacre:// page opens with a non-blank shot (stores-pages.txt + tools/check-shots.py). History +(visits recorded, page lists them, back after a restart), bookmarks (add, folder, bar, Netscape HTML export/import through the +store, page, back after a restart), downloads page lists a finished file (stores-lists*.txt). Settings changed with `set` apply +and reach settings.json (stores-settings.txt: default zoom, vault off/on, theme, search engine, home page, bookmarks bar) and +tapped controls write settings (settings-write.txt, tap position fixed after the privacy page grew). Not checked: the native +file dialogs behind Import/Export, history delete/search from the page, bookmark drag and edit, downloads clear. + ## Appearance Colour source (website/system/palette/custom), fallback, palette swatches, mode, scheme style and contrast, motion, roundness, websites light/dark, force dark, interface size: written (`theme.rs`, settings page). The Material You look @@ -75,13 +82,13 @@ written. | Privacy mode (+ in incognito) | written (PRIVACY_JS) | | Secure DNS (Cloudflare, Quad9, Google, Mullvad, AdGuard, custom) | verified S007 with a custom endpoint on a local stub (net-privacy.txt: names only the stub knows load); the public providers not contacted in tests | | HTTPS-only mode with fallback prompt and exceptions | verified S007 (net-privacy.txt: upgrade via the `location.replace()` page, certificate warning "Open anyway" (fixed: servo-net patch), fallback prompt + Open anyway, site stays http this session, local addresses never upgraded); "Always for this site" not tapped | -| Site settings (defaults and per-site) | written | +| Site settings (defaults and per-site) | verified S008 (site-memory*.txt, restart): stored per site, applied again after a restart. Enforced: pop-ups, notifications, images (hub blocks image requests), sound (tab muted on load), Servo's own requests, open-other-apps. Shown as "Not available" (Servo 0.7): location (navigator.geolocation never answers), camera, microphone, device list (no navigator.mediaDevices), persistent storage (no navigator.storage), clipboard, JavaScript. Per-site privacy-mode flag does not exist (privacy mode is global; S024) | | Delete browsing data (+ on exit) | written | | Send Do Not Track and GPC | partial: JS only (no headers in Servo 0.7) | | Remove tracking parameters | verified S007 (net-privacy.txt: utm_*/fbclid removed, other parameters kept, off keeps all) | | Block third-party cookies | engine limit, shown as unavailable | | Google sign-in quirk | written (UA switch + JS) | -| Sites where ad blocking is paused | written | +| Sites where ad blocking is paused | verified S007 (net-adblock.txt), persisted S008 (site-memory*.txt) | | Remote debugging, user agent | written | ## Ad blocker @@ -114,11 +121,11 @@ limit, shown as unavailable. ## Passwords and autofill Encrypted vault (device key or master password, auto-lock, re-ask before showing), save prompt, autofill, strong password suggestion, addresses and cards, CSV import/export, generator, weak/reused check: written -(`store/vault.rs`, AUTOFILL_JS, `ui/pages/passwords.rs`). +(`store/vault.rs`, AUTOFILL_JS, `ui/pages/passwords.rs`). Verified S008 (stores-vault.txt + stores-vault-check.sh): save prompt from a local form, autofill of the one saved login, master password (key file removed, wrong password refused, lock empties the vault, no autofill while locked), unlock, CSV export, CSV import (own and Chrome format, duplicates and bad rows skipped), vault.json holds no plain text and is mode 600. Not checked: addresses, cards, generator, weak/reused list, auto-lock timer, re-ask before reveal, the strong password suggestion dropdown. ## Apps Install site as app (own window, launcher entry), desktop shortcut, user scripts and styles (stand-in for extensions): -written. +verified S008 (stores-apps.txt): .user.js and .user.css installed by address run on matching pages and not on others; install as app writes the launcher entry and the app opens its own window. Not checked: desktop shortcut, uninstall, editing a script, disable toggle, @exclude, run-at start/idle. ## About Version, engine, colour, profile paths, update repository, automatic and manual update check: written diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md index 11f517d..009d185 100644 --- a/docs/HANDOFF.md +++ b/docs/HANDOFF.md @@ -75,3 +75,9 @@ For the next `/orchestrate` run. Read this before picking the "first unchecked p the former spare local_373e46d7-2d38-4d5a-94c4-855dae433f88. S027–S030 have no session yet: reuse an idle finished session (r1-11 local_48b023e1-…, r1-10 local_3487b672-…, r1-flyouts local_fbdfe092-…, r1-21 local_4d846ded-…, s021 local_3e6a6b37-…, s022 local_7fddd5dd-…) by message, or start fresh ones when the user is back. +- Update (after the usage-limit reset): S008, S026 done and validated (site-memory restart smoke p1/p2 pass; mse.txt + split A/V plays on branch s022-mse-proto). S009 running on main (local_28f452cc-…). S027 running in the worktree + (local_c15ace99-33b1-45b0-8fb6-bfb77cca68ce). Waiting for GO: S028 local_c57574e1-48d8-40b4-9a0c-386b7079f666, + S029 local_b1da3720-150b-45f9-8689-684e25ef97af, S030 local_dea5e96f-16c8-4e0a-a13d-5105f2fa5c98, S023/S024/S025 (ids + above). Spares: spare-a local_373e46d7-… (did S026), spare-b local_4fb2df64-5994-4b0d-a834-cff2859cf94b. + Order: S009 ∥ S027 → S028 (merges the branch to main) → S029 → S030 → S023 → S024 → S025 → S010 (🧑). diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md index 7121117..ab2681c 100644 --- a/docs/PROGRESS.md +++ b/docs/PROGRESS.md @@ -265,6 +265,22 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done, - Not done: Windows runtime not tried in the VM (sizes from the release index only); seeking and quality switches untested. - Later: Servo refuses fetch/XHR of file:// from file:// pages (smoke clips are base64 scripts); the selftest `js` probe can hang when the script thread blocks (seen once on YouTube). +## S008 — Stores and pages pass (2026-11-12) +- New (offline; `python3 -m http.server 8768 --bind 127.0.0.1 --directory tests/smoke/pages &` and `python3 tests/smoke/net/server.py &` first): `stores-pages.txt` + `tools/check-shots.py` (17 pages, none blank), `stores-vault.txt` + `-check.sh`, `stores-lists.txt` + `-restart.txt`, `stores-apps.txt`, `stores-import.txt` (+ `make-import-home.py`), `stores-settings.txt` + `-check.sh`, `site-memory.txt` + `-restart.txt` (R1-20). Selftest: `perm`, `prompt`, `vault`, `bookmarks`, `cmd import|install_script|open_app`, status `permissions`, `site_state`, `scripts`, `vault_mode`, `bookmark_folders`. +- Fixed (R1-20): Images permission did nothing (hub now blocks image requests per site); Sound block did nothing (tab muted on load); menu/page permission edits reached permissions.json only at exit (now saved at once and the hub refreshed); a new tab showed 100 % zoom for a site with saved zoom (tab.zoom stale); settings-write.txt privacy tap moved with the page layout. +- Shown "Not available" (Servo 0.7, `Kind::engine_limit`): location, camera, microphone, device list, persistent storage, clipboard, JavaScript. +- Green: all new scripts, launch, restore, 61 unit tests. site-memory restart failed 3 times in a row once under heavy machine load (image still loaded at the first check), passed 8 times after; cause not found. +- Not done: per-site privacy-mode flag (privacy mode is global, S024); importer for the old Python Nacre's JSON stores (none exists); native file dialogs behind Import/Export; addresses, cards, generator, auto-lock timer; notification display; user-script disable/edit/exclude. +- Later: tab titles of nacre:// pages show a generic icon; selftest `set` with a bad value only logs (does not fail the run). + +## S026 — gst_mse fixes for split audio/video MSE (2026-11-12, branch s022-mse-proto) +- Our gst_mse 1.28.9 copy in `vendor/gst-mse/` (LGPL, `nacre.patch`, write-up `docs/engine/gst-mse-patches.md`); `tools/gst-mse.sh` builds it into `target/gst-mse/`. Nacre finds the library by RUNPATH (`build.rs`) and the plugin by GST_PLUGIN_PATH (`src/main.rs`), and logs both paths (D-016). +- Fixed: update-end before parsing (append now waits for its end-of-append), idle update/update-end ticks, streams exposed before every SourceBuffer's init segment (plus a leaked `media_source_lock`), msesrc pad task giving up on a not-yet-active peer (split A/V hung ~1 in 4). Settle work-around gone from `mse.rs`; `remove()` reports its own updateend (gst_mse's remove is a stub). Opus counts as supported with a decoder only (Arch has no opusparse). +- Tests: `tools/gst-mse.sh test` (3 C tests, each fails on the system 1.28.9); `tools/smoke.sh tests/smoke/mse.txt` green incl. `?split` (video WebM first, audio fMP4 2 s later, picture shown). +- YouTube (`tests/smoke/youtube-mse.txt`, internet): plays with picture and captions. Run 1 VP9 144p + Opus, time 8 → 10.7 s between 15 and 30 s (stalls); run 2 VP9 240p + Opus, played to the end ("Up next"); the js probe after the end never returned. +- Not done: YouTube stalls and the hung js probe not investigated (S027/S028); the pad-task race only shows in the C test under CPU load. +- Later (S027/S028): coded frame removal in gst_mse (`remove` is a stub); `HTMLMediaElement.buffered` from the MediaSource; script thread blocking (S022 note) seen again after the video ended. + ## Later - Turnstile widget paints as a black half-disc (Servo painting of its iframe/shadow DOM, S006 site doctor). - Google sign-in past the email step: press Next with a real account, by the user (S006). diff --git a/docs/review/phase1.md b/docs/review/phase1.md index 857b227..14ad50b 100644 --- a/docs/review/phase1.md +++ b/docs/review/phase1.md @@ -47,5 +47,5 @@ State tags: `[open]`, `[fixed ]`, `[wontfix: reason]`. Severity: high / - R1-17 [fixed 7e6c701] QR flyout looks broken: the code sits at the top of a tall, empty panel (`docs/ui-reference/bug-qr-flyout.png`). Size the panel to its content. Severity: medium. (user) → chrome follow-up. - R1-18 [fixed 7e6c701] Flyouts must be friendly and polished like the old browser's passwords, downloads and history flyouts the user likes (`docs/ui-reference/old-flyout-*.png`: title + action icons, sections with accent labels, rows with icon/title/subtitle/time, search pill, clear empty states). Review every flyout and page with the `app-taste` and `unslop` skills; "everything should be user friendly". Severity: medium. (user) → chrome follow-up + S021 review. - R1-19 [open] Protect cookies against theft (infostealers copying the profile to hijack sessions). Idea to verify: Servo's `Opts.config_dir` persists cookies as plain files, and `site_data_manager()` has `cookies_for_url` / `set_cookie_for_url` / `clear_cookies` (DESIGN.md). So Nacre could run Servo with temporary storage and keep cookies itself, encrypted at rest with a key held in the OS keyring (Secret Service/KWallet on Linux, DPAPI on Windows), restoring them at start; plus "clear cookies on close" (setting exists) and, in privacy mode, best-effort removal of third-party cookies through the site data manager. General rule from the user: where Servo can't do something properly, Nacre may add its own layer (inject.rs scripts, site data manager, bridge) instead of only showing an engine limit; record each in DESIGN.md. Severity: high. (user) → with R1-16 (privacy plan). -- R1-20 [open] Per-site memory must persist and work: zoom/page size, ad blocker on/off per site, privacy mode and other per-site choices are saved, survive a restart, and apply again when the site is opened; site permissions (camera, microphone, location, notifications, pop-ups, autoplay, ...) are really enforced per site, not just stored. Verify with a restart test in a smoke script (set per-site values, quit, relaunch with SMOKE_HOME, check they apply). Severity: high. (user) → S008 (stores and pages pass). +- R1-20 [fixed S008] Per-site memory must persist and work: zoom/page size, ad blocker on/off per site, privacy mode and other per-site choices are saved, survive a restart, and apply again when the site is opened; site permissions (camera, microphone, location, notifications, pop-ups, autoplay, ...) are really enforced per site, not just stored. Verify with a restart test in a smoke script (set per-site values, quit, relaunch with SMOKE_HOME, check they apply). Severity: high. (user) → S008 (stores and pages pass). - R1-21 [fixed 8049f6a] Interacting with nacre:// pages feels buggy and not clean. Example: a size (zoom/scale) slider applies its value while you drag, which re-lays out the page under the pointer, so the slider jumps and is hard to set. Sliders that change layout should preview without moving the control and commit on release; check every page's controls for this kind of jitter. Recording: `~/Videos/Recordings/recording_20261112_01-00-39.mp4` (watch it first). Severity: high. (user) → chrome/pages follow-up before S021. diff --git a/src/actions.rs b/src/actions.rs index 4cf3222..679b6c3 100644 --- a/src/actions.rs +++ b/src/actions.rs @@ -2088,7 +2088,7 @@ impl App { && let Some(tab) = win.tab() && tab.page.is_none() && let Ok(url) = Url::parse(&tab.url) - && let Some(act) = crate::discord::browse_activity(&settings, &url, &tab.title, &tab.site_name, if tab.page_image.is_empty() { &tab.favicon_url } else { &tab.page_image }, tab.arrived_ms as i64) + && let Some(act) = crate::discord::browse_activity(&settings, &url, &tab.title, &tab.site_name, &tab.page_image, &tab.favicon_url, tab.arrived_ms as i64) { activity = Some((act, settings.client_id.clone())); } @@ -2422,6 +2422,12 @@ impl App { /// The UI edits settings in place; this notices and applies what changed. pub fn apply_settings_if_changed(&mut self) { + let revision = self.shared.permissions.borrow().revision(); + if revision != self.permissions_seen { + self.permissions_seen = revision; + self.shared.permissions.borrow_mut().flush(); + self.refresh_hub_config(); + } let current = self.shared.settings.borrow().clone(); if current == self.applied { return; diff --git a/src/app.rs b/src/app.rs index 1abc2c1..9d3e3f6 100644 --- a/src/app.rs +++ b/src/app.rs @@ -182,6 +182,8 @@ pub struct App { pub gilrs: Option, pub gamepads: HashMap, pub applied: Settings, + /// `Permissions::revision` the hub and the file were last updated for. + pub permissions_seen: u64, pub exiting: bool, last_tick: Instant, last_save: Instant, @@ -307,6 +309,7 @@ impl App { gilrs: None, gamepads: HashMap::new(), applied: settings, + permissions_seen: 0, exiting: false, last_tick: Instant::now(), last_save: Instant::now(), @@ -392,7 +395,7 @@ impl App { pub fn refresh_hub_config(&self) { let settings = self.shared.settings.borrow(); - *self.hub.config.borrow_mut() = HubConfig::from_settings(&settings, &self.shared.user_agent.borrow(), self.shared.http_allowed.borrow().clone()); + *self.hub.config.borrow_mut() = HubConfig::from_settings(&settings, &self.shared.permissions.borrow(), &self.shared.user_agent.borrow(), self.shared.http_allowed.borrow().clone()); } /// (Re)build the scripts every page gets. Applies on each page's next load. @@ -540,13 +543,16 @@ impl App { } } self.check_app_scope(window, id, &url); - if host_changed { - let zoom = self.shared.settings.borrow().zoom_for(&util::host_of(&url)); - if let Some(tab) = self.tab_mut(id) { - tab.zoom = zoom; - if let Some(web) = &tab.web { - web.webview.set_page_zoom(zoom); - } + // A zoom change is saved for the site at once, so the site's value is always the right one. Not only + // when the host changed: a new tab already holds its address when the first event arrives. + let zoom = self.shared.settings.borrow().zoom_for(&util::host_of(&url)); + if let Some(tab) = self.tab_mut(id) { + let differs = (tab.zoom - zoom).abs() > 0.001; + tab.zoom = zoom; + if (host_changed || differs) + && let Some(web) = &tab.web + { + web.webview.set_page_zoom(zoom); } } self.redraw(window); @@ -810,7 +816,7 @@ impl App { } // Mute state survives navigation. let shared = self.shared.clone(); - let muted = self.tab_mut(id).map(|t| t.muted || shared.settings.borrow().site_muted(&util::host_of_str(&t.url))).unwrap_or(false); + let muted = self.tab_mut(id).map(|t| t.muted || shared.settings.borrow().site_muted(&util::host_of_str(&t.url)) || shared.permissions.borrow().answer(&shared.settings.borrow(), &util::host_of_str(&t.url), crate::store::permissions::Kind::Sound) == crate::store::permissions::Answer::Block).unwrap_or(false); if muted && let Some(tab) = self.tab_mut(id) { tab.muted = true; if let Some(web) = &tab.web { diff --git a/src/discord.rs b/src/discord.rs index 1bc7d97..1691799 100644 --- a/src/discord.rs +++ b/src/discord.rs @@ -111,6 +111,19 @@ fn https_short(url: &str) -> bool { url.starts_with("https://") && url.len() <= 256 } +/// Image for the activity's large icon: the first of `images` Discord can fetch (short https URL), +/// else the page origin's /favicon.ico (data:/http:/long favicon URLs are unusable; no third-party +/// service, so no visited host leaks beyond Discord). Empty for pages without a host. +fn icon_url(images: &[&str], page: &Url) -> String { + if let Some(img) = images.iter().find(|i| https_short(i)) { + return (*img).to_owned(); + } + match page.host_str() { + Some(host) if matches!(page.scheme(), "http" | "https") => format!("https://{host}/favicon.ico"), + _ => String::new(), + } +} + /// Options that Discord clients may refuse; the worker turns them off when it is told so. #[derive(Clone, Copy, Debug)] pub struct Quirks { @@ -137,7 +150,7 @@ pub fn media_activity(settings: &Rpc, tab_url: &Url, tab_title: &str, favicon: & } } if !https_short(&art) { - art = if https_short(favicon) { favicon.to_owned() } else { String::new() }; + art = icon_url(&[favicon], tab_url); } let by = if creator != name { format!("by {creator}") } else { name.clone() }; let mut act = json!({ @@ -179,7 +192,7 @@ pub fn media_activity(settings: &Rpc, tab_url: &Url, tab_title: &str, favicon: & } /// "Browsing" activity for an ordinary tab. `since_ms` is when the user arrived on the page. -pub fn browse_activity(settings: &Rpc, url: &Url, title: &str, site_name: &str, image: &str, since_ms: i64) -> Option { +pub fn browse_activity(settings: &Rpc, url: &Url, title: &str, site_name: &str, image: &str, favicon: &str, since_ms: i64) -> Option { if settings.browsing == RpcBrowsing::Off || !matches!(url.scheme(), "http" | "https") { return None; } @@ -199,8 +212,9 @@ pub fn browse_activity(settings: &Rpc, url: &Url, title: &str, site_name: &str, "timestamps": {"start": since_ms}, "assets": {"large_text": clip(&host, 128)}, }); - if https_short(image) { - act["assets"]["large_image"] = json!(image); + let icon = icon_url(&[image, favicon], url); + if !icon.is_empty() { + act["assets"]["large_image"] = json!(icon); } if by_title && settings.button { act["buttons"] = json!([{"label": util::ellipsize(&format!("Open on {site}"), 32), "url": util::ellipsize(url.as_str(), 512)}]); @@ -469,3 +483,18 @@ fn worker(rx: Receiver, status: Arc>, wake: Arc, pub strip_params: bool, pub google_signin: bool, + /// Images permission: blocked unless a site says otherwise, and the sites that differ (host, blocked). + pub images_block_default: bool, + pub images_sites: Vec<(String, bool)>, pub user_agent: String, /// Tabs where the user chose "open over http anyway" this session (host). pub http_allowed: Vec, } impl HubConfig { - pub fn from_settings(settings: &Settings, user_agent: &str, http_allowed: Vec) -> HubConfig { + /// Whether pictures are blocked on pages of this host. + pub fn images_blocked(&self, host: &str) -> bool { + self.images_sites.iter().find(|(h, _)| h == host).map(|(_, block)| *block).unwrap_or(self.images_block_default) + } + + pub fn from_settings(settings: &Settings, permissions: &Permissions, user_agent: &str, http_allowed: Vec) -> HubConfig { HubConfig { adblock_enabled: settings.adblock.enabled, adblock_allow: settings.adblock.allow.clone(), @@ -87,6 +96,8 @@ impl HubConfig { https_exceptions: settings.privacy.https_exceptions.clone(), strip_params: settings.privacy.strip_params, google_signin: settings.privacy.google_signin, + images_block_default: permissions.answer(settings, "", Kind::Images) == Answer::Block, + images_sites: permissions.all().into_iter().filter(|(_, kind, _)| *kind == Kind::Images).map(|(host, _, decision)| (host, decision == Decision::Block)).collect(), user_agent: user_agent.to_owned(), http_allowed, } @@ -245,9 +256,14 @@ impl Hub { return; } - // Sub-resources: the ad blocker. + // Sub-resources: the Images permission, then the ad blocker. let page_url = page.as_ref().map(Url::as_str).unwrap_or(""); let page_host = util::host_of_str(page_url); + if kind == "image" && matches!(url.scheme(), "http" | "https") && !page_host.is_empty() && config.images_blocked(&page_host) { + drop(config); + load.intercept(WebResourceResponse::new(url).status_code(StatusCode::NO_CONTENT)).cancel(); + return; + } let paused = !config.adblock_enabled || config.adblock_allow.iter().any(|h| util::host_matches(&page_host, h)); drop(config); if !paused && matches!(url.scheme(), "http" | "https" | "ws" | "wss") { @@ -403,6 +419,20 @@ impl servo::GamepadDelegate for Gamepads { mod tests { use super::*; + #[test] + fn images_follow_the_site_answer_then_the_default() { + let mut settings = Settings::default(); + let mut permissions = Permissions::load(std::path::PathBuf::from("/nonexistent/permissions.json"), true); + assert!(!HubConfig::from_settings(&settings, &permissions, "", Vec::new()).images_blocked("a.example")); + permissions.set("a.example", Kind::Images, Some(Decision::Block)); + let config = HubConfig::from_settings(&settings, &permissions, "", Vec::new()); + assert!(config.images_blocked("a.example") && !config.images_blocked("b.example")); + settings.privacy.permission_defaults.insert("images".into(), crate::store::settings::PermissionDefault::Block); + permissions.set("b.example", Kind::Images, Some(Decision::Allow)); + let config = HubConfig::from_settings(&settings, &permissions, "", Vec::new()); + assert!(config.images_blocked("a.example") && config.images_blocked("c.example") && !config.images_blocked("b.example")); + } + #[test] fn strips_tracking() { let u = Url::parse("https://a.example/p?id=3&utm_source=x&fbclid=y").unwrap(); diff --git a/src/selftest.rs b/src/selftest.rs index 0ec2e71..af794e4 100644 --- a/src/selftest.rs +++ b/src/selftest.rs @@ -10,6 +10,10 @@ //! resize resize the window (logical pixels) //! status save tabs, downloads, VPN, ad blocker and so on as .json //! set change a setting, e.g. `set /privacy/https_only true` +//! perm allow|block|default store a site's answer for a permission (kinds: store::permissions::Kind keys) +//! prompt allow|deny [remember] answer the active tab's first permission prompt +//! vault master | lock | unlock | remove_master | export | import the password vault +//! bookmarks folder | export | import a folder on the bar; the Netscape HTML file (what the page's buttons do) //! flyout main, downloads, shield, vpn, media, siteinfo, profiles, apps, qr, tabmenu, back, //! bookmark (edit the current page's bookmark), none //! type put text in the address bar with its suggestions open @@ -20,6 +24,8 @@ //! cmd [arg] back, forward, reload, bookmark, install_app, pip, exitpip, free_memory, //! update_lists, check_updates, close_tab, select , zoom , //! find , download , pause_download|resume_download|cancel_download [id] (newest), +//! import (bookmarks, history, settings from the n-th found browser profile), +//! install_script (a .user.js / .user.css), open_app [id] (default: the first installed app), //! navigate , mute, pin //! js diff --git a/tests/smoke/pages/vault-import.csv b/tests/smoke/pages/vault-import.csv new file mode 100644 index 0000000..3f1298c --- /dev/null +++ b/tests/smoke/pages/vault-import.csv @@ -0,0 +1,4 @@ +name,url,username,password,note +shop,https://shop.example/login,bob,Tr0ub4dor&3,first +mail,https://mail.example/,carol,correct horse battery, +bad,not a url,dave,x, diff --git a/tests/smoke/settings-write.txt b/tests/smoke/settings-write.txt index 182183d..02a137e 100644 --- a/tests/smoke/settings-write.txt +++ b/tests/smoke/settings-write.txt @@ -12,7 +12,7 @@ wait 0.5 shot write-general page nacre://settings/privacy wait 1 -tap 1110 592 +tap 1110 636 wait 0.5 shot write-privacy page nacre://settings/passwords diff --git a/tests/smoke/site-memory-restart.txt b/tests/smoke/site-memory-restart.txt new file mode 100644 index 0000000..4594039 --- /dev/null +++ b/tests/smoke/site-memory-restart.txt @@ -0,0 +1,68 @@ +# Per-site memory and permissions (S008, R1-20), part 2: run on part 1's home (SMOKE_HOME=/home). +# Everything set in part 1 is still stored, and applies again when the site is opened. +wait 3 +status stored +expect /permissions/127.0.0.1/notifications block +expect /permissions/127.0.0.1/popups block +expect /permissions/127.0.0.1/images block +expect /permissions/127.0.0.1/sound block +expect /site_state/adblock_allow/0 "127.0.0.1" +expect /site_state/keep_active/0 "127.0.0.1" +expect /site_state/muted_sites/0 "127.0.0.1" +expect /site_state/https_exceptions/0 "127.0.0.1" +expect /site_state/zoom_sites/127.0.0.1 > 1 +# Open the site fresh: zoom, mute, images and permissions apply again; a blocked pop-up stays blocked. +newtab http://127.0.0.1:8768/site.html +waitfor 20 window.res && window.res.img !== undefined +assert res.img === 'blocked' +wait 2 +status opened +expect /active/zoom > 1 +expect /active/muted true +js notif() +waitfor 10 res.notif === 'denied' +js pop() +wait 2 +status checked +expect /tab_count 2 +expect /active/prompts 1 +# That one prompt is the 'pop-up blocked' notice; dismiss it. +prompt deny +# Prompt answers: allow + remember is stored; deny without remember is not (it asks again after a reload). +perm 127.0.0.1 notifications default +cmd reload +waitload +waitfor 20 window.res && window.res.img !== undefined +js notif() +wait 3 +status ask-again +expect /active/prompts 1 +prompt allow remember +waitfor 10 res.notif === 'granted' +status allowed +expect /permissions/127.0.0.1/notifications allow +perm 127.0.0.1 notifications default +cmd reload +waitload +waitfor 20 window.res && window.res.img !== undefined +js notif() +wait 3 +prompt deny +waitfor 10 res.notif === 'denied' +cmd reload +waitload +waitfor 20 window.res && window.res.img !== undefined +js notif() +wait 3 +status asked-third +expect /active/prompts 1 +prompt deny remember +# Reset the images answer: the picture loads again, and the change is stored. +perm 127.0.0.1 images default +cmd reload +waitload +waitfor 20 window.res && window.res.img !== undefined +assert res.img === 'loaded' +shot images-back +status done +quit diff --git a/tests/smoke/site-memory.txt b/tests/smoke/site-memory.txt new file mode 100644 index 0000000..5b1cd5b --- /dev/null +++ b/tests/smoke/site-memory.txt @@ -0,0 +1,62 @@ +# Per-site memory and permissions (S008, R1-20), part 1: set values, then quit. +# Part 2 (site-memory-restart.txt) runs on the same home and checks they came back and still apply. Offline. +# python3 -m http.server 8768 --bind 127.0.0.1 --directory tests/smoke/pages & +# tools/smoke.sh tests/smoke/site-memory.txt (hidden) +# SMOKE_HOME=/home tools/smoke.sh tests/smoke/site-memory-restart.txt +wait 3 +open http://127.0.0.1:8768/site.html +waitfor 20 window.res && window.res.img !== undefined +assert res.img === 'loaded' +# Notifications: asks first; deny + remember; the next ask is refused without a prompt. +js notif() +wait 3 +status ask +expect /active/prompts 1 +prompt deny remember +waitfor 10 res.notif === 'denied' +js notif() +waitfor 10 res.notif === 'denied' +status notif +expect /active/prompts 0 +expect /permissions/127.0.0.1/notifications block +# Pop-ups: a new tab by default, none once blocked. +js pop() +wait 2 +status popup-default +expect /tab_count 2 +cmd close_tab +cmd select 0 +perm 127.0.0.1 popups block +js pop() +wait 2 +status popup +expect /tab_count 1 +# Images blocked for the site: the picture doesn't load after a reload. +perm 127.0.0.1 images block +cmd reload +waitload +waitfor 20 window.res && window.res.img !== undefined +assert res.img === 'blocked' +shot images-blocked +# Sound blocked: the tab is muted on load. +perm 127.0.0.1 sound block +cmd reload +waitload +wait 2 +status sound +expect /active/muted true +# Other per-site choices: zoom, ad blocker off, keep active, mute, HTTPS exception. +cmd zoom 1 +cmd zoom 1 +set /adblock/allow ["127.0.0.1"] +set /perf/keep_active ["127.0.0.1"] +set /media/muted_sites ["127.0.0.1"] +set /privacy/https_exceptions ["127.0.0.1"] +wait 1 +status set +expect /active/zoom > 1 +expect /site_state/adblock_allow/0 "127.0.0.1" +expect /permissions/127.0.0.1/images block +expect /permissions/127.0.0.1/popups block +status done +quit diff --git a/tests/smoke/stores-apps.txt b/tests/smoke/stores-apps.txt new file mode 100644 index 0000000..e7d14b9 --- /dev/null +++ b/tests/smoke/stores-apps.txt @@ -0,0 +1,41 @@ +# Stores pass (S008): user scripts and styles run on matching pages only; install a site as an app and open its window. +# Offline. Start the servers first: +# python3 -m http.server 8768 --bind 127.0.0.1 --directory tests/smoke/pages & +# python3 tests/smoke/net/server.py & +# tools/smoke.sh tests/smoke/stores-apps.txt +wait 3 +cmd install_script http://127.0.0.1:8768/probe.user.js +cmd install_script http://127.0.0.1:8768/probe.user.css +wait 3 +status installed +expect /scripts 2 +# Matching page: both run. Non-matching page (other port): neither does. +open http://127.0.0.1:8768/hello.html +waitload +wait 2 +assert window.userScriptRan === true +assert getComputedStyle(document.body).backgroundColor === 'rgb(18, 52, 86)' +shot user-content-on +open http://127.0.0.1:8766/ +waitload +wait 2 +assert window.userScriptRan === undefined +assert getComputedStyle(document.body).backgroundColor !== 'rgb(18, 52, 86)' +# Install the page as an app, open its window. +open http://127.0.0.1:8768/hello.html +waitload +wait 2 +cmd install_app +wait 1 +status app +expect /apps 1 +cmd open_app +wait 4 +status app-window +expect /windows 2 +shot app-window +page nacre://apps +wait 1 +shot apps-page +status done +quit diff --git a/tests/smoke/stores-import.txt b/tests/smoke/stores-import.txt new file mode 100644 index 0000000..10a7de4 --- /dev/null +++ b/tests/smoke/stores-import.txt @@ -0,0 +1,28 @@ +# Stores pass (S008): the importer reads other browsers' profiles. A fake home (tests/smoke/make-import-home.py) holds a +# Chrome and a Firefox profile; Nacre finds both and imports bookmarks, history, home page and search engine. +# Offline. python3 tests/smoke/make-import-home.py target/smoke/import-home +# SMOKE_HOME=$PWD/target/smoke/import-home tools/smoke.sh tests/smoke/stores-import.txt +wait 3 +status found +expect /import_sources/0 "Google Chrome" +expect /import_sources/1 "Firefox" +cmd import 0 +wait 3 +status chrome +expect /bookmarks 4 +expect /bookmark_folders 2 +expect /history 2 +expect /home_url "https://home.chrome.example/" +expect /search_engine "bing" +page nacre://bookmarks +wait 1 +shot chrome-imported +cmd import 1 +wait 3 +status firefox +expect /bookmarks 6 +expect /history 4 +expect /home_url "https://home.firefox.example/" +expect /search_engine "duckduckgo" +status done +quit diff --git a/tests/smoke/stores-lists-restart.txt b/tests/smoke/stores-lists-restart.txt new file mode 100644 index 0000000..a87c445 --- /dev/null +++ b/tests/smoke/stores-lists-restart.txt @@ -0,0 +1,12 @@ +# Stores pass (S008), part 2: history, bookmarks and the finished download are still there after a restart. +wait 3 +status back +expect /history > 1 +expect /bookmarks 4 +expect /bookmark_folders 2 +expect /downloads/0/state "Done" +page nacre://bookmarks +wait 1 +shot bookmarks-restored +status done +quit diff --git a/tests/smoke/stores-lists.txt b/tests/smoke/stores-lists.txt new file mode 100644 index 0000000..078fd60 --- /dev/null +++ b/tests/smoke/stores-lists.txt @@ -0,0 +1,49 @@ +# Stores pass (S008): history, bookmarks (add, folder, bar, Netscape HTML export/import), downloads page, and that all +# of it is still there after a restart. Offline. Part 1 (hidden): +# python3 -m http.server 8768 --bind 127.0.0.1 --directory tests/smoke/pages & +# python3 tests/smoke/net/server.py & +# tools/smoke.sh tests/smoke/stores-lists.txt +# Part 2: SMOKE_HOME=/home tools/smoke.sh tests/smoke/stores-lists-restart.txt +wait 3 +resize 1280 900 +open http://127.0.0.1:8768/hello.html +waitload +open http://127.0.0.1:8768/site.html +waitload +status visits +expect /history > 1 +page nacre://history +wait 1 +shot history +# Bookmark the page, make a folder, show the bar. +open http://127.0.0.1:8768/site.html +waitload +cmd bookmark +wait 1 +flyout none +bookmarks folder Work +set /ui/bookmarks_bar "always" +wait 1 +status marked +expect /bookmarks 1 +expect /bookmark_folders 1 +shot bar +# Export, then import a file in another browser's layout: 1 on the bar + 2 in a folder, then again adds nothing. +bookmarks export @HOME@/bookmarks-export.html +bookmarks import @PAGESDIR@/chrome-bookmarks.html +bookmarks import @PAGESDIR@/chrome-bookmarks.html +status imported +expect /bookmarks 4 +page nacre://bookmarks +wait 1 +shot bookmarks +# Downloads: one finished file listed on the page. +cmd download http://127.0.0.1:8766/file.zip +wait 4 +status download +expect /downloads/0/state "Done" +page nacre://downloads +wait 1 +shot downloads +status done +quit diff --git a/tests/smoke/stores-pages.txt b/tests/smoke/stores-pages.txt new file mode 100644 index 0000000..dade89c --- /dev/null +++ b/tests/smoke/stores-pages.txt @@ -0,0 +1,58 @@ +# Stores pass (S008): every nacre:// page opens, nothing panics, nothing renders blank (tools/check-shots.py). +# Settings sections are covered by settings.txt. Offline. Hidden: tools/smoke.sh tests/smoke/stores-pages.txt +# then: python3 tools/check-shots.py +wait 3 +resize 1280 900 +page nacre://newtab +wait 1 +shot page-newtab +page nacre://settings +wait 1 +shot page-settings +page nacre://history +wait 1 +shot page-history +page nacre://bookmarks +wait 1 +shot page-bookmarks +page nacre://downloads +wait 1 +shot page-downloads +page nacre://passwords +wait 1 +shot page-passwords +page nacre://apps +wait 1 +shot page-apps +page nacre://site-settings +wait 1 +shot page-site-settings +page nacre://site-settings/example.com +wait 1 +shot page-site-settings-host +page nacre://clear-data +wait 1 +shot page-clear-data +page nacre://about +wait 1 +shot page-about +page nacre://welcome +wait 1 +shot page-welcome +page nacre://task-manager +wait 1 +shot page-task-manager +page nacre://devtools +wait 1 +shot page-devtools +page nacre://gallery +wait 1 +shot page-gallery +page nacre://source/@PAGES@/hello.html +wait 1 +shot page-source +open https://no-such-host.invalid/ +wait 4 +shot page-error +status done +quit diff --git a/tests/smoke/stores-settings-check.sh b/tests/smoke/stores-settings-check.sh new file mode 100755 index 0000000..5116ce8 --- /dev/null +++ b/tests/smoke/stores-settings-check.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# After tests/smoke/stores-settings.txt: the values are in settings.json. Usage: tests/smoke/stores-settings-check.sh +set -eu +file=$(ls "$1"/home/.config/nacre*/*/settings.json | head -1) +python3 - "$file" <<'PY' +import json, sys +d = json.load(open(sys.argv[1])) +want = [(d["theme"]["mode"], "light"), (d["startup"]["search_engine"], "bing"), (d["startup"]["home_url"], "http://127.0.0.1:8768/hello.html"), + (d["ui"]["bookmarks_bar"], "never"), (d["vault"]["enabled"], True), (d["web"]["zoom"], 1.0)] +bad = [(got, exp) for got, exp in want if got != exp] +print("settings.json ok" if not bad else f"FAIL: {bad}") +sys.exit(1 if bad else 0) +PY diff --git a/tests/smoke/stores-settings.txt b/tests/smoke/stores-settings.txt new file mode 100644 index 0000000..7a91fbf --- /dev/null +++ b/tests/smoke/stores-settings.txt @@ -0,0 +1,62 @@ +# Stores pass (S008): settings changed with `set` take effect and reach settings.json (see stores-settings-check.sh). +# python3 -m http.server 8768 --bind 127.0.0.1 --directory tests/smoke/pages & +# tools/smoke.sh tests/smoke/stores-settings.txt then tests/smoke/stores-settings-check.sh +wait 3 +# Default page zoom applies to a site with no zoom of its own. +set /web/zoom 1.5 +open http://127.0.0.1:8768/hello.html +waitload +wait 1 +status zoom +expect /active/zoom 1.5 +set /web/zoom 1.0 +# Password vault off: submitting a login form asks nothing; on again: it asks. +set /vault/enabled false +open http://127.0.0.1:8768/login.html +waitload +waitfor 10 document.getElementById('pass') !== null +locate #user +wait 1 +click @ +pagetype zoe +locate #pass +wait 1 +click @ +pagetype pw-for-zoe-1 +locate #go +wait 1 +click @ +wait 2 +status vault-off +expect /active/prompts 0 +set /vault/enabled true +open http://127.0.0.1:8768/login.html +waitload +waitfor 10 document.getElementById('pass') !== null +locate #user +wait 1 +click @ +pagetype zoe +locate #pass +wait 1 +click @ +pagetype pw-for-zoe-1 +locate #go +wait 1 +click @ +wait 2 +status vault-on +expect /active/prompts 1 +# Theme, search engine, home page: stored and applied. +set /theme/mode "dark" +set /startup/search_engine "bing" +set /startup/home_url "http://127.0.0.1:8768/hello.html" +set /ui/bookmarks_bar "never" +page nacre://settings/appearance +wait 1 +shot appearance-dark +set /theme/mode "light" +wait 1 +shot appearance-light +status done +quit diff --git a/tests/smoke/stores-vault-check.sh b/tests/smoke/stores-vault-check.sh new file mode 100755 index 0000000..49cc838 --- /dev/null +++ b/tests/smoke/stores-vault-check.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# After tests/smoke/stores-vault.txt: the vault file holds no plain text and the device key is gone (master mode); the +# CSV export has the login. Usage: tests/smoke/stores-vault-check.sh +set -eu +out=${1:?outdir} +data=$out/home/.local/share/nacre-servo/Default +fail=0 +for secret in s3cret-Pa55 alice 127.0.0.1 'Tr0ub4dor' carol; do + if grep -q -- "$secret" "$data/vault.json"; then echo "FAIL: vault.json contains '$secret'"; fail=1; fi +done +if [ -e "$data/vault.key" ]; then echo "FAIL: vault.key still exists in master mode"; fail=1; fi +grep -q 's3cret-Pa55' "$out/home/export.csv" || { echo "FAIL: export.csv lacks the login"; fail=1; } +[ "$(stat -c %a "$data/vault.json")" = 600 ] || { echo "FAIL: vault.json mode is not 600"; fail=1; } +[ $fail = 0 ] && echo "vault files ok" +exit $fail diff --git a/tests/smoke/stores-vault.txt b/tests/smoke/stores-vault.txt new file mode 100644 index 0000000..ed09d60 --- /dev/null +++ b/tests/smoke/stores-vault.txt @@ -0,0 +1,64 @@ +# Stores pass (S008): the password vault. Save a login from a local form, autofill it, master password lock/unlock, +# CSV export and import. Offline. Start the page server first, then run hidden and check the files afterwards: +# python3 -m http.server 8768 --bind 127.0.0.1 --directory tests/smoke/pages & +# tools/smoke.sh tests/smoke/stores-vault.txt then tests/smoke/stores-vault-check.sh +wait 3 +open http://127.0.0.1:8768/login.html +waitload +waitfor 10 document.getElementById('pass') !== null +locate #user +wait 1 +click @ +pagetype alice +locate #pass +wait 1 +click @ +pagetype s3cret-Pa55 +locate #go +wait 1 +click @ +wait 2 +status save-prompt +expect /active/prompts 1 +prompt allow +status saved +expect /logins 1 +# Autofill: with one saved login the form fills itself. +open http://127.0.0.1:8768/login.html +waitload +waitfor 10 document.getElementById('pass').value === 's3cret-Pa55' +assert document.getElementById('user').value === 'alice' +shot autofilled +# Export, master password, lock. +vault export @HOME@/export.csv +vault master hunter2 +status master +expect /vault_mode "Master" +vault lock +status locked +expect /vault_locked true +expect /logins 0 +open http://127.0.0.1:8768/login.html +waitload +wait 2 +assert document.getElementById('pass').value === '' +vault unlock wrong-password +status wrong +expect /vault_locked true +vault unlock hunter2 +status unlocked +expect /vault_locked false +expect /logins 1 +open http://127.0.0.1:8768/login.html +waitload +waitfor 10 document.getElementById('pass').value === 's3cret-Pa55' +# Import: the same file again adds nothing; a Chrome-format file adds two and skips the bad row. +vault import @HOME@/export.csv +vault import @PAGESDIR@/vault-import.csv +status imported +expect /logins 3 +page nacre://passwords +wait 1 +shot passwords-page +status done +quit diff --git a/tools/check-shots.py b/tools/check-shots.py new file mode 100755 index 0000000..7db6d15 --- /dev/null +++ b/tools/check-shots.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +"""Fail if a smoke screenshot looks blank: usage `tools/check-shots.py [prefix]` (checks *.png). +A shot is blank when its window area has fewer than 8 distinct colours or one colour covers over 99.5 % of it.""" +import sys +from collections import Counter +from pathlib import Path + +from PIL import Image + +out = Path(sys.argv[1]) +prefix = sys.argv[2] if len(sys.argv) > 2 else "" +bad = 0 +shots = sorted(out.glob(prefix + "*.png")) +for shot in shots: + image = Image.open(shot).convert("RGB") + colours = Counter(image.getdata()) + top = colours.most_common(1)[0][1] / (image.width * image.height) + blank = len(colours) < 8 or top > 0.995 + print(f"{'BLANK' if blank else 'ok '} {shot.name}: {len(colours)} colours, {top:.1%} one colour") + bad += blank +print(f"{len(shots)} shots, {bad} blank") +sys.exit(1 if bad or not shots else 0)