servo-cleanup: Servo removal inventory, drop the WPT MSE runner

docs/engine/servo-removal.md lists every Servo-dependent piece (deps, vendor
crates, src/ hooks with the WebKit replacement each needs, docs, tests/tools)
for the 08 WebKit plans. tools/wpt-mse.sh and tests/wpt-mse/ only tested
Nacre's Servo MSE and nothing else uses them. src/, Cargo.toml and vendor/
are untouched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-11-12 23:41:37 -06:00
commit baa3b7f896
8 changed files with 266 additions and 177 deletions

View file

@ -35,7 +35,7 @@ Never modify: `~/Documents/Apps/Nacre` (the original Python Nacre, reference onl
## 2. Facts ## 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/`. - **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. - 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. - 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.
@ -76,7 +76,6 @@ Never modify: `~/Documents/Apps/Nacre` (the original Python Nacre, reference onl
| `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) | | `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 | | `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) | | `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) |
| `tools/wpt-mse.sh [outdir] [file ...]` | WPT media-source subset (60 files) in a hidden run; first run sparse-clones WPT at a pinned commit into `target/wpt` (needs internet once); prints subtest pass counts, results in `<outdir>/wpt/results.json`; ~45 min | S027 |
| `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) | | `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) | | `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 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 |

View file

@ -197,7 +197,7 @@ Plain `<video>`/`<audio>` play through servo-media's GStreamer backend (playbin3
| `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` | | `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 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), `tools/wpt-mse.sh` (WPT media-source). Background: `docs/engine/mse-spike.md`. gaps), `tools/gst-mse.sh test` (C tests). Background: `docs/engine/mse-spike.md`.
## Cookies at rest (S025) ## Cookies at rest (S025)

View file

@ -337,6 +337,11 @@ Later: S010 list: user checks the Discord icon with their own client (the Discor
- Seen: `/mse/split-audio-video` final ready-state check failed 2 in ~70 rounds after patch 12 (0 in 24 before; msesrc reads position from pad segments, Nacre's DOM computes readyState itself). - Seen: `/mse/split-audio-video` final ready-state check failed 2 in ~70 rounds after patch 12 (0 in 24 before; msesrc reads position from pad segments, Nacre's DOM computes readyState itself).
- Later: `endOfStream()` aborts gst's parser but not `ByteStreamCheck` (a page continuing a cut box after reopen would differ); a real `tools/refshot.py` (S029). - Later: `endOfStream()` aborts gst's parser but not `ByteStreamCheck` (a page continuing a cut box after reopen would differ); a real `tools/refshot.py` (S029).
## servo-cleanup — Servo removal inventory (D-032, 2026-11-12)
- Done: `docs/engine/servo-removal.md`: Cargo deps/patches, vendor crates and why, src/ hooks by engine area with the WebKit replacement each needs, docs sections, Servo-only vs kept tests/tools, suggested removal order.
- Removed: `tools/wpt-mse.sh`, `tests/wpt-mse/` (Servo MSE conformance, nothing else used them) and their CLAUDE.md/DESIGN.md mentions.
- Not done (on purpose): src/, Cargo.toml, vendor/, build.rs, gst-mse tools and MSE/painter smoke scripts stay until the WebKit glue builds. No cargo run.
## Later ## Later
- Turnstile widget paints as a black half-disc (Servo painting of its iframe/shadow DOM, S006 site doctor). - 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). - Google sign-in past the email step: press Next with a real account, by the user (S006).

View file

