S053: docs describe the WebKit engine

This commit is contained in:
astar76 2026-11-13 21:24:26 -06:00
commit efe381575d
6 changed files with 150 additions and 240 deletions

View file

@ -1,6 +1,6 @@
# Nacre
Nacre is a web browser written from scratch in Rust with an egui UI, **switching from the Servo 0.7 engine to a tuned WebKit (D-032; Linux only)**, meant to replace the Python/QtWebEngine Nacre as the user's daily browser. Final deliverable: Linux (AppImage, tar.gz) builds of the browser, published through the `releases/` folder to the user's Forgejo (astar76/Nacre). Vision: [PLAN.md](PLAN.md).
Nacre is a web browser written from scratch in Rust with an egui UI, **on a tuned WebKitGTK 6.0 in a GTK 4 host (D-032; Linux only; Servo was removed in S053)**, meant to replace the Python/QtWebEngine Nacre as the user's daily browser. Final deliverable: Linux (AppImage, tar.gz) builds of the browser, published through the `releases/` folder to the user's Forgejo (astar76/Nacre). Vision: [PLAN.md](PLAN.md).
## 0. Session rules — read first
@ -11,7 +11,7 @@ Nacre is a web browser written from scratch in Rust with an egui UI, **switching
5. **Invent nothing**: check the code/docs; if a fact is still missing, ask — the **orchestrator** if you were started by one (never the user directly), otherwise the user.
6. **End of session**: (a) end criteria verified **by commands**, not memory; (b) `docs/PROGRESS.md` entry (≤ 15 lines: done, not done, later); (c) `docs/DECISIONS.md` if a decision binds later plans; (d) tick your line in `Plans/INDEX.md` (no commentary); (e) commit `SNNN: …` and push to `origin`; (f) short report: done, not done, what the user/orchestrator must do, and any instruction that cost more than it gave.
7. **Languages**: answer in English. Code, comments and docs in English. Internal docs (`CLAUDE.md`, `Plans/`, `PROGRESS.md`) in English.
8. Also at session start (user rule): read `docs/HANDOFF.md` and `docs/STATUS.md` if they exist. `docs/DESIGN.md` is the architecture and Servo API cheat sheet; read the parts your plan names.
8. Also at session start (user rule): read `docs/HANDOFF.md` and `docs/STATUS.md` if they exist. `docs/DESIGN.md` is the architecture and WebKit embedding cheat sheet; read the parts your plan names.
## Tracker
@ -22,7 +22,7 @@ After ticking a box: `ArtifactData` `update` with `url` = the tracker, `collecti
Root: `/home/astar76/Projects/Nacre`
```
src/ main, app (winit), window, hub (Servo delegates), tabs, actions, keys, inject, adblock, discord, media, ...
src/ main, app, window (GTK window + egui overlay), egui_area, engine/ (WebKit host, views, events), tabs, actions, keys, inject, adblock, discord, media, ...
src/store/ settings, history, bookmarks, downloads, vault, permissions, session, apps, scripts
src/net/ bridge (local CONNECT proxy), fetch, tor, dns, download, dlm
src/ui/ egui chrome, menus, dialogs, widgets, pages/* (every nacre:// page)
@ -35,11 +35,10 @@ Never modify: `~/Documents/Apps/Nacre` (the original Python Nacre, reference onl
## 2. Facts
- **Engine switch in progress (D-032)**: the Servo facts below describe today's code until the `08 WebKit engine` plans replace it. Engine test and WebKit tuning data: `docs/engine/engine-comparison.md`, `docs/engine/tune/`. Everything Servo-only and what WebKit must replace: `docs/engine/servo-removal.md`.
- Cargo package `nacre` 0.4.0, edition 2024, Rust ≥ 1.88. Servo is `=0.7.0` from crates.io, trimmed (no WebXR, WebGPU, multiprocess). Gamepad and Web Bluetooth stay in.
- Status: ~19k lines written, **never compiled**. Review passes were done by reading only. Expect a round of compile errors at the first build; fix them in place, don't restructure.
- User rules: function first; plain egui UI until everything works; the Material You redesign comes afterwards (see `docs/UI-BRIEF.md`); nothing from the original is dropped silently (Servo limits are shown as unavailable, see DESIGN.md "Engine limits"); never connect to Tor or proxies in tests.
- **Engine**: WebKitGTK 6.0 (`webkit6` crate, `=0.6.1`) in a GTK 4 window; egui draws the chrome in a transparent `Gtk.GLArea` over the web views (D-033, D-035). WebKit tuning data and the engine test: `docs/engine/engine-comparison.md`, `docs/engine/tune/`. The Servo removal inventory (history): `docs/engine/servo-removal.md`. Pages' network work happens in the web process extension `webext/`.
- Cargo package `nacre` 0.4.0, edition 2024, Rust ≥ 1.88. No Servo, vendored crates or patched engine any more; builds take minutes (~2–4 min release), not hours.
- Status: builds, `cargo test` green, hidden smokes pass; features still to re-verify on WebKit are marked in `docs/FEATURES.md`.
- User rules: function first; plain egui UI until everything works; the Material You redesign comes afterwards (see `docs/UI-BRIEF.md`); nothing from the original is dropped silently (engine limits are shown as unavailable, see DESIGN.md "Engine limits"); never connect to Tor or proxies in tests.
- Known gaps and things to check at the first build: `docs/REVIEW.md`. Feature list with file and review state: `docs/FEATURES.md`.
- The original Python Nacre (`~/Documents/Apps/Nacre/nacre`, `config.py` DEFAULTS) is the feature spec.
@ -48,16 +47,14 @@ Never modify: `~/Documents/Apps/Nacre` (the original Python Nacre, reference onl
- Write like the neighbouring code. KISS, DRY, YAGNI; no abstraction without ≥ 2 uses.
- New pure logic gets a test; a bug fix gets a regression test when feasible.
- Fix compile errors in place; don't restructure working modules.
- Servo callbacks run on the main thread; `load_web_resource` must answer synchronously (see REVIEW.md).
- WebKit signals run on the main thread; handlers only queue `Event`s (see `src/engine/mod.rs`); never touch `App` inside a signal handler.
## 4. Domain pitfalls (all agents)
- **Builds**: `nice cargo build --release -j 2` only. The first build takes hours (Servo, SpiderMonkey, WebRender). Never run `cargo test` at the same time as a release build, and never run two cargo commands on the same `target/`.
- Servo needs clang. Start from Servo's own lock versions to avoid pre-release drift (rsa/pkcs1).
- **Builds**: `nice cargo build --release -j 2` only. Never run `cargo test` at the same time as a release build, and never run two cargo commands on the same `target/`.
- Run apps in the hidden nested session (`tools/nested-session.sh`: Xvfb → nested niri, software GL; `kwin_wayland` isn't installed) unless the user asked to watch. Xvfb has no DRI3, so clients there use `LIBGL_ALWAYS_SOFTWARE=1 WEBKIT_DMABUF_RENDERER_FORCE_SHM=1 GSK_RENDERER=gl` (the session's `env` file sets them). VMs have no real GPU: use software rendering there.
- Never connect to Tor or proxies in tests; `NACRE_NO_BRIDGE=1` disables the bridge for debugging.
- Servo 0.7 can't add request headers, block third-party cookies, do per-WebView private mode, EME/DRM, printing: don't try, see DESIGN.md.
- Several painters on one GL context (one per tab) is unproven; the fallback is in DESIGN.md.
- WebKit has no EME/Widevine here, no Chrome extensions, no JS pause for background tabs: see DESIGN.md "Engine limits"; don't try to work around them.
- Use throwaway `XDG_*` dirs for test runs so the user's profile is untouched.
## 5. Verification tools
@ -74,11 +71,10 @@ Never modify: `~/Documents/Apps/Nacre` (the original Python Nacre, reference onl
| `tools/smoke.sh tests/smoke/settings.txt` (+ `SMOKE_SIZE=1280x1100`) | every settings section and sub-page dark and light, search results (`nacre://settings/?search=…`), narrow width; `settings-write.txt` (hidden, `SMOKE_SIZE=1280x1100`, fresh outdir) taps controls with selftest `tap x y`, then check `home/.config/nacre-servo/Default/settings.json` (expected values in its header) | now (S019) |
| `SMOKE_SIZE=1280x1600 tools/smoke.sh tests/smoke/sliders.txt` | controls hold still (R1-21): Interface size drag (value label while held, applied on release), Contrast live, Style chip pick; `SMOKE_VISIBLE=1 tools/smoke.sh tests/smoke/sliders-visible.txt` the same plus scrolling for the user's window (~772 px). Selftest `press`/`drag`/`release`, `scroll x y dy`; read the PNGs | now (R1-21) |
| `python3 tests/smoke/net/server.py &` + `tools/smoke.sh tests/smoke/net-{privacy,adblock,downloads}.txt` | network pass, offline: secure DNS through a local DoH stub (`*.nacre.test` → 127.0.0.1), HTTPS-only + certificate warning, tracking params, ad blocker with a local list, downloads + download manager stubs; the server's `/log` has requests, DNS names, Range headers, manager calls. `cache-restart.txt` with `SMOKE_HOME=<cache.txt outdir>/home`: disk cache. `net-real.txt` needs internet. `@HOME@` in scripts = the throwaway home | now (S007) |
| `SMOKE_TIMEOUT=400 tools/smoke.sh tests/smoke/mse.txt` + `tests/smoke/mse-leak-check.sh <outdir>` | MSE: chunk-appended fMP4, WebM and split A/V play; `mse-spec.html` spec cases (attach/detach, duration, buffered/seekable, remove, removeSourceBuffer, changeType, abort, reopen, sequence, leak); the leak check reads nacre.log (offline). `NACRE_DOM_MEDIA_SOURCE_ENABLED=0 tools/smoke.sh tests/smoke/mse-off.txt`: the switch. `SMOKE_TIMEOUT=400 tools/smoke.sh tests/smoke/mse-player.txt`: player integration (attach without blocking, seeks, rate, ended, decode error, garbage append, script-thread gaps < 1 s; `?only=<case>` in the page URL for one case). `tools/gst-mse.sh test`: patched gst_mse + C tests. DESIGN.md "Media and Media Source Extensions" | S022, S027, S028 |
| `tools/gst-mse.sh [test]` | builds Nacre's patched gst_mse library and `mse` plugin (vendor/gst-mse) into `target/gst-mse/` (needed before running a build that uses MSE); `test` also runs the C tests in `tests/gst-mse/` | now (S026, branch s022-mse-proto) |
| `SMOKE_TIMEOUT=400 tools/smoke.sh tests/smoke/mse.txt`, `…/mse-player.txt` | plain MSE tests on WebKit: chunk-appended fMP4, WebM and split A/V play; `mse-spec.html` spec cases (attach/detach, duration, buffered/seekable, remove, removeSourceBuffer, changeType, abort, reopen, sequence); player integration (attach, seeks, rate, ended, decode error, garbage append; `?only=<case>` in the page URL for one case). Offline. `youtube-mse.txt` is an internet probe | S022, S027, S028, S053 |
| `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 <name> <js>` writes a JS string result to `<name>.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/<engine>/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/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/<engine>/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` (+ `tools/hidden.sh tests/smoke/pip.txt <out> -- tests/smoke/pip-driver.sh`: `<out>/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), 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) |
| `tools/hidden.sh <script> [outdir] [-- driver.sh]` | WebKit build hidden with a driver script: Xvfb → nested niri (`tools/nested-session.sh`), throwaway home, software GL, `NACRE_SCRIPT`; the driver gets `click`/`scroll` (`tools/wl-input`), `grab` (grim), `key`/`type` (wtype). Scripts in `tests/hidden/` (`basic.txt` offline; `web.txt` + `web-driver.sh` needs internet). Read the PNGs | now (S045) |
| appimagetool, wine + Inno Setup, VM "Windows 10" | packaging and Windows checks | see the user's global CLAUDE.md "Building" |

View file

@ -1,10 +1,10 @@
# Nacre — vision
## Goal
A daily-driver web browser in Rust on Servo 0.7 with an egui UI, 1:1 in features with the user's Python/QtWebEngine Nacre (new tab page, settings, permissions, vault/autofill, ad blocker, VPN/DNS bridge, downloads, Discord presence, media, import of old profiles). Recipient: the user, replacing their current browser; releases go to their Forgejo (astar76/Nacre).
A daily-driver web browser in Rust on WebKitGTK 6.0 (GTK 4 host) with an egui UI, 1:1 in features with the user's Python/QtWebEngine Nacre (new tab page, settings, permissions, vault/autofill, ad blocker, VPN/DNS bridge, downloads, Discord presence, media, import of old profiles). Recipient: the user, replacing their current browser; releases go to their Forgejo (astar76/Nacre).
## Current state
About 19k lines written across storage, networking, ad blocker, media, importer, updates, keys, Servo glue and a plain egui UI. Reviewed by reading only; never compiled. Architecture: `docs/DESIGN.md`; features: `docs/FEATURES.md`; open checks: `docs/REVIEW.md`; redesign spec: `docs/UI-BRIEF.md`.
Storage, networking, ad blocker, media, importer, updates, keys, the WebKit host and an egui UI, built and smoke-tested hidden; Servo is gone (S053). Architecture: `docs/DESIGN.md`; features: `docs/FEATURES.md`; open checks: `docs/REVIEW.md`; redesign spec: `docs/UI-BRIEF.md`.
## Phases
1. **First build** — make it compile (`nice cargo build --release -j 2`), fix errors in place, get the binary to start.
@ -12,10 +12,10 @@ About 19k lines written across storage, networking, ad blocker, media, importer,
3. **Gaps** — work through `docs/REVIEW.md`, fix the user's review items, add MPRIS media keys (other candidates deferred, D-002).
4. **UI redesign** — Material You (tonal-spot schemes, spring motion, expressive shapes) and the animated new tab page per `docs/UI-BRIEF.md`, using the `app-taste` skill. Starts only after the framework works.
5. **Polish pass** (`Plans/07 Polish pass`, input `docs/review/phase5.md`) — the crash, load speed, SVG/masks, small fixes, flyouts and context menu, custom download manager, a DevTools window, motion rules, a little-things sweep and site passes; ends with the phase 5 review (S042).
6. **WebKit engine** (`Plans/08 WebKit engine`, D-032–D-040, runs first) — GTK 4 host with the egui overlay over WebKitGTK 6.0 views, engine callbacks, ad block via content filters + web process extension, network/privacy/downloads, profile and sealed cookies, tuning defaults, Servo removal, site pass vs Chromium; Widevine later.
6. **WebKit engine** (`Plans/08 WebKit engine`, D-032–D-040, runs first) — GTK 4 host with the egui overlay over WebKitGTK 6.0 views, engine callbacks, ad block via content filters + web process extension, network/privacy/downloads, profile and sealed cookies, tuning defaults, Servo removal (done, S053), site pass vs Chromium; Widevine later.
7. Packaging and release (Linux AppImage/tar.gz, Windows installer and zip) when the user asks.
Each of phases 1–4 ends with a user review plan (D-003).
## Out of scope
Chrome extensions, Widevine/DRM, printing, per-WebView private mode, third-party cookie blocking (Servo 0.7 limits, shown as unavailable); anything copied from the older `Nacre-rust` repo.
Chrome extensions and Widevine/DRM for now (WebKit limits, shown as unavailable; Widevine is a later plan). Printing, private mode and third-party cookie blocking are possible on WebKit and belong to later plans. Anything copied from the older `Nacre-rust` repo.

View file

@ -4,25 +4,27 @@ Working notes for whoever continues this code. Keep it current.
## Ground rules (from the user, 2026-11-10)
- Everything in Rust; engine is Servo 0.7 from crates.io, trimmed (no WebXR, WebGPU, multiprocess). Gamepad and Web Bluetooth stay in (user, 2026-11-10).
- Everything in Rust; the engine is WebKitGTK 6.0 (D-032, Linux only) in a GTK 4 host; the chrome is egui. (The first engine was Servo 0.7; it was removed in S053, history in `docs/engine/servo-removal.md`.)
- Function first. The UI is plain egui for now; the designed UI comes after everything works.
- Written from scratch. The older `astar76/Nacre-rust` repo is not a source.
- No builds until the code has been reviewed and declared "first build worthy". Then one build:
`nice cargo build --release -j 2`. Never run tests alongside a release build.
- Feature spec: the settings screenshot plus the original Python Nacre (`~/Documents/Apps/Nacre/nacre`,
`config.py` DEFAULTS is the list of settings). Nothing in there is to be dropped silently; things Servo cannot do
`config.py` DEFAULTS is the list of settings). Nothing in there is to be dropped silently; things WebKit cannot do
are listed under "Engine limits" and shown as unavailable in the UI.
- Never connect to Tor or proxies in tests.
## Layout
```
src/main.rs args, single instance, starts the event loop
src/app.rs App: winit ApplicationHandler, owns Servo, windows, timers, background jobs
src/window.rs BrowserWindow: winit window + GL contexts + egui; forwards input; paints
src/hub.rs Servo delegates; everything Servo tells us becomes an Event in a queue
src/tabs.rs Tab (one WebView or an internal page), per-window tab list
src/keys.rs winit -> Servo key conversion, shortcut table (rebindable)
src/main.rs args, single instance, starts the GTK application
src/app.rs App: owns the engine, windows, timers, background jobs; handles engine events from a GLib idle
src/window.rs BrowserWindow: gtk::ApplicationWindow, Overlay of the tabs' web views and the egui area
src/egui_area.rs egui painted in a transparent Gtk.GLArea over the window; pointer only where egui has something
src/engine/ WebKitGTK: `host.rs` Engine (network session, web context, settings, signals -> Event queue),
`view.rs` View (one web view's actions), `mod.rs` Event, ViewId and payload types
src/tabs.rs Tab (one View or an internal page), per-window tab list
src/keys.rs GTK key -> shortcut table (rebindable)
src/inject.rs JavaScript injected into pages (bridge, autofill, find, media, PiP, cosmetic filters)
src/adblock.rs adblock-rust: lists, updates, cosmetic engine, conversion to WebKit content filters
webext/ web process extension (cdylib): headers, stand-ins, blocked counts (D-036)
@ -35,188 +37,104 @@ src/updates.rs update check against the Forgejo releases API
src/paths.rs config / data / cache dirs, profiles
src/tabs.rs Tab, internal pages (Page), prompts and dialogs per tab
src/theme.rs palette and egui visuals from the Appearance settings
src/resources.rs Servo's resource files and Nacre's error/certificate/crash pages
src/resources.rs titles and builders of Nacre's error and certificate pages
src/instance.rs single instance per profile (links go to the running browser)
src/pdf.rs one-page PDF for "save as PDF"
src/actions.rs Command enum and everything the browser does when asked
src/util.rs small helpers (time, url fixing, json files, random)
src/store/ settings, history, bookmarks, downloads, vault, permissions, session, apps, scripts
src/net/ bridge (local CONNECT proxy: direct / SOCKS5 / HTTP upstream, DoH), fetch (ureq), tor, dlm
src/net/ bridge (local proxy: direct / SOCKS5 / HTTP upstream, DoH), policy, privacy, fetch (ureq), tor, dlm
src/ui/ egui: chrome (tab strip, toolbar, omnibox, bookmarks bar), menus, dialogs, pages/*
```
## How the pieces fit
- One process, many windows. `App` holds `Rc<Shared>` (Servo, stores, ad blocker, bridge handle) and a map of
`BrowserWindow`s. Window kinds: Normal, App (site installed as app: no toolbar), Pip (always on top, one video).
- Incognito is a second process (`nacre --incognito`) with a temporary profile that is deleted on exit, because
Servo 0.7 has no per-WebView private mode.
- Rendering (D-008): per window one `WindowRenderingContext` (surfman) and one `OffscreenRenderingContext`
made from it (`BrowserWindow::page_context`), shared by all the window's tabs, so Servo makes one painter
(WebRender instance) per window. Only the active tab's web view is shown; `painted_tab` records whose page is
in the framebuffer, so a tab switch forces a repaint. While no tab shows a page (internal page, PiP
placeholder) `paint_unshown` still paints, because Servo keeps reporting the frame until it is painted.
egui (egui_glow on the window context's glow API) draws the chrome and a paint callback blits the page
framebuffer into the page rectangle (`render_to_parent_callback`). glow is 0.17 on both sides.
Why not one painter per tab: each painter is a full WebRender instance (~56 MB and ~6 threads; 15 tabs took
1128 MB vs 341 MB shared, same frame time; S005). Servo 0.7 draws a painter's visible web views at the origin
at full size, so one shared painter rules out split view.
Picture in picture: `pip.take` pauses the tab's video and returns its time; a second web view (`Tab::pip`)
with a context and painter of its own loads the same URL at the PiP window's size, `pip.start` seeks and
plays it once loaded, and its frames are read back (`read_to_image`) into the PiP window. On exit `pip.state`
hands the time back to the tab (`pip.resume`). The page is reloaded, so its state (logins aside) is lost.
Servo 0.7 freezes a playing video that is seeked and then `play()`ed: pause before seeking.
- Servo callbacks arrive on the main thread inside `servo.spin_event_loop()`. The delegate (`hub::Hub`) answers the
synchronous ones right there (resource loads -> ad blocker, navigation requests -> HTTPS-only / downloads /
external schemes) and queues the rest as `Event`s that `App` drains after each spin.
- Page -> browser messages: the bridge user script keeps a private reference to `console.log` and sends
`<token><json>`; `show_console_message` picks those out. The token is random per run and never exposed to pages.
Browser -> page: `WebView::evaluate_javascript`.
- Network: Servo reads its proxy prefs once at start, so it is always pointed at `net::bridge`, a local CONNECT
proxy. The bridge decides per connection: direct (optionally resolving through DoH), or through the VPN upstream
(SOCKS5 with remote DNS for Tor, or an HTTP proxy). Switching VPN or DNS needs no restart. Nacre's own requests
(downloads, filter lists, updates) go through the bridge too. `NACRE_NO_BRIDGE=1` turns it off for debugging.
- One process, many windows. `App` holds `Rc<Shared>` (engine, stores, ad blocker, bridge handle) and a map of
`BrowserWindow`s. Window kinds: Normal, App (site installed as app: no toolbar), Pip (floating window with one video).
- Incognito is a second process (`nacre --incognito`) with a temporary profile deleted on exit and an ephemeral
engine session (`Setup.dirs = None`).
- Rendering (D-033, D-035): each window is a `Gtk.Overlay`: below, a `Gtk.Stack` with one WebKit web view per tab,
placed at egui's page rectangle by margins; above, an `EguiArea` (transparent `Gtk.GLArea`, `egui_glow`) that draws
all the chrome. WebKit draws the page itself. GTK's pick sends the pointer to egui only where egui has something
(the chrome, flyouts, menus, dialogs, toasts); elsewhere the page gets pointer, wheel, right click, drag and IME
natively. Keyboard focus goes to the page after navigation (`focus_page`) and to egui for the address field.
- WebKit signals arrive on the main thread. The handlers in `engine/host.rs` only turn them into `Event`s on the
`Hub` queue (never touching `App`, which may be borrowed while WebKit emits a signal synchronously);
`App::handle_event` handles them from a GLib idle (`app::pump`). Questions WebKit needs answered (navigation,
permissions, dialogs, certificate errors, downloads) travel as payload types that hold the WebKit request object,
and the answer goes back through them. Views are known by Nacre's own `ViewId` (D-041); the map to `WebView` lives
in `host.rs` only.
- Page -> browser messages: the `nacre` script message handler (registered before a view is built) carries
`inject.rs` messages as JSON. Browser -> page: `View::evaluate_javascript` (JSON result).
- Network: the engine is pointed at `net::bridge` (SOCKS5 with a per-run user name and token; the same port also
speaks HTTP proxy). The bridge decides per connection: direct (optionally resolving through DoH), or through the
VPN upstream (SOCKS5 with remote DNS for Tor, or an HTTP proxy). Switching VPN or DNS needs no restart. Nacre's own
requests (downloads, filter lists, updates) go through the bridge too. `NACRE_NO_BRIDGE=1` turns it off for
debugging. Request policy (HTTPS-only, tracking parameters, external schemes, downloads) is `net::policy::decide`
in WebKit's `decide-policy`; sub-resource work is the web process extension (see "Ad blocker on WebKit").
- Settings pages, history, bookmarks, downloads, passwords, apps and so on are egui views shown in a tab
("internal tab", `nacre://settings` etc.), not web pages.
## Servo 0.7 embedding cheat sheet (checked against the crate source)
## WebKitGTK embedding cheat sheet
```
servo = { version = "=0.7.0", default-features = false,
features = ["bundled", "clipboard", "js_jit", "media-gstreamer", "webgl", "webcrypto",
"brotli-compression-stream", "gamepad", "bluetooth", "native-bluetooth"] }
Gamepads: gilrs events -> InputEvent::Gamepad(GamepadEvent::{Connected, Disconnected, Updated}); rumble via GamepadDelegate.
Bluetooth: pref dom_bluetooth_enabled=true; WebViewDelegate::show_bluetooth_device_dialog -> device picker dialog.
rustls::crypto::aws_lc_rs::default_provider().install_default() // before ServoBuilder
ServoBuilder::default().opts(Opts).preferences(Preferences).event_loop_waker(Box<dyn EventLoopWaker>).build()
servo.spin_event_loop(); servo.set_delegate(Rc<dyn ServoDelegate>); servo.set_preference(name, PrefValue)
servo.site_data_manager() -> &SiteDataManager (site_data, clear_site_data, clear_cookies, cookies_for_url, set_cookie_for_url)
servo.network_manager() -> Ref<NetworkManager> (clear_cache, cache_entries)
WindowRenderingContext::new(display_handle, window_handle, PhysicalSize<u32>) -> Result<_, surfman::Error>
Rc<WindowRenderingContext>::offscreen_context(size) -> OffscreenRenderingContext
offscreen.render_to_parent_callback() -> Option<Box<dyn Fn(&glow::Context, euclid::default::Rect<i32>) + Send + Sync>>
RenderingContext: make_current, prepare_for_rendering, present, resize(PhysicalSize<u32>), size, glow_gl_api, read_to_image
WebViewBuilder::new(&servo, Rc<dyn RenderingContext>).url(Url).hidpi_scale_factor(Scale::new(f32))
.delegate(Rc<dyn WebViewDelegate>).user_content_manager(Rc<UserContentManager>).build()
WebView: id, url, page_title, favicon -> Option<Ref<Image>>, load_status, cursor, load(Url), load_request(UrlRequest),
reload, can_go_back, go_back(1), can_go_forward, go_forward(1), resize(PhysicalSize<u32>), show, hide,
set_focused(bool), focused, paint, notify_input_event(InputEvent), notify_scroll_event(Scroll, WebViewPoint),
set_page_zoom(f32), page_zoom, exit_fullscreen, evaluate_javascript(script, |Result<JSValue, _>|),
take_screenshot(Option<WebViewRect>, |Result<RgbaImage, _>|), notify_theme_change(Theme),
notify_media_session_action_event(MediaSessionActionType), set_hidpi_scale_factor, clear_session_history
UserContentManager::new(&servo); add_script(Rc<UserScript>); remove_script; add_stylesheet(Rc<UserStyleSheet>)
(changes apply after reload; UserScript::new(String, Option<PathBuf>), UserStyleSheet::new(String, Url))
InputEvent::{Keyboard(KeyboardEvent::new(keyboard_types::KeyboardEvent)), MouseButton(MouseButtonEvent::new(action, button, point)),
MouseMove(MouseMoveEvent::new(point)), MouseLeftViewport(MouseLeftViewportEvent{focus_moving_to_another_iframe}),
Wheel(WheelEvent::new(WheelDelta{x,y,z,mode}, point)), EditingAction(ClipboardAction), Ime(ImeEvent), Touch(..)}
point: WebViewPoint::Device(DevicePoint) (From<DevicePoint>)
WebResourceLoad: .request {method, headers, url, destination (content_security_policy::Destination), referrer_url,
is_for_main_frame, is_redirect}; .intercept(WebResourceResponse::new(url)) -> InterceptedWebResourceLoad
{send_body_data(Vec<u8>), finish(), cancel()}. Dropping the load un-intercepted lets it through.
NavigationRequest {url}; allow()/deny(); dropped = allowed.
PermissionRequest: feature() -> PermissionFeature; allow()/deny().
EmbedderControl::{SelectElement, ColorPicker, FilePicker, InputMethod, SimpleDialog(Alert|Confirm|Prompt), ContextMenu}
ContextMenu: items(), element_info() {flags, link_url, image_url}, select(ContextMenuAction), dismiss()
CreateNewWebViewRequest::builder(rendering_context) -> WebViewBuilder (window.open / target=_blank)
MediaSessionEvent::{SetMetadata{title,artist,album}, PlaybackStateChange, SetPositionState{duration,playback_rate,position}}
Prefs worth knowing: user_agent, network_http_proxy_uri, network_https_proxy_uri, network_http_no_proxy,
network_enforce_tls_enabled (HTTPS-only), devtools_server_enabled, devtools_server_listen_address,
dom_*_enabled switches, shell_background_color_rgba, session_history_max_length, js_mem_max.
Opts: config_dir (profile storage: cookies, local storage), temporary_storage, ignore_certificate_errors, multiprocess.
webkit = { package = "webkit6", version = "=0.6.1", features = ["v2_52"] } // WebKitGTK 6.0; gtk4, glib, egui_glow
webkit::functions::{major,minor,micro}_version() // shown in Settings -> About (`engine_version()` in main.rs)
NetworkSession (persistent dirs or ephemeral) .website_data_manager() .cookie_manager() .set_proxy_settings(..)
WebContext / WebView::builder().network_session(..).related_view(parent) // pop-ups keep window.opener
Settings: user agent, developer extras, hardware acceleration policy, media stream, WebRTC (tuning: docs/engine/tune/)
UserContentManager: add_script / add_style_sheet (all frames, author level), register_script_message_handler("nacre"),
UserContentFilterStore (compiled ad blocker filters, `engine/host.rs set_content_filter`)
Signals -> Event: load-changed, notify::uri / title / estimated-load-progress / is-playing-audio, decide-policy
(navigation, new window, response -> downloads), create, close, permission-request, script-dialog,
web-process-terminated, load-failed-with-tls-errors, authenticate, show-notification, enter/leave-fullscreen,
context-menu (Nacre draws its own), run-file-chooser (portal), show/hide select / colour pickers
FindController (find, count, highlight), WebInspector (F12, attached; remote inspection on 127.0.0.1:6080 by request),
evaluate_javascript, set_zoom_level, set_is_muted, back_forward_list, print
Web process extension (`webext/`): send-request headers and redirects, console-message-sent for blocked counts
```
egui 0.37 deprecates `Ui::id` (now `Ui::scope_id`) and `Id::new` (now `Id::unique` / `IdSalt::new`); the code still
uses the old names, which build with warnings. The Servo 0.7 API above matched the crate: the first build had no
Servo signature errors.
uses the old names, which build with warnings.
Not in Servo 0.7, so Nacre does it itself: downloads, find in page, private mode, SOCKS proxies, spell check,
picture-in-picture, extensions, password capture, printing.
Not in WebKit, so Nacre does it itself: spell check (hunspell dictionaries), password capture and autofill,
extensions replaced by user scripts and styles, the context menu, the download manager, picture in picture window.
## Engine limits (shown as unavailable, not hidden)
- Picture in picture reloads the page in its own web view (one painter per window, D-008): page state is
lost and the video restarts loading before it jumps to the same time.
- Widevine / DRM video: Servo has no EME. The setting stays, marked "not available with this engine".
- Widevine / DRM video: EME is off in this build (WebKitGTK ships none); the setting stays, marked "not available with
this engine". Widevine on WebKit is a later plan.
- Chrome extensions: not possible. Replaced by user scripts and user styles (Apps -> Scripts).
- Hardware acceleration switch: Servo needs GL; "Off" selects software GL (LIBGL_ALWAYS_SOFTWARE) on next start.
- Printing: "Save page as PDF/PNG" through a full-page screenshot.
- Inline `<svg>` is painted from its own markup, so `currentColor` misses the CSS colour; `SVG_COLOR_JS`
(`inject.rs`) copies each icon's computed colour into its `color` attribute (hover colours not followed).
- Fingerprinting: Servo has no IndexedDB, plugins list, WebRTC or DynamicsCompressorNode, and its user agent is a
rare Firefox version, so Cover Your Tracks still finds Nacre unique with privacy mode on (bits per metric in
`docs/engine/privacy-mode.md`). `document.fonts.check()` and a pass-through compressor are Nacre's own layer
(`FONTS_CHECK_JS`, `COMPRESSOR_JS` in `inject.rs`); the screen size comes from `Hub::screen_geometry`.
- CSS `mask-image` icons (e.g. Wikipedia's) paint as solid squares. HTTP/2 header limit: see D-012.
- Hardware acceleration switch: "Off" selects software rendering on next start.
- Permissions WebKit never asks the embedder about: storage persist, per-site JavaScript (not wired yet), MIDI,
Bluetooth, wake lock, background sync, game controllers.
- Ad blocker: network rules WebKit's content blocker can't express are dropped (table in "Ad blocker on WebKit"); the
`images` permission is not enforced.
- Web process memory isn't split per tab in the task manager; the "Nacre uses" figure is the host process.
- Pop-ups always open as tabs, never as separate windows.
- Fingerprinting: bits per metric and what privacy mode covers are in `docs/engine/privacy-mode.md` (the Servo-era
numbers there are historical).
## Vendored servo-net patches
## Media
`vendor/servo-net` is servo-net 0.7.0 through `[patch.crates-io]` (D-012). Every Nacre change is marked
`Nacre patch` in the code; a Servo upgrade re-applies the ones upstream still needs, then re-runs the smoke scripts named.
Playback is WebKit's own (GStreamer) including Media Source Extensions; `tests/smoke/mse*.txt` are plain MSE tests.
Page media state (title, position, playing) is read by a page probe and `is-playing-audio`; `media.rs` feeds the media
button, Discord and MPRIS. Picture in picture moves the live web view into its own floating window and back (no reload).
The patched gst_mse of the Servo era is gone; `docs/engine/gst-mse-patches.md` is its record.
| File, function | What and why | Re-check |
|---|---|---|
| `connector.rs` `create_http_client` | `http2_max_header_list_size(256 KiB)`: hyper's 16 KiB default refuses YouTube's response headers (D-012) | `heavy-web.txt` |
| `fetch/methods.rs` `main_fetch` (scheme fetch) | lets the certificate warning's `chrome:allowcert` request through; it ended as UnsupportedScheme (D-014) | `net-privacy.txt` |
| `http_cache.rs` `flush_to_disk`, `resource_thread.rs` Exit | writes the memory HTTP cache to the disk cache at quit (D-014) | `cache.txt`, `cache-restart.txt` |
| `nacre.rs` (new module, `pub mod nacre` in `lib.rs`) | embedder-set state the patches below read: extra request headers, the third-party cookie switch, the top-level site per webview, site matching (S023) | `privacy-net.txt` |
| `http_loader.rs` `http_network_or_cache_fetch` (step 8.15) | appends the embedder's extra headers (`DNT`, `Sec-GPC`, `Save-Data`) unless the request already has them; records a `Document` request's site as its webview's top-level site; skips the `Cookie` header for a third-party request (S023) | `privacy-net.txt` |
| `http_loader.rs` `http_network_fetch` (step 15) | doesn't store `Set-Cookie` from a third-party response (S023) | `privacy-net.txt` |
| `websocket_loader.rs` `create_handshake_request`, `process_ws_response` | the same third-party rule for WebSocket handshakes (S023) | unit tests only |
| `resource_thread.rs` `create_http_states`, Exit; `nacre.rs` `set_cookie_persistence`, `cookie_jar_snapshot`; `Cargo.toml` (+ `serde_json`) | the public cookie jar comes from and goes to the embedder instead of plain `cookie_jar.json`: Nacre's initial jar at start, a JSON copy on demand, the final jar at Exit (S025, D-019) | `cookies.txt` + `cookies-restart.txt` + `cookies-cleared.txt` |
| `fetch/methods.rs` `main_fetch` (step 12) | privacy mode's Firefox-style Accept-Language ("en-US,en;q=0.5", `nacre::append_accept_language`) replaces Servo's single locale; a page's own value stays (S024) | `privacy-net.txt` |
## Cookies at rest
## Vendored servo-script patches
`store::cookies` seals the cookie jar into `<data>/cookies.bin` with XChaCha20-Poly1305 (`vault::seal`, AAD
`nacre-cookies-v1`, magic `NACRECK1`); the 256-bit key lives in the OS keyring (crate `keyring` 3, service `Nacre`,
account `cookies <data folder>`). Without a keyring cookies live for the run only and nothing is written (Settings →
Privacy → Site data says so). A file that doesn't decrypt is moved to `cookies-unreadable-<time>.bin`. Incognito
writes nothing. Reconnecting this to WebKit's cookie manager (cookie DB on tmpfs, sealed on exit) is plan S051 (D-037).
`vendor/servo-script` is servo-script 0.7.0 through `[patch.crates-io]` (S031), same rules as servo-net above.
## Privacy mode
| File, function | What and why | Re-check |
|---|---|---|
| `event_loop/timers.rs` `OneshotTimers::fire_timer`, `JsTimerTask::invoke` | due timers wait in a `RootedTraceableBox<VecDeque>` instead of a plain `Vec`, and the running timer's callback is rooted: a GC inside one callback swept the functions of the timers still waiting (SIGSEGV in `GlobalScope::from_object`, R5-01) | `crash-adblock.txt` |
| `dom/media/`, `dom/html/embedded_content/htmlmediaelement.rs`, `dom/globalscope`, `dom/url` and more | Media Source Extensions (S022-S028), see "Media and Media Source Extensions" below; `grep -rn "Nacre" vendor/servo-script` lists them | `mse.txt`, `mse-player.txt` |
Third-party rule (S023): a request is third-party when its host's site (registrable domain, eTLD+1; an IP address
or a single-label host stands for itself) differs from the top-level site of its webview. Scheme and port don't
count, so `a.example.com` on `example.com` stays first-party. The top-level site comes from the last `Document`
request of that webview (net sees it before any subresource) and from the hub's `notify_url_changed` (history
navigations without a request, downloads that didn't replace the page); `notify_closed` forgets it. Requests with no
webview or no known top-level site are never blocked. `Document` requests are never blocked; `IFrame` documents are
checked like any subresource. `document.cookie` and the Cookie Store API in a third-party frame go to net with no
webview id (servo-script isn't vendored); Nacre's `FRAME_COOKIE_JS` (`inject.rs`, S024) empties them in a frame
whose top page is another site.
## Media and Media Source Extensions (S022-S028)
Plain `<video>`/`<audio>` play through servo-media's GStreamer backend (playbin3 via GstPlay). Servo 0.7 has no
`MediaSource`; Nacre adds it in vendored crates (`[patch.crates-io]`, every change marked `Nacre patch`):
| Crate | What |
|---|---|
| `vendor/servo-script-bindings` | `MediaSource`, `SourceBuffer`, `SourceBufferList` WebIDL; `buffered` is `[Throws]` (`GetBuffered`, `cx` in Bindings.conf) |
| `vendor/servo-script` `dom/media/` | the DOM objects to spec: attach/detach, events through tasks, buffered/seekable, abort, changeType, sequence mode, object URLs per global. Ready state under MSE comes from buffered ranges vs. current time (`buffered_ready_state`), metadata (`loadedmetadata`) once every SourceBuffer has an init segment; player-driven HAVE_ENOUGH bumps are skipped |
| `vendor/servo-media-player` `mse.rs` | backend traits, `MseEvent`, pure helpers (ready state, track counts from codecs, type parsing) with unit tests |
| `vendor/servo-media-gstreamer` | `mse.rs` backend over gst_mse; `ByteStreamCheck` walks MP4 boxes / WebM EBML to find init segments and reject garbage (gst_mse only reports an init segment once frames arrive). `player.rs` setup returns at once for a MediaSource (never blocks the script thread); msesrc `ready-state` -> `MseEvent::Metadata`. `registry_scanner.rs` codec table (`isTypeSupported` = `canPlayType`) |
| `vendor/gst-mse` | patched gst-plugins-bad 1.28.9 MSE library + msesrc, built by `tools/gst-mse.sh` into `target/gst-mse`, loaded ahead of the system copy; patches in `docs/engine/gst-mse-patches.md`, diff in `nacre.patch` |
Checks: `mse.txt` (spec cases + leak check), `mse-player.txt` (attach, seeks, rate, ended, errors, script-thread
gaps), `tools/gst-mse.sh test` (C tests). Background: `docs/engine/mse-spike.md`.
## Cookies at rest (S025)
`store::cookies` keeps Servo's public cookie jar in `<data>/cookies.bin`: the jar's JSON (Servo's own
`CookieStorage` format) sealed with XChaCha20-Poly1305 (`vault::seal`, AAD `nacre-cookies-v1`, magic `NACRECK1`).
The 256-bit key lives in the OS keyring (crate `keyring` 3: Secret Service on Linux, Credential Manager on Windows),
service `Nacre`, account `cookies <data folder>`. Loaded before Servo starts (`App::servo_first_setup`), saved by a
`cookie-saver` thread every 5 s when the jar changed and by servo-net at Exit (after "delete cookies when Nacre
closes" ran). Without a keyring cookies live for the run only and nothing is written (Settings → Privacy → Site data
says so). An old plain `engine/cookie_jar.json` is migrated once and deleted after the encrypted copy reads back; a
file that doesn't decrypt is moved to `cookies-unreadable-<time>.bin`. Incognito and private webviews write nothing.
`auth_cache.json` (HTTP auth) and `hsts_list.json` are still Servo's plain files.
## Privacy mode (S024)
Page script `PRIVACY_JS` (`inject.rs`) plus the servo-net switches (third-party cookies, Accept-Language list);
every surface, the choice made for it and the Cover Your Tracks result are in `docs/engine/privacy-mode.md`.
Paused per site (`privacy.mode_off`); on in incognito windows by default (`privacy.mode_incognito`).
Page script `PRIVACY_JS` (`inject.rs`) plus the web process extension and WebKit's third-party cookie policy; every
surface, the choice made for it and the Cover Your Tracks result are in `docs/engine/privacy-mode.md`. Paused per site
(`privacy.mode_off`); on in incognito windows by default (`privacy.mode_incognito`).
## UI system (S015)
@ -321,7 +239,7 @@ Enter continues, Escape skips, every choice is written to settings at once. Dial
over the page rect, `surface_container_high` card radius `XL`, padding 24, one shadow, eases in; title Headline, body
`on_surface_variant`, actions right with the main one last (Enter = main, Escape = cancel). Permission and find bars are
56 pt `surface_container_high` bars with real buttons. Selftest: `key <name>`, `welcome <step>`. The web error pages
(`assets/servo/{neterror,badcert,crash}.html`) use the same roles in CSS with a dark scheme.
(`assets/pages/*.html`) use the same roles in CSS with a dark scheme.
**Shapes** (`ui::paint`): `cookie(painter, center, radius, lobes, rotation, fill, stroke)`,
`cookie_image(painter, texture, center, radius, lobes, rotation)` (artwork in a cookie), `cookie_points`,
@ -432,7 +350,7 @@ See `docs/FEATURES.md`; every row names the file that implements it and its revi
- **Redirect rules** (`$redirect=<name>`): when Nacre has the stand-in (`adblock::resource`: noopjs, noop.txt,
noop.css, noopjson, noopframe, transparent images) the rule goes to the extension, which rewrites the request to
`nacre-resource:<name>` (URI scheme served by the browser, registered secure + CORS); stand-ins Nacre lacks
(google-ima.js, media files, …) become plain blocks, as before with Servo. Limits: an exception (`@@`) doesn't stop
(google-ima.js, media files, …) become plain blocks. Limits: an exception (`@@`) doesn't stop
an extension redirect; the extension can't see the resource type; third-party is "last two host labels differ".
- **Web process extension** (`webext/`, `libnacre_webext.so`, ~0.8 MB, minimal FFI — no maintained Rust bindings
for WebKit's web process extension API exist): config JSON (`net::rules::Config`: headers, strip, ad blocker

View file

@ -6,27 +6,27 @@ Every item of the settings screenshot and of the original Nacre's `config.py`, w
## Browser basics
| Feature | Where | State |
|---|---|---|
| Tabs: open, close, reorder by drag, pin, mute, duplicate, move to new window, close others/right | `actions.rs`, `ui/chrome.rs` | verified S006 (basics.txt: open, close, pin, mute, duplicate, move left/right); not checked: drag, move to new window, close others/right |
| Reopen closed tabs, recently closed list | `store/session.rs`, `actions.rs` | verified S006 (basics.txt); recently closed list not checked |
| Windows, incognito (separate process, temporary profile) | `main.rs`, `paths.rs` | verified S006 (new/close window: basics.txt, keys.txt); incognito not run (second process) |
| 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), 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 |
| Pop-ups / target=_blank as tabs, pop-up permission | `app.rs on_create_new` | verified S006 (basics.txt) |
| Single instance (links go to the running browser) | `instance.rs` | verified S006 (basics.txt `launch`: second process hands its link over and exits) |
| Session restore, crash recovery offer | `app.rs`, `store/session.rs` | verified S006 (restore.txt); crash recovery offer not checked |
| Error pages (network, certificate, crash) | `assets/servo/*.html`, `resources.rs` | verified S006 (network error page: keys.txt); certificate and crash pages not checked |
| Developer tools: console + eval, network log, source; Firefox remote debugging | `ui/pages/devtools.rs` | verified S006 (opens for the page: keys.txt shot); console eval, network log not checked |
| View source, save page, save as PDF/PNG (no printing in Servo) | `actions.rs`, `pdf.rs` | verified S006 (view source, file:// fixed: keys.txt); save page / PDF / PNG need a native file dialog, not run |
| QR code for page | `ui/menus.rs` | verified S006 (keys.txt shot) |
| 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` | verified S009 (integ-perf.txt, integ-idle-cpu.sh): `navigator.getGamepads()` exists and lists nothing without a device, idle CPU 0 %. Not checked: a real device (S010 list); rumble reports unsupported |
| 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 |
| Tabs: open, close, reorder by drag, pin, mute, duplicate, move to new window, close others/right | `actions.rs`, `ui/chrome.rs` | verified on Servo S006, re-verify on WebKit (basics.txt: open, close, pin, mute, duplicate, move left/right); not checked: drag, move to new window, close others/right |
| Reopen closed tabs, recently closed list | `store/session.rs`, `actions.rs` | verified on Servo S006, re-verify on WebKit (basics.txt); recently closed list not checked |
| Windows, incognito (separate process, temporary profile) | `main.rs`, `paths.rs` | verified on Servo S006, re-verify on WebKit (new/close window: basics.txt, keys.txt); incognito not run (second process) |
| Address bar: URL or search, suggestions (history, bookmarks, tabs, pages, engine), Alt+Enter new tab | `ui/chrome.rs`, `util::address_to_url` | verified on Servo S006, re-verify on WebKit (URL, search: basics.txt; suggestions: chrome.txt); Alt+Enter not checked |
| Back/forward (with history list), reload, hard reload, home | `actions.rs` | verified on Servo S006, re-verify on WebKit (back, forward, reload, hard reload, home: basics.txt, keys.txt); history list not checked; "stop" is `View::stop` |
| Find in page (count, next/previous, match case) | `engine/view.rs` (FindController), `ui/dialogs.rs` | verified on Servo S006, re-verify on WebKit (count, next, previous: basics.txt, keys.txt); match case not checked |
| Zoom per site, Ctrl+wheel | `actions.rs`, settings `web.zoom_sites` | verified on Servo S006, re-verify on WebKit (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 on Servo S006, re-verify on WebKit (basics.txt: F11, page request, Escape leaves) |
| Context menu (links, images, media, selection, spelling, page) | `ui/menus.rs` | verified on Servo S006, re-verify on WebKit (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 on Servo S006, re-verify on WebKit (alert, confirm, prompt, select, colour: dialogs.txt); HTTP sign-in, file picker, leave page not checked |
| Pop-ups / target=_blank as tabs, pop-up permission | `app.rs on_create_new` | verified on Servo S006, re-verify on WebKit (basics.txt) |
| Single instance (links go to the running browser) | `instance.rs` | verified on Servo S006, re-verify on WebKit (basics.txt `launch`: second process hands its link over and exits) |
| Session restore, crash recovery offer | `app.rs`, `store/session.rs` | verified on Servo S006, re-verify on WebKit (restore.txt); crash recovery offer not checked |
| Error pages (network, certificate, crash) | `assets/pages/badcert.html`, `resources.rs` | verified on Servo S006, re-verify on WebKit (network error page: keys.txt); certificate and crash pages not checked |
| Developer tools: console + eval, network log, source; Firefox remote debugging | `ui/pages/devtools.rs` | verified on Servo S006, re-verify on WebKit (opens for the page: keys.txt shot); console eval, network log not checked |
| View source, save page, save as PDF/PNG (WebKit print dialog separate) | `actions.rs`, `pdf.rs` | verified on Servo S006, re-verify on WebKit (view source, file:// fixed: keys.txt); save page / PDF / PNG need a native file dialog, not run |
| QR code for page | `ui/menus.rs` | verified on Servo S006, re-verify on WebKit (keys.txt shot) |
| Task manager, free up memory | `ui/pages/misc.rs` | verified on Servo S006, re-verify on WebKit (task manager opens: keys.txt); free memory not checked |
| Keyboard shortcuts, rebindable | `keys.rs`, settings | verified on Servo S006, re-verify on WebKit (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` | verified on Servo S009, re-verify on WebKit (integ-perf.txt, integ-idle-cpu.sh): `navigator.getGamepads()` exists and lists nothing without a device, idle CPU 0 %. Not checked: a real device (S010 list); rumble reports unsupported |
| Notifications (notify-send or in-app) | `app.rs` | permission asked, remembered, denied/granted to the page verified on Servo S008, re-verify on WebKit (site-memory*.txt); showing the notification itself (notify-send) not checked |
## General (screenshot)
| Setting | State |
@ -36,9 +36,9 @@ Every item of the settings screenshot and of the original Nacre's `config.py`, w
| Home page | written |
| Search engine (+ custom engines, suggestions) | written |
| Profiles (list, add, delete, open) | written |
| Spell check (languages, dictionaries downloaded, suggestions, add word) | verified S009 (integ-spell.txt, tiny offline dictionary): wrong words underlined, the context menu on one lists suggestions, choosing one replaces the word. Fixed: the menu got no word in text fields (S009). Not checked: download of a dictionary, add word, several languages, the settings page |
| Spell check (languages, dictionaries downloaded, suggestions, add word) | verified on Servo S009, re-verify on WebKit (integ-spell.txt, tiny offline dictionary): wrong words underlined, the context menu on one lists suggestions, choosing one replaces the word. Fixed: the menu got no word in text fields (S009). Not checked: download of a dictionary, add word, several languages, the settings page |
| Keyboard shortcuts | written |
| 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 |
| Import from another browser (Chromium/Firefox families; bookmarks file; passwords CSV) | verified on Servo S008, re-verify on WebKit (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 |
@ -65,30 +65,30 @@ written.
| Memory (use, threads, free up) | written (Linux numbers) |
| Low-memory mode auto/on/off | written |
| Energy saver off/battery/always | written |
| Memory saver (unload after) | verified S009 (integ-perf.txt, see Freeze); `status` shows memory 288 MB and 54 threads with two tabs |
| Freeze background tabs | partial: stops drawing; Servo can't pause scripts. Verified S009 (integ-perf.txt): a hidden tab freezes after the set minutes, is unloaded after the discard minutes and loads again when shown |
| Memory saver (unload after) | verified on Servo S009, re-verify on WebKit (integ-perf.txt, see Freeze); `status` shows memory 288 MB and 54 threads with two tabs |
| Freeze background tabs | partial: stops drawing; WebKit can't pause scripts. Verified S009 (integ-perf.txt): a hidden tab freezes after the set minutes, is unloaded after the discard minutes and loads again when shown |
| Always keep these sites active | written |
| Load restored tabs when opened | written |
| Preload pages | written (DNS warm-up) |
| Smooth scrolling | written (CSS) |
| Still new tab background | written |
| Save data | verified S023 (privacy-net.txt): `Save-Data: on` header (vendored servo-net) plus the JS hint |
| Save data | verified on Servo S023, re-verify on WebKit (privacy-net.txt): `Save-Data: on` header (web process extension since S049) plus the JS hint |
| Hardware acceleration | written (software GL, restart) |
## Privacy
| Setting | State |
|---|---|
| VPN: Tor (system, Tor Browser, or started) or custom SOCKS5/HTTP, kill switch while connecting | written (`net/bridge.rs`, `net/tor.rs`); S007 verified the bridge with the VPN off (net-privacy.txt: route Direct, every connection through it, traffic counted live); Tor and proxies never run in tests (user rule), kill switch not checked |
| Privacy mode (+ in incognito) | verified S024 (privacy-mode.txt, privacy-incognito.txt, privacy-net.txt, coveryourtracks.txt): canvas/WebGL/audio/font noise, common screen/CPU/platform/touch/WebGL values, Firefox-style languages and Accept-Language, third-party cookies blocked incl. frames' document.cookie, paused per site, on in incognito; details `docs/engine/privacy-mode.md` |
| 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) | 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. Privacy mode is paused per site from the shield menu (S024) |
| Privacy mode (+ in incognito) | verified on Servo S024, re-verify on WebKit (privacy-mode.txt, privacy-incognito.txt, privacy-net.txt, coveryourtracks.txt): canvas/WebGL/audio/font noise, common screen/CPU/platform/touch/WebGL values, Firefox-style languages and Accept-Language, third-party cookies blocked incl. frames' document.cookie, paused per site, on in incognito; details `docs/engine/privacy-mode.md` |
| Secure DNS (Cloudflare, Quad9, Google, Mullvad, AdGuard, custom) | verified on Servo S007, re-verify on WebKit 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 on Servo S007, re-verify on WebKit (net-privacy.txt: upgrade via the `location.replace()` page, certificate warning "Open anyway" , 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) | verified on Servo S008, re-verify on WebKit (site-memory*.txt, restart): stored per site, applied again after a restart. Enforced: pop-ups, notifications, sound (tab muted on load), open-other-apps; media stream, location and notifications are asked per use. Not yet enforced on WebKit or unavailable: images, persistent storage, JavaScript per site, MIDI, Bluetooth, wake lock, clipboard (see DESIGN.md "Engine limits"). Privacy mode is paused per site from the shield menu (S024) |
| Delete browsing data (+ on exit) | written |
| Send Do Not Track and GPC | verified S023 (privacy-net.txt): `DNT: 1` + `Sec-GPC: 1` on every request (vendored servo-net), plus the JS properties |
| Remove tracking parameters | verified S007 (net-privacy.txt: utm_*/fbclid removed, other parameters kept, off keeps all) |
| Block third-party cookies | verified S023 (privacy-net.txt): cross-site requests send and store no cookies (vendored servo-net), same-site subdomains keep theirs, on in privacy mode. `document.cookie` in a cross-site frame: empty (S024, script layer) |
| Send Do Not Track and GPC | verified on Servo S023, re-verify on WebKit (privacy-net.txt): `DNT: 1` + `Sec-GPC: 1` on every request (web process extension since S049), plus the JS properties |
| Remove tracking parameters | verified on Servo S007, re-verify on WebKit (net-privacy.txt: utm_*/fbclid removed, other parameters kept, off keeps all) |
| Block third-party cookies | verified on Servo S023, re-verify on WebKit (privacy-net.txt): cross-site requests send and store no cookies (web process extension since S049), same-site subdomains keep theirs, on in privacy mode. `document.cookie` in a cross-site frame: empty (S024, script layer) |
| Google sign-in quirk | written (UA switch + JS) |
| Sites where ad blocking is paused | verified S007 (net-adblock.txt), persisted S008 (site-memory*.txt) |
| Sites where ad blocking is paused | verified on Servo S007, re-verify on WebKit (net-adblock.txt), persisted S008 (site-memory*.txt) |
| Remote debugging, user agent | written |
## Ad blocker
@ -114,12 +114,12 @@ IDM (Windows), a file at an address with no hint (no extension, no "download"-li
## Media
Media button (when playing/always/never), player flyout (art, seek, controls, mute tab/site, PiP), visualizer
(cava / simulated / off), spin artwork, Discord Rich Presence (arRPC/Discord, per-site app IDs, browsing activity,
buttons, paused state): verified S009 (integ-discord.txt + integ-discord-check.sh, fake IPC server): handshake with the Settings app ID, SET_ACTIVITY with title, artist, progress bar, button, paused state and a browsing activity; the media state comes from the page's Media Session. Fixed R4-09: the large image falls back to the origin's /favicon.ico when the page's favicon is data:, http: or long. Not checked: real Discord, per-site IDs, display type, the media flyout, visualizer, mute, PiP (S005). Picture in picture (own always-on-top window; reloads the page in a web view
buttons, paused state): verified on Servo S009, re-verify on WebKit (integ-discord.txt + integ-discord-check.sh, fake IPC server): handshake with the Settings app ID, SET_ACTIVITY with title, artist, progress bar, button, paused state and a browsing activity; the media state comes from the page's Media Session. Fixed R4-09: the large image falls back to the origin's /favicon.ico when the page's favicon is data:, http: or long. Not checked: real Discord, per-site IDs, display type, the media flyout, visualizer, mute, PiP (S005). Picture in picture (own always-on-top window; reloads the page in a web view
of its own and seeks the video, page state lost, D-008): verified on Xvfb (S005). Protected content (Widevine): engine
limit, shown as unavailable.
Media Source Extensions (`MediaSource`, `SourceBuffer`; YouTube-style players): S026-S028, vendored crates and patched
gst_mse (DESIGN.md "Media and Media Source Extensions"); verified S028 (mse.txt, mse-player.txt: attach without
blocking, seek inside/outside buffered, rate, ended, decode error, garbage append; WPT media-source, see PROGRESS).
Media Source Extensions (`MediaSource`, `SourceBuffer`; YouTube-style players): WebKit's own (DESIGN.md "Media"); verified on Servo S028 with
patched crates, re-verify on WebKit (mse.txt, mse-player.txt: attach without blocking, seek inside/outside buffered,
rate, ended, decode error, garbage append).
## Passwords and autofill
Encrypted vault (device key or master password, auto-lock, re-ask before showing), save prompt, autofill, strong
@ -128,8 +128,8 @@ password suggestion, addresses and cards, CSV import/export, generator, weak/reu
## Apps
Install site as app (own window, launcher entry), desktop shortcut, user scripts and styles (stand-in for extensions):
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.
verified on Servo S008, re-verify on WebKit (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: verified S009 (integ-updates.txt, local fake Forgejo API): the notice says "Version 9.9.9 is available" and nothing is downloaded. Not checked: GitHub/GitLab address forms by smoke (unit tests only), the Get it button.
Version, engine, colour, profile paths, update repository, automatic and manual update check: verified on Servo S009, re-verify on WebKit (integ-updates.txt, local fake Forgejo API): the notice says "Version 9.9.9 is available" and nothing is downloaded. Not checked: GitHub/GitLab address forms by smoke (unit tests only), the Get it button.
(`updates.rs`).

View file

@ -1,17 +1,10 @@
# Review notes
Things to check or fix in the review passes before the first build. Remove an item when it is done.
Things to check or fix in the review passes. Remove an item when it is done.
- discord.rs on Windows: named-pipe reads block (no read timeout on `File`). Read only during the handshake
there, or use a reader thread.
- Done in S023: request headers (DNT, Sec-GPC, Save-Data) and third-party cookie blocking are patches in the
vendored servo-net (docs/DESIGN.md "Vendored servo-net patches"); `document.cookie` in cross-site frames is not covered.
- Servo's request interceptor holds a global lock while the embedder answers: `load_web_resource` must answer
synchronously, never keep a `WebResourceLoad` waiting.
- Intercepted responses skip redirect handling, so HTTPS-only and tracking-parameter stripping serve a tiny page
that calls `location.replace()` instead of a 30x.
- Google sign-in quirk: the user agent is a global pref; switching it for accounts.google.com affects requests of
other tabs made at that moment.
- Google sign-in quirk: the user agent override for accounts.google.com is per view (`set_view_user_agent`); re-check on WebKit.
- Settings → Downloads "Save to" and the new tab image picker open rfd dialogs on the main thread, which stalls
page rendering while they are open. Move them to `App::spawn` like the other file dialogs.
- Autofill fills logins with `evaluate_javascript`, which runs in the top document only: login forms inside

View file

@ -1,5 +1,8 @@
# Privacy mode (S024, R1-16)
> Written for the Servo engine (removed in S053). The *How it works* table is updated for WebKit; the *Surfaces* tables and
> numbers below are historical (Servo 0.7) until privacy mode is re-measured on WebKit.
Privacy mode hides what makes Nacre stand out, so sites can't recognise the browser without cookies. It is on
when Settings → Privacy → Privacy mode is on, and in incognito windows unless "Always on in incognito windows" is
off. It can be paused per site from the shield menu (`privacy.mode_off`). Changes apply from each page's next load.
@ -8,8 +11,8 @@ off. It can be paused per site from the shield menu (`privacy.mode_off`). Change
| Layer | Where | What |
|---|---|---|
| Page script | `inject.rs` `PRIVACY_JS` (`privacy_script`) | runs at document start in every document Servo parses (frames too), and reaches same-origin frames made by script through `contentWindow` / `contentDocument` |
| Network | `vendor/servo-net/nacre.rs` | third-party cookies blocked (S023), Accept-Language as Firefox's list (`set_language_list`) |
| Page script | `inject.rs` `PRIVACY_JS` (`privacy_script`) | runs at document start in every document the engine parses (frames too), and reaches same-origin frames made by script through `contentWindow` / `contentDocument` |
| Network | web process extension (`webext/`) and WebKit's cookie policy | third-party cookies blocked, Accept-Language as Firefox's list (`Engine::set_languages`) |
| Frame cookies | `inject.rs` `FRAME_COOKIE_JS` | `document.cookie` empty and not stored in a frame whose top page is another site (on whenever third-party cookies are blocked) |
Noise is seeded by a random value per run (`Shared::seed`) plus the top-level site (last two host labels; a