@ -0,0 +1,259 @@
# Servo removal inventory (D-032)
Everything in the repo that exists only because the engine is Servo 0.7, and what the WebKit glue must provide in
its place. Written 2026-11-12 from the code at `8b11e5d`. **Nothing here is removed until the WebKit glue builds and
the kept smoke scripts pass on it**; the only removal done now is the WPT MSE runner (§6).
Legend: **remove** = goes with Servo; **port** = keep the idea/file, rewrite against WebKit; **keep** = engine-agnostic.
## 1. Cargo.toml and build.rs
| Item | Why it is there | Fate |
|---|---|---|
| `servo = "=0.7.0"` (features `bundled_freetype`, `clipboard`, `js_jit`, `webgl`, `webcrypto`, `brotli-compression-stream`, `gamepad`, `bluetooth`, `native-bluetooth`) | the engine | remove |
| feature `media = ["servo/media-gstreamer"]` (default) | `<video>`/`<audio>` through servo-media | remove (WebKit has its own GStreamer media) |
| `servo-net = "=0.7.0"` | direct dep so `src/` can call the vendored `net::nacre` module (headers, third-party cookies, cookie jar) | remove |
| `[patch.crates-io]` `servo-net`, `servo-script`, `servo-script-bindings`, `servo-media`, `servo-media-player`, `servo-media-gstreamer` | vendored Servo crates (§2) | remove |
| `[patch.crates-io]` `epaint = vendor/epaint` | epaint 0.37.0 panics when **Servo's canvas** turns on vello_cpu multithreading; the copy renders glyphs single-threaded | remove with Servo (only Servo triggers it); re-check egui text rendering afterwards |
| `content-security-policy = "0.9"` | only for `content_security_policy::Destination` in `hub.rs` `destination_name` | remove (WebKit gives no CSP type; resource type comes from the WebKit request) |
| `euclid`, `dpi`, `keyboard-types`, `http` | Servo's geometry/scale types, W3C key events (`keys::to_servo`), `WebResourceResponse` headers | check after glue: `keyboard-types` and `euclid` likely go; `http` may stay for `net/` |
| `rusqlite = "0.38"` comment "the same version Servo uses" | version pin chosen to share Servo's | keep, drop the pin reason |
| `gilrs` "(Servo gets gamepad input from the embedder)" | Gamepad API input fed to Servo | WebKitGTK reads gamepads itself (libmanette); remove `gilrs` + `App::poll_gamepads` unless WPE needs it |
| `winit`/`egui_glow`/`glow` version comment "follow what Servo 0.7 … use" | shared GL types with Servo | keep; free to update once Servo is gone |
| `description = "… built on Servo"` | metadata | change to WebKit |
| `build.rs` rpath `$ORIGIN/lib:$ORIGIN/../gst-mse/lib` | makes the patched `libgstmse-1.0.so.0` win over the system copy | remove (WebKit uses the system GStreamer) |
## 2. vendor/
| Crate | Why vendored | Patch list | Fate |
|---|---|---|---|
| `vendor/servo-net` | HTTP/2 header limit 256 KiB (YouTube, D-012); `chrome:allowcert` for the certificate warning (D-014); memory→disk HTTP cache flush at quit (D-014); `nacre.rs` module: extra request headers DNT/Sec-GPC/Save-Data, third-party cookie blocking incl. WebSockets, top-level site per webview (S023); cookie jar to/from the embedder instead of plain `cookie_jar.json` (S025, D-019); Firefox-style Accept-Language in privacy mode (S024) | DESIGN.md "Vendored servo-net patches" | remove |
| `vendor/servo-script` | timers rooted against GC (R5-01, S031); Media Source Extensions DOM (S022-S028) | DESIGN.md "Vendored servo-script patches", `grep -rn Nacre vendor/servo-script` | remove |
| `vendor/servo-script-bindings` | MSE WebIDL (`MediaSource`, `SourceBuffer`, `SourceBufferList`) | DESIGN.md "Media and Media Source Extensions" | remove |
| `vendor/servo-media`, `vendor/servo-media-player` | MSE backend traits, `MseEvent`, helpers | same | remove |
| `vendor/servo-media-gstreamer` | MSE backend over gst_mse, byte-stream check, non-blocking player setup, codec table | same | remove |
| `vendor/gst-mse` | patched gst-plugins-bad 1.28.9 `libgstmse` + `msesrc` (update-end after parse, no idle updates, wait for every init segment, …) | `docs/engine/gst-mse-patches.md`, `vendor/gst-mse/nacre.patch` | remove; keep `docs/engine/gst-mse-patches.md` as the upstream write-up (no MR opened yet) |
| `vendor/epaint` | see §1 | `vendor/epaint/src/text/font_face.rs` end | remove with Servo |
## 3. src/ — Servo hooks and what WebKit must provide
`grep -rlE "servo::|use servo|WebView" src` → `app.rs`, `hub.rs`, `window.rs`, `tabs.rs`, `actions.rs`,
`resources.rs`, `selftest.rs`, `inject.rs`, `ui/{mod,chrome,dialogs,menus}.rs`, `ui/pages/devtools.rs`; plus
`store/cookies.rs` (`net::nacre`). Engine-agnostic and kept: `store/*` (except cookies glue), `net/*` (bridge,
fetch, tor, dns, download, dlm), `adblock.rs`, `ui/*` widgets/pages/paint/theme, `media.rs`, `discord.rs`,
`spell.rs`, `importer.rs`, `instance.rs`, `paths.rs`, `perf.rs`, `updates.rs`, `pdf.rs`, `util.rs`.
The central design to keep: **engine callbacks become `hub::Event`s that `App::handle_event` handles after each
spin** (`hub.rs` header). The WebKit glue should produce the same `Event` enum (with a Nacre-owned tab/view id
instead of `WebViewId`) so `app.rs`/`actions.rs` change as little as possible.
### 3.1 Engine start, event loop, shutdown (`app.rs`)
| Function | Servo use | WebKit must provide |
|---|---|---|
| `App::start_servo` | `Preferences` (UA, proxy = bridge, dom_* switches, webrender workers, lite mode: layout threads, history length, cache size; disk cache path; devtools server; background colour), `Opts` (config_dir, temporary_storage), `ServoBuilder`, `set_delegate`, `UserContentManager` | a `WebContext`/`NetworkSession` per profile (persistent data dirs, ephemeral for incognito), proxy settings = bridge URL, UA, cache model + memory limit from `docs/engine/tune/`, inspector switch, background colour |
| `Waker` (`EventLoopWaker`), `App::spin` (`spin_event_loop` until quiet) | Servo's run loop pumped from winit | integrate the GLib main context with winit (pump `g_main_context_iteration` or run GLib on its own thread) |
| `App::quit`, `exiting` | drop every WebView/request/UCM handle before GL contexts (SpiderMonkey teardown crash) | orderly WebView/context teardown |
| `servo_first_setup` | cookies loaded before Servo starts | cookie storage setup (§3.8) |
| `rustls_provider` | rustls provider before Servo/ureq TLS | keep for ureq only |
| `update_screen` → `hub.screen` → `WebViewDelegate::screen_geometry` | `window.screen`/`outerWidth` for pages | WebKit reads the real screen; drop unless privacy mode needs a fixed size |
| `web_dark`, `restyle_all` → `notify_theme_change(Theme)` | `prefers-color-scheme` | WebKit settings/`gtk-application-prefer-dark-theme` or per-view colour scheme |
### 3.2 Delegates (`hub.rs` `impl WebViewDelegate/ServoDelegate for Hub`, handled in `app.rs handle_event`)
| Servo callback → `Event` | App handler | WebKit equivalent needed |
|---|---|---|
| `notify_url_changed` (+ `net::nacre::set_top_level_url`) | `UrlChanged` | `notify::uri` |
| `notify_page_title_changed` | `TitleChanged` | `notify::title` |
| `notify_status_text_changed` | `StatusText` | `mouse-target-changed` (link hover URL) |
| `notify_load_status_changed` (`Started`/`HeadParsed`/`Complete`) | `on_load_status` (PiP start, mute, cosmetic filters) | `load-changed` + `estimated-load-progress` (the chrome's `load_estimate` can use real progress) |
| `notify_cursor_changed` | `Cursor` → `window::cursor_icon` | with offscreen WPE: cursor from the view backend; with GTK widget: none needed |
| `notify_favicon_changed` + `WebView::favicon()` | `on_favicon` (PixelFormat → RGBA) | `notify::favicon` / FaviconDatabase (cairo surface → RGBA) |
| `notify_new_frame_ready` | `on_frame` → paint | frame-available from the view backend (§3.5) |
| `notify_history_changed` | `History` (back/forward lists) | `BackForwardList` `changed` |
| `notify_closed`, `notify_crashed` | close tab / crash page | `close`, `web-process-terminated` |
| `notify_media_session_event` (metadata, playback state, position) | MPRIS/Discord/new tab media card | WebKit has no embedder Media Session API: keep Nacre's page-script media probe (`inject.rs` `media.*`), or `is-playing-audio` |
| `notify_fullscreen_state_changed` | `Fullscreen` | `enter-fullscreen` / `leave-fullscreen` |
| `notify_animating_changed` | `Animating` (redraw pacing) | frame callbacks from the backend |
| `request_navigation` | `actions::on_navigation` (app scope, external schemes, pop-up rules) | `decide-policy` NAVIGATION_ACTION |
| `request_unload` | leave-page dialog | WebKit runs `beforeunload` itself (`run-dialog` BEFORE_UNLOAD_CONFIRM) |
| `request_create_new` | `on_create_new` (pop-ups as tabs) | `create` signal returning a new view (related view: same web process) |
| `request_permission` (`PermissionFeature` → `store::permissions::Kind`) | `on_permission` | `permission-request` (geolocation, notifications, user media, device info, pointer lock, media key system later) |
| `request_authentication` | HTTP sign-in dialog | `authenticate` |
| `request_protocol_handler` | protocol handler prompt | none in WebKitGTK: show as unavailable |
| `request_resize_to` | ignored/handled | none needed |
| `show_bluetooth_device_dialog` | device picker | WebKit has no Web Bluetooth: show as unavailable |
| `show_embedder_control` / `hide_embedder_control` (`SelectElement`, `ColorPicker`, `FilePicker`, `InputMethod`, `SimpleDialog`, `ContextMenu`) | `on_control` → `tabs::Dialog`, `ui/dialogs.rs`, `ui/menus.rs PageMenu` | `run-dialog` (alert/confirm/prompt), `run-file-chooser`, `run-color-chooser`, `show-option-menu` (select), `context-menu` (with `HitTestResult`), input-method context (WPE) |
| `show_notification` | `on_notification` (system notification) | `show-notification` |
| `show_console_message` | devtools console (`tabs::ConsoleLine`) | no signal in WebKitGTK: page script hooking `console.*` → script message, or drop for Web Inspector |
| `notify_error` | log | `load-failed`, `load-failed-with-tls-errors` |
| `notify_devtools_server_started`, `request_devtools_connection` | remote debugging on 127.0.0.1:6080 | Web Inspector (`enable-developer-extras`, `webkit_web_inspector_show`) |
| `load_web_resource` (both delegates) → `Hub::decide` | HTTPS-only upgrade, tracking-param strip, Google UA quirk, image permission, ad blocker (block / replace body), blocked counts, network log | see §3.6 |
| `GamepadDelegate::handle_haptic_effect_request` (`hub::Gamepads`) | rumble via gilrs | WebKit handles gamepads itself |
### 3.3 Navigation and page control (`actions.rs`, `app.rs`)
| Where | Servo call | WebKit |
|---|---|---|
| `App::build_webview_in`, `on_create_new` | `WebViewBuilder` (rendering context, hidpi, delegate, gamepad delegate, UCM), `set_page_zoom`, `notify_theme_change` | create view with shared context/UCM, settings, zoom |
| `actions::load_in_active_tab`, `new_tab`, `ensure_loaded` | `load(Url)` | `load_uri` |
| `go_back`, `check_app_scope` | `can_go_back`/`go_back(1)` (+ forward) | `can_go_back`/`go_back` |
| reload / hard reload | `reload()` | `reload` / `reload_bypass_cache` |
| "stop" | none in Servo 0.7 | `stop_loading` (new feature) |
| zoom (`actions.rs` 410, 2505) | `set_page_zoom` | `set_zoom_level` |
| `eval`, `eval_pip`, cosmetic filters, autofill, media actions, find | `evaluate_javascript(script, cb)` with `JSValue` | `evaluate_javascript` (JSCValue → `serde_json`; selftest needs Bool/String/Number/Array) |
| `on_page_message` (`inject::PageMessage`) | page → browser channel built on Servo | `UserContentManager` script message handler `nacre` |
| `install_page_scripts` | `UserScript` per document, user styles | `WebKitUserScript` (document-start, all frames), `WebKitUserStyleSheet` |
| `rest_background_tabs`, `close_tab`, `close_window` | `hide()`, `hub.forget` | hide/suspend view; WebKit can actually freeze scripts (old "limited" row in settings) |
| `on_favicon`, `save_page`, `pdf.rs` | favicon image, full-page screenshot | `get_snapshot`, `WebKitPrintOperation` for real PDF (new) |
| `menu_action` (`servo::ContextMenuAction` back/forward/reload/cut/copy/paste/select all/open link/copy link/image) | `ContextMenu::select` | `execute_editing_command` + Nacre's own actions |
| `enter_pip`/`exit_pip` | reloads page in a separate WebView (one painter per window, D-008) | can move the view instead; page state kept |
### 3.4 Input (`window.rs`, `app.rs window_event`, `keys.rs`, `selftest.rs`)
`send_mouse_move`, `send_mouse_button`, `send_wheel`, `send_touch`, `page_point(_clamped)`, `MouseLeftViewport`,
`set_focused`, keyboard (`keys::to_servo` → `InputEvent::Keyboard`), IME (`CompositionEvent` / `ImeEvent`,
`ui::mod ime_control`), selftest `click`/`pagetype`/`pagescroll`. WebKit: with WPE, feed `wpe_input_*` events
(pointer, axis, keyboard with XKB keysym, touch) and IME through the input-method context; with a GTK widget, events
go to GTK directly and only the selftest needs synthetic events.
### 3.5 Painting / GL (`window.rs`, `tabs.rs`, `app.rs on_frame`)
`BrowserWindow` owns a `WindowRenderingContext`; each tab has an `OffscreenRenderingContext` (`new_context`,
`pip_context`); `paint_page`/`paint_unshown`/`paint_pip`/`present`, `page_callback` (egui `PaintCallback` from
`render_to_parent_callback`), `take_pip_frame`, `resized` → `WebView::resize`, `hidpi()` (`Scale<DeviceIndependentPixel,
DevicePixel>`), `device_rect_to_ui`, `css_point_to_ui`, `sync_webviews` (show/hide, focus). WebKit: the spike decides
(WPE + FDO/`wpe-platform` exporting dmabuf/EGLImage → egui texture, or WebKitGTK widget beside a GL area). Needed:
a texture per tab for the egui page card, resize + device scale, frame-ready signal, PiP second surface.
### 3.6 Network interception (`hub.rs decide`, `actions.rs request_headers`)
Servo let the embedder answer every request synchronously (`WebResourceLoad::intercept`). WebKit has no
synchronous embedder hook for subresources:
- main-frame HTTPS-only and tracking-param strip → `decide-policy` (navigation) can rewrite/redirect;
- ad blocker block → `WebKitUserContentFilterStore` (content blockers compiled from the adblock rules; DESIGN.md
must document the conversion) or a web-process extension `send-request` (can cancel/redirect, no body replace);
- ad blocker `Replace(mime, body)` (redirect resources) → web extension `send-request` redirect to a
`nacre-resource:` URI scheme handler (`register_uri_scheme`);
- image permission per site → content blocker rule or extension;
- blocked counts / devtools network log (`NetEntry`) → web extension messages, or `resource-load-started`;
- Google sign-in UA quirk (`set_preference("user_agent")`) → per-view `user-agent` setting;
- `serve_page` (intercepted responses), certificate warning `chrome:allowcert` → `load-failed-with-tls-errors` +
`allow_tls_certificate_for_host`.
Proxy through the bridge stays (`NetworkProxySettings`).
### 3.7 Privacy (`net::nacre` in vendored servo-net, `inject.rs PRIVACY_JS`)
`set_extra_request_headers` (DNT, Sec-GPC, Save-Data) → web extension `send-request` adds headers;
`set_block_third_party_cookies` → `CookieManager` accept policy `NO_THIRD_PARTY` (frame `document.cookie` covered
natively, `FRAME_COOKIE_JS` can go); `set_language_list`/`accept_language` → `set_preferred_languages`;
`set_top_level_url`/`forget_webview` → not needed. Per-WebView private mode was impossible in Servo; WebKit has
ephemeral `NetworkSession` (incognito in-process). `inject.rs` Servo-specific shims to drop or re-check: Servo UA
cleanup (`mainstream_ua`, `without_servo`), `SVG_COLOR_JS`, WebGL vendor "Mozilla/Servo", `FONTS_CHECK_JS`,
`COMPRESSOR_JS`, caret/`caretRangeFromPoint` workaround (line 133), seek-then-play freeze workaround (line 296),
navigator platform/version fixes. Unit tests in `hub.rs` (`privacy_language_list_is_firefox_style`,
`privacy_headers_follow_the_settings_and_reach_requests`, `third_party_matching_keeps_same_site_subdomains`) use
`net::nacre`: move the pure parts (`privacy_headers`, `strip_tracking`, language list) out of `hub.rs` first.
### 3.8 Cookies and site data (`store/cookies.rs`, `app.rs clear_on_exit`, `actions.rs clear_data`, site info)
`net::nacre::set_cookie_persistence`/`cookie_jar_snapshot` (encrypted `cookies.bin`, D-019),
`site_data_manager()` (`site_data`, `clear_site_data`, `clear_cookies`, `cookies_for_url` for the site info flyout
and `request_headers`), `network_manager().clear_cache()`, `servo::StorageType`. WebKit: `WebsiteDataManager`
(fetch/remove by type and since-time — the "Servo keeps no dates" note in `ui/pages/misc.rs` goes away),
`CookieManager` (`get_cookies`, persistent storage is SQLite: D-019 encryption-at-rest needs a new decision —
keep cookies in memory and seal a dump, or accept WebKit's file).
### 3.9 Media (`app.rs` MediaSession, `media.rs`, PiP)
Servo MediaSession events feed MPRIS/Discord/new tab card; MSE came from the vendored crates. WebKit: native MSE/EME
(Widevine later, own plan), `is-playing-audio`, `set_is_muted` (replaces `media.act mute` script); media metadata
still via page script.
### 3.10 Devtools (`ui/pages/devtools.rs`)
Console (from `show_console_message`, `ConsoleLogLevel` colours) and network (`hub.net_log`) tabs. WebKit: Web
Inspector replaces both or feeds them; keep the page if the log sources (§3.2, §3.6) are ported.
### 3.11 Selftest (`selftest.rs`)
Engine-agnostic commands; Servo bits only: `JSValue` matches (lines 166, 434, 452, 495), `InputEvent::Keyboard` for
`pagetype` (558), `fakeload` sets `servo::LoadStatus` (669, 673). Port with the glue's JS-result and load-state types.
### 3.12 Other Servo references
- `resources.rs` + `assets/servo/*` (gatt_blocklist, public_domains, hsts_preload, badcert, neterror, crash,
directory-listing, about-memory, debugger.js, json-viewer, rippy.png): Servo's resource reader → remove;
error pages become Nacre's own (`load-failed` → `load_alternate_html`), port `neterror.html`/`badcert.html` look.
- `tabs.rs`: `Web { webview, context }`, `Prompt`/`Dialog` variants holding Servo request objects, `ConsoleLine.level`,
`Tab.cursor`, `load_status: Option<LoadStatus>` → glue types.
- `ui/chrome.rs load_estimate` (Servo stages) → real progress.
- `ui/menus.rs PageMenu` (`servo::ContextMenu`, `MenuAction::Servo`), `ui/dialogs.rs` (`SimpleDialog`, `SelectElement`,
`device_rect`), `ui/mod.rs ime_control`.
- `store/permissions.rs` `unavailable()` reasons ("Servo 0.7 …") → recompute for WebKit (location, camera, mic,
storage, per-site JavaScript are all possible in WebKit).
- User-visible text: `ui/pages/settings.rs` (freeze tabs "Servo can't pause", Widevine row, About "built on the
Servo engine", "Engine Servo 0.7.0 …"), `ui/pages/misc.rs` (clear data "Servo keeps no dates", about, licence
"Servo and Nacre", task manager "Servo runs every page in Nacre's own process").
- `paths.rs APP_DIR = "nacre-servo"`: profile folder name; decide on a migration (D-needed) before renaming.
- `keys.rs to_servo` name and header.
## 4. Docs
| Doc / section | Fate |
|---|---|
| DESIGN.md "Servo 0.7 embedding cheat sheet" | replace with a WebKit API cheat sheet |
| DESIGN.md "Engine limits" | rewrite: most Servo limits go (DRM later, printing, PiP state, SVG currentColor, mask-image, fingerprint gaps); keep the "shown as unavailable" rule |
| DESIGN.md "Vendored servo-net patches", "Vendored servo-script patches" (incl. the third-party rule text) | remove; the third-party rule moves to WebKit's cookie policy note |
| DESIGN.md "Media and Media Source Extensions (S022-S028)" | remove; one line: MSE/EME native in WebKit |
| DESIGN.md "Cookies at rest (S025)", "Privacy mode (S024)" | rewrite for WebKit storage and switches |
| DESIGN.md "Layout", "How the pieces fit" | update `hub.rs`/`window.rs` descriptions |
| REVIEW.md | items on `load_web_resource` lock, intercepted responses skip redirects, global UA quirk, servo-net S023 note: remove with the glue; discord/rfd/autofill items stay |
| FEATURES.md | every "verified Sxxx" state was on Servo: reset to "to re-verify on WebKit" when the glue lands; rows citing Servo limits ("stop has no Servo API", `assets/servo/*.html`, "no printing in Servo", "Servo can't pause scripts", "vendored servo-net") need new states |
| `docs/S027-handoff.md` | Servo MSE handoff, obsolete → remove with the vendored crates |
| `docs/engine/mse-spike.md` | Servo MSE spike background → remove with the vendored crates |
| `docs/engine/gst-mse-patches.md` | keep (upstream write-up for GStreamer) |
| `docs/engine/privacy-mode.md` | rewrite the Servo surfaces part after re-measuring on WebKit |
| `docs/engine/engine-comparison*`, `docs/engine/tune/`, `runs/` | keep (decision record) |
| `docs/review/phase*.md`, PROGRESS.md, DECISIONS.md | history, keep |
| CLAUDE.md §2 Servo facts, §4 pitfalls (clang, lock versions, Servo 0.7 can't…, several painters), §5 rows below | rewrite with the glue plan |
## 5. Tests and tools
Kept and ported (engine-agnostic): `tools/smoke.sh`, `tools/check-shots.py`, `tools/icons.py`, `tools/refshot.py`
(Chromium reference shots), `tools/engine-test/` (comparison record; `servo_script.py` and the `servo` arm of
`run.sh` become dead once Servo is gone — the engine-test session owns that folder), `src/selftest.rs` commands,
every `tests/smoke/pages/*.html`/`.js`, `tests/smoke/net/`, `tests/smoke/cache/`, `tests/smoke/data/`, and the
smoke scripts not listed below (launch, restore, chrome, colours, input, basics, keys, dialogs, gallery, newtab*,
backgrounds, settings*, sliders*, pages-ui, stores-*, integ-*, net-*, cache*, cookies*, privacy-*, coveryourtracks,
site-memory*, site-doctor, heavy-web, https).
Servo-only, remove with the glue (they test code that stays in today's build, so they stay until then):
| Item | Why Servo-only |
|---|---|
| `tools/gst-mse.sh`, `tests/gst-mse/` (C tests + data) | build/test the patched gst_mse that `build.rs` loads for Servo's MSE |
| `tests/smoke/mse-off.txt` | `NACRE_DOM_MEDIA_SOURCE_ENABLED` is a Servo pref override |
| `tests/smoke/mse-leak-check.sh` | reads vendored servo-script's "MSE: MediaSource … created/freed" log lines |
| `tests/smoke/mse.txt`, `mse-player.txt`, `youtube-mse.txt` | port: the pages (`mse-basic.html`, `mse-spec.html`, `mse-player.html`) are plain MSE tests and stay useful on WebKit; drop the leak case/log checks |
| `tests/smoke/painters.txt`, `painters-perf.txt` | Servo's one-painter-per-tab GL question (S005, D-008); port the idea (N tabs paint the right page) to the WebKit surface |
| `tests/smoke/crash-adblock.txt` | R5-01 Servo timer GC crash regression; keep the page as a blocking stress test if cheap |
| `tests/smoke/privacy-net.txt` | header comment cites vendored servo-net; the checks (headers, third-party cookies, Accept-Language) are what the WebKit port must pass: keep, update the comment |
Removed now (§6): `tools/wpt-mse.sh`, `tests/wpt-mse/` (driver, server, testharnessreport).
## 6. Removed in `servo-cleanup` (2026-11-12)
- `tools/wpt-mse.sh` and `tests/wpt-mse/`: WPT media-source conformance of Nacre's own Servo MSE (S027, 239/407).
Nothing in the build or another test uses them; WebKit's MSE is tested upstream. Last result stays in PROGRESS.md.
- CLAUDE.md §5 row for `tools/wpt-mse.sh`; the mention in DESIGN.md "Media and Media Source Extensions".
## 7. Suggested removal order (for the 08 plan)
1. Move pure logic out of Servo files (`hub.rs` `privacy_headers`, `strip_tracking`, `HubConfig`, adblock decision;
language list from `net::nacre`) with their unit tests, so it survives.
2. Glue lands behind the same `hub::Event` surface; `tabs.rs`/`window.rs` types swapped.
3. Delete `servo`, `servo-net`, `content-security-policy`, the `media` feature, `[patch.crates-io]`, `vendor/servo-*`,
`vendor/epaint`, `vendor/gst-mse`, `build.rs` rpath, `resources.rs`, `assets/servo/`, gilrs if unused.
4. Delete the §5 Servo-only tests/tools, rewrite DESIGN/REVIEW/FEATURES/CLAUDE.md sections (§4), user-visible text (§3.12).
5. `cargo build` + the kept smoke scripts on WebKit.

View file

@ -1,51 +0,0 @@
<!doctype html>
<html>
<!-- WPT media-source driver (tools/wpt-mse.sh): loads each test listed in tests.json in an iframe, waits for its
testharness completion (window.__wpt, from our testharnessreport.js) or TIMEOUT seconds, and keeps the results
in window.__all = { done, files: { <file>: { status, tests: [{name, status, message}] } } } and POSTs the files
map to /results (the server saves it). testharness test
status: 0 pass, 1 fail, 2 timeout, 3 not run, 4 precondition failed. -->
<head><meta charset="utf-8"><title>WPT MSE</title>
<style>body { font: 14px monospace; margin: 8px; } iframe { width: 640px; height: 360px; border: 1px solid #888; }</style>
</head>
<body>
<div id="head">WPT MSE</div>
<iframe id="f"></iframe>
<pre id="log"></pre>
<script>
const TIMEOUT = Number(new URLSearchParams(location.search).get('timeout') || 40);
const all = window.__all = { done: false, files: {} };
const log = (line) => { document.getElementById('log').textContent += line + '\n'; };
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
async function runOne(file) {
const frame = document.getElementById('f');
const path = '/media-source/' + file;
frame.src = path;
const deadline = Date.now() + TIMEOUT * 1000;
while (Date.now() < deadline) {
await sleep(250);
let result = null;
try { result = frame.contentWindow.__wpt; } catch (e) {}
if (result && result.done && result.path === path) return result;
}
return { done: false, status: 'driver-timeout', tests: [] };
}
async function run() {
const files = await (await fetch('tests.json')).json();
for (const file of files) {
const result = await runOne(file);
all.files[file] = result;
const pass = result.tests.filter((t) => t.status === 0).length;
log(file + ': ' + pass + '/' + result.tests.length + (result.done ? '' : ' (no completion)'));
document.getElementById('head').textContent = 'WPT MSE ' + Object.keys(all.files).length + '/' + files.length;
}
document.getElementById('f').src = 'about:blank';
await fetch('/results', { method: 'POST', body: JSON.stringify(all.files) });
all.done = true;
}
run().catch((e) => { all.error = String(e); all.done = true; });
</script>
</body>
</html>

View file

@ -1,42 +0,0 @@
#!/usr/bin/env python3
"""HTTP server for tools/wpt-mse.sh: serves a WPT checkout, with Nacre's testharnessreport.js, the driver page and
tests.json from tests/wpt-mse, and saves the driver's POST /results to the given file.
Usage: server.py <wpt dir> <tests.json> <results.json> <port>
"""
import http.server
import os
import sys
WPT, TESTS, RESULTS, PORT = sys.argv[1], sys.argv[2], sys.argv[3], int(sys.argv[4])
HERE = os.path.dirname(os.path.abspath(__file__))
OVERLAY = {
"/resources/testharnessreport.js": os.path.join(HERE, "testharnessreport.js"),
"/driver.html": os.path.join(HERE, "driver.html"),
"/tests.json": TESTS,
}
class Handler(http.server.SimpleHTTPRequestHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, directory=WPT, **kwargs)
def translate_path(self, path):
clean = path.split("?", 1)[0].split("#", 1)[0]
return OVERLAY.get(clean) or super().translate_path(path)
def do_POST(self):
if self.path != "/results":
self.send_error(404)
return
body = self.rfile.read(int(self.headers.get("Content-Length", 0)))
with open(RESULTS, "wb") as f:
f.write(body)
self.send_response(204)
self.end_headers()
def log_message(self, *args):
pass
http.server.ThreadingHTTPServer(("127.0.0.1", PORT), Handler).serve_forever()

View file

@ -1,13 +0,0 @@
// Nacre's WPT report hook (tools/wpt-mse.sh): replaces resources/testharnessreport.js and keeps the results on
// window.__wpt for the driver page (tests/wpt-mse/driver.html), which runs each test in an iframe.
// A test's alert() would block the driver; log it instead.
window.alert = function (message) { console.log('alert: ' + message); };
add_completion_callback(function (tests, status) {
window.__wpt = {
done: true,
path: location.pathname,
status: status.status,
message: status.message || '',
tests: tests.map(function (t) { return { name: t.name, status: t.status, message: t.message || '' }; }),
};
});

View file

@ -1,68 +0,0 @@
#!/usr/bin/env bash
# Runs a subset of WPT media-source/ in Nacre and prints pass counts (S027). Offline after the first run.
# - fetches web-platform-tests at $WPT_REV (sparse: media-source, media, resources, common) into target/wpt once
# - serves it on 127.0.0.1:$WPT_PORT (tests/wpt-mse/server.py) with our testharnessreport.js
# - runs tests/wpt-mse/driver.html in a hidden smoke run (tools/smoke.sh): every test in an iframe, $WPT_TIMEOUT s each
# - writes <outdir>/wpt/results.json and prints per-file and total subtest pass counts
# Usage: tools/wpt-mse.sh [outdir] [file ...] (files default to the subset below)
# Not run: dedicated-worker/, managed/ (ManagedMediaSource), mse-for-webcodecs/, idlharness and *.window.js (need
# wptserve's generated wrappers), the reftest mediasource-video-is-visible, iamf, and the long config-change playbacks.
set -eu
root=$(cd "$(dirname "$0")/.." && pwd)
rev=${WPT_REV:-4e9e53b6fc1dad91c48a71593041b2a325d5401b}
port=${WPT_PORT:-8790}
wpt=$root/target/wpt
out=${1:-$root/target/smoke/wpt-mse-$(date +%H%M%S)}
shift || true
mkdir -p "$out/wpt"
if [ ! -d "$wpt/media" ]; then
[ -d "$wpt/.git" ] || git clone --filter=blob:none --no-checkout https://github.com/web-platform-tests/wpt.git "$wpt"
git -C "$wpt" sparse-checkout set media-source media resources common
git -C "$wpt" fetch --depth 1 origin "$rev"
git -C "$wpt" checkout -q "$rev"
fi
if [ $# -gt 0 ]; then
files=("$@")
else
mapfile -t files < <(cd "$wpt/media-source" && ls -1 ./*.html | sed 's|^\./||' |
grep -v -e '^mediasource-config-change-' -e '^mediasource-video-is-visible' -e '^mediasource-iamf-')
fi
printf '%s\n' "${files[@]}" | python3 -c 'import json,sys; print(json.dumps([l.strip() for l in sys.stdin if l.strip()]))' >"$out/wpt/tests.json"
python3 -I "$root/tests/wpt-mse/server.py" "$wpt" "$out/wpt/tests.json" "$out/wpt/results.json" "$port" &
server=$!
trap 'kill $server 2>/dev/null' EXIT
rm -f "$out/wpt/results.json"
timeout_each=${WPT_TIMEOUT:-75}
cat >"$out/wpt/wpt.txt" <<SCRIPT
# Generated by tools/wpt-mse.sh
wait 2
open http://127.0.0.1:$port/driver.html?timeout=$timeout_each
waitload 30
waitfor $(( ${#files[@]} * (timeout_each + 5) )) window.__all && window.__all.done
shot wpt-driver
status done
quit
SCRIPT
SMOKE_TIMEOUT=$(( ${#files[@]} * (timeout_each + 5) + 120 )) "$root/tools/smoke.sh" "$out/wpt/wpt.txt" "$out" || true
python3 - "$out/wpt/results.json" <<'PY'
import json, sys
try:
files = json.load(open(sys.argv[1]))
except OSError:
sys.exit("wpt-mse: no results (the driver did not finish)")
total = passed = 0
for name, result in files.items():
tests = result.get("tests", [])
ok = sum(1 for t in tests if t["status"] == 0)
total += len(tests)
passed += ok
note = "" if result.get("done") else " (no completion: " + str(result.get("status")) + ")"
print(f"{ok:4}/{len(tests):<4} {name}{note}")
print(f"wpt-mse: {passed}/{total} subtests passed in {len(files)} files")
PY