Merge branch 'main' into s022-mse-proto

This commit is contained in:
astar76 2026-11-12 11:03:26 -06:00
commit 103a26521c
30 changed files with 1064 additions and 39 deletions

View file

@ -71,6 +71,8 @@ Never modify: `~/Documents/Apps/Nacre` (the original Python Nacre, reference onl
| `SMOKE_SIZE=1400x900 tools/smoke.sh tests/smoke/backgrounds.txt` | every new tab background with the pointer, Customize panel dark/light, image + blur, GIF frames; `perf-*-a/b.json` `frames` (median/max draw ms, `drawn` count) per background at Lots/Fast, hidden tab, still, Motion off. Selftest `pointer x y`, `customize`; `@PAGESDIR@` = path of tests/smoke/pages | now (S018) |
| `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) |
| `tools/smoke.sh tests/smoke/mse.txt` | MSE: MediaSource + one SourceBuffer plays chunk-appended fMP4 and WebM (offline); passes only on a build with the MSE patches (branch `s022-mse-proto`, see docs/engine/mse-spike.md) | S022 prototype |
| `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) |
| appimagetool, wine + Inno Setup, VM "Windows 10" | packaging and Windows checks | see the user's global CLAUDE.md "Building" |

View file

@ -12,13 +12,13 @@ Verify the networking features: bridge proxy (secure DNS, VPN routing) on loopba
- `src/net/bridge.rs`, `src/net/dns.rs`, `src/net/download.rs` as needed
## Steps
- [ ] Start a local HTTP(S) test server (Python `http.server` on loopback, self-signed cert for HTTPS) serving test pages, an ad/tracker URL list and downloadable files
- [ ] Check HTTPS-only upgrade and the `location.replace()` redirect page; check tracking parameter stripping
- [ ] Check the ad blocker blocks listed requests and cosmetic filters on the local page; check list update works offline-safe (local list file)
- [ ] Check downloads: start, pause/resume, cancel, save-to folder, external download manager hand-off with a dummy command
- [ ] Check the bridge with secure DNS pointed at a local stub (no public resolver in tests) and VPN routing disabled; never start Tor
- [ ] Mark FEATURES rows verified/broken; fix failures in place with regression tests
- [ ] PROGRESS entry, INDEX line, commit `S007: …` and push
- [x] Start a local HTTP(S) test server (Python `http.server` on loopback, self-signed cert for HTTPS) serving test pages, an ad/tracker URL list and downloadable files
- [x] Check HTTPS-only upgrade and the `location.replace()` redirect page; check tracking parameter stripping
- [x] Check the ad blocker blocks listed requests and cosmetic filters on the local page; check list update works offline-safe (local list file)
- [x] Check downloads: start, pause/resume, cancel, save-to folder, external download manager hand-off with a dummy command
- [x] Check the bridge with secure DNS pointed at a local stub (no public resolver in tests) and VPN routing disabled; never start Tor
- [x] Mark FEATURES rows verified/broken; fix failures in place with regression tests
- [x] PROGRESS entry, INDEX line, commit `S007: …` and push
## End criteria
- `tools/smoke.sh tests/smoke/net*.txt` pass.

View file

@ -12,14 +12,14 @@ YouTube's player needs Media Source Extensions; Servo 0.7 has none, so videos sh
- References (read, port ideas, don't copy code): WebKitGTK's GStreamer MSE backend (`Source/WebCore/platform/graphics/gstreamer/mse/`), Firefox `dom/media/mediasource/` (MPL-2.0, same licence as Servo), Chromium only for the spec behaviour
## Steps
- [ ] Upstream check: does current Servo (git main, issues, PRs, servo-media) have MSE work? Note links, state, and whether it can be backported to 0.7
- [ ] Map the work for Servo 0.7: WebIDL + DOM (`MediaSource`, `SourceBuffer`, `SourceBufferList`, `URL.createObjectURL(MediaSource)`), byte-stream parsing (fMP4 init/media segments, WebM), feeding GStreamer (appsrc per track, buffered ranges, seeking, `endOfStream`), `isTypeSupported` codecs (VP9, AV1, H.264, Opus, AAC through the installed GStreamer plugins)
- [ ] Decide how Nacre would carry the change: vendored `script` / `servo-media` crates via `[patch.crates-io]` like servo-net (D-012), and measure the rebuild cost of a vendored `script` crate
- [ ] Prototype the smallest path: `MediaSource` + one `SourceBuffer` that plays a local fMP4 or WebM clip appended in chunks (`tests/smoke/pages/mse-basic.html`, clip generated with ffmpeg); a smoke shot shows the clip playing (currentTime advances)
- [ ] Try YouTube with the prototype (heavy-web.txt YouTube steps): record exactly how far it gets and what breaks next
- [ ] Windows: what GStreamer the Windows build needs (bundled runtime size, plugins) for MSE playback
- [ ] Write `docs/engine/mse-spike.md`: findings, sized task list (sessions per part), risks, recommendation; then 🧑 ask the user (through the orchestrator) go / no-go
- [ ] PROGRESS entry, DECISIONS (go/no-go), INDEX line, commit `S022: …` and push
- [x] Upstream check: does current Servo (git main, issues, PRs, servo-media) have MSE work? Note links, state, and whether it can be backported to 0.7
- [x] Map the work for Servo 0.7: WebIDL + DOM (`MediaSource`, `SourceBuffer`, `SourceBufferList`, `URL.createObjectURL(MediaSource)`), byte-stream parsing (fMP4 init/media segments, WebM), feeding GStreamer (appsrc per track, buffered ranges, seeking, `endOfStream`), `isTypeSupported` codecs (VP9, AV1, H.264, Opus, AAC through the installed GStreamer plugins)
- [x] Decide how Nacre would carry the change: vendored `script` / `servo-media` crates via `[patch.crates-io]` like servo-net (D-012), and measure the rebuild cost of a vendored `script` crate
- [x] Prototype the smallest path: `MediaSource` + one `SourceBuffer` that plays a local fMP4 or WebM clip appended in chunks (`tests/smoke/pages/mse-basic.html`, clip generated with ffmpeg); a smoke shot shows the clip playing (currentTime advances)
- [x] Try YouTube with the prototype (heavy-web.txt YouTube steps): record exactly how far it gets and what breaks next
- [x] Windows: what GStreamer the Windows build needs (bundled runtime size, plugins) for MSE playback
- [x] Write `docs/engine/mse-spike.md`: findings, sized task list (sessions per part), risks, recommendation; then 🧑 ask the user (through the orchestrator) go / no-go
- [x] PROGRESS entry, DECISIONS (go/no-go), INDEX line, commit `S022: …` and push
## End criteria
- `docs/engine/mse-spike.md` exists with the upstream state, the sized plan and a recommendation.

View file

@ -0,0 +1,64 @@
# S026 — Fix gst_mse for split audio/video MSE
> Category 05 Engine · Model: Opus · Effort: high · Depends on: S022, S009 · Size: L · Human: no
> Files touched: `vendor/gst-mse/**` (new), `tools/gst-mse.sh` (new), `vendor/servo-media-gstreamer/mse.rs`, `src/main.rs` (library/plugin path), `tests/gst-mse/**` (new)
## Goal
GStreamer's MSE library (gst_mse 1.28.9) has three defects that block YouTube (docs/engine/mse-spike.md "gst_mse
1.28.9 defects"): (1) `update-end` fires before the appended bytes are parsed, so `buffered` is stale; (2) idle
`update`/`update-end` ticks every second; (3) `msesrc` exposes streams before every SourceBuffer has its init
segment, so YouTube's separate audio and video buffers hang at readyState 0. Fix all three in our own copy of the
library and plugin, load that copy from Nacre, and drop the prototype's settle work-around. D-015, option A.
**Branch and worktree:** continue on branch `s022-mse-proto` in the worktree `~/Projects/Nacre-s022`, which has its
own `target/` (never build it in the main checkout's `target/`). First step: `git merge main` into the branch. The
branch lands on main at the end of S028 (see S028), not here.
## Read
- `docs/engine/mse-spike.md` (all of it); D-012 and D-015 in `docs/DECISIONS.md`
- gst-plugins-bad 1.28.9 sources: `gst-libs/gst/mse/` (gstsourcebuffer.c `append_to_buffer_task_func`,
`append_successful_unlocked`; gstappendpipeline.c `consume_all_samples`, END_OF_APPEND; gstmsesrc.c
`append_stream`, `gst_mse_src_emit_streams`) and `ext/mse/` (the plugin). Get them from
`https://sources.debian.org/data/main/g/gst-plugins-bad1.0/1.28.9-1/` (gitlab.freedesktop.org blocks fetches).
- Reference behaviour, read and don't copy: WebKit `Source/WebCore/platform/graphics/gstreamer/mse/` (waits for
all init segments), the MSE spec "init segment received" and HAVE_METADATA steps.
## Steps
- [ ] `git merge main` into `s022-mse-proto` (worktree), build, `tools/smoke.sh tests/smoke/mse.txt` still green
- [ ] Vendor the gst_mse library + mse plugin sources (1.28.9, LGPL-2.1, keep headers and COPYING) into
`vendor/gst-mse/` with a small meson (or cc) build; `tools/gst-mse.sh` builds `libgstmse-1.0.so.0` and the
plugin into `target/gst-mse/`. Mark every change "Nacre patch".
- [ ] Load our copy: the library ahead of the system one (rpath or `LD_LIBRARY_PATH` set before GStreamer
init — check which works with gstreamer-mse-sys) and the plugin via `GST_PLUGIN_PATH`/registry; log the
loaded path once. Decide and record how release builds find it.
- [ ] Bug 1: signal update/update-end only after the end-of-append for that append has been consumed
(`consume_all_samples` done); C test: buffered is non-empty at the first update-end after a media segment
- [ ] Bug 2: no update/update-end without an outstanding append/removal; C test: no signals while idle for 3 s
- [ ] Bug 3: msesrc exposes no streams (and stays HAVE_NOTHING) until every SourceBuffer of the attached
MediaSource has received its first init segment; C test with two SourceBuffers (audio fMP4 + video WebM),
video init appended 2 s before audio, then both play
- [ ] Remove the settle work-around (`SETTLE`, `pending`) from `vendor/servo-media-gstreamer/mse.rs`; rebuild;
`tests/smoke/mse.txt` green
- [ ] Add a two-SourceBuffer case to `tests/smoke/pages/mse-basic.html` (`?split`: audio-only + video-only clips,
video appended first); smoke asserts it plays
- [ ] YouTube probe (heavy-web.txt watch-page steps): record codecs, readyState, currentTime, picture in the shot
- [ ] Write the patches up for upstream (`docs/engine/gst-mse-patches.md`: what, why, test), no MR opened
without the user's OK
- [ ] PROGRESS entry, DECISIONS if the loading scheme binds S030, INDEX line, commit `S026: …` on the branch, push the branch
## End criteria
- `tools/gst-mse.sh` builds; the C tests for bugs 1–3 pass (command in the plan's PROGRESS entry).
- `tools/smoke.sh tests/smoke/mse.txt` passes including the split A/V case.
- Nacre's log shows our libgstmse/plugin path; `SETTLE` is gone from `mse.rs`.
- YouTube result recorded (picture or the next blocker, exactly).
## Pitfalls
- One cargo command at a time per `target/`; the worktree has its own. A `servo-script` edit rebuilds in ~10 min,
a backend-only edit in ~2 min.
- LGPL: keep our gst_mse a separate shared library (dynamic linking), keep its licence files, publish our changes.
- Don't use gitlab.freedesktop.org raw URLs (bot wall); Debian sources work.
- Hidden smoke runs have no audio device; audio sinks fail over to fakesink paths. Don't mistake that for MSE bugs.
- Never connect to Tor or proxies in tests.
## Handoff (→ PROGRESS.md)
How the patched gst_mse is built and loaded (S030 packages it), what YouTube does now, anything left for S027/S028.

View file

@ -0,0 +1,52 @@
# S027 — MSE DOM to spec
> Category 05 Engine · Model: Opus · Effort: high · Depends on: S026 · Size: L · Human: no
> Files touched: `vendor/servo-script/dom/media/{mediasource,sourcebuffer,sourcebufferlist}.rs`, `vendor/servo-script/dom/html/embedded_content/htmlmediaelement.rs`, `vendor/servo-script/dom/url/url.rs`, `vendor/servo-script-bindings/webidls/*.webidl`, `vendor/servo-script-bindings/codegen/Bindings.conf`, `vendor/servo-media-player/mse.rs`, `vendor/servo-media-gstreamer/mse.rs`, `tests/smoke/mse*.txt`, `tests/smoke/pages/mse-*`
## Goal
Replace the S022 spike shortcuts (docs/engine/mse-spike.md "Spike shortcuts") with the spec algorithms, so sites
other than the happy path work: ready-state and event order, duration change, removeSourceBuffer,
activeSourceBuffers, changeType, sequence mode, abort, `HTMLMediaElement.buffered`/`seekable` from the
MediaSource, object URL lifetime, no reference leak, a pref switch. D-015.
**Branch and worktree:** `s022-mse-proto` in `~/Projects/Nacre-s022` (own `target/`); `git merge main` first.
## Read
- `docs/engine/mse-spike.md`; the S026 PROGRESS entry
- MSE spec (w3c.github.io/media-source): attach/detach, appendBuffer, coded frame removal, duration change,
endOfStream, buffered, seeking; HTML "media element load algorithm" for MSE
- Servo issue #40749 (MediaSource in the Blob URL store); Firefox `dom/media/mediasource/` (MPL-2.0) for structure,
ideas only
- WPT `media-source/` tests list (pick the subset that needs no workers, ManagedMediaSource or EME)
## Steps
- [ ] `git merge main` into the branch; build; mse smoke green
- [ ] Object URLs: register in the Blob URL store (or a per-global map freed on revoke after attach and on
document unload); no `Trusted` cycle (weak reference from the event sink); test: a MediaSource is collected
after the page drops it (count via a debug counter in the log)
- [ ] Attach/detach steps: readyState transitions, `sourceopen`/`sourceended`/`sourceclose` queued in spec
order; detach on `src` change/load(); duration change algorithm (`durationchange` on the element)
- [ ] `HTMLMediaElement.buffered` and `seekable` from the MediaSource (intersection of active buffers; live
seekable range); `activeSourceBuffers` tracks selected tracks
- [ ] `removeSourceBuffer` (backend removal, abort first), `changeType` (backend support or NotSupported),
`mode = "sequence"` through the backend append mode, `abort` resets the parser state
- [ ] `dom_media_source_enabled` pref (on by default in Nacre); `MediaSource` absent when off
- [ ] Smoke: mse.txt grows cases (remove + re-append, duration change, changeType same type, abort mid-append,
endOfStream then append reopens) with asserts; a WPT subset page or script run that reports pass counts
- [ ] PROGRESS entry, INDEX line, commit `S027: …` on the branch, push the branch
## End criteria
- `tools/smoke.sh tests/smoke/mse.txt` passes with every new case asserted.
- The leak check shows the MediaSource freed.
- WPT subset pass count recorded in PROGRESS (target ≥ the 293 subtests #47269 reported, minus worker/managed ones).
## Pitfalls
- `servo-script` edits rebuild in ~10 min: batch them. Event firing must go through tasks (never fire from a
GStreamer thread).
- `ReadyState`/`AppendMode` are generated binding enums: map them, don't store them in `#[no_trace]` fields without
`ignore_malloc_size_of`.
- Static WebIDL members on `[Exposed=Window]` take `&Window`, not `&GlobalScope`.
- `[Throws]` attributes get `Get…` names and lose the `cx` config: check Bindings.conf names.
## Handoff (→ PROGRESS.md)
What is still not to spec and why (worker MSE, ManagedMediaSource are out of scope), WPT numbers.

View file

@ -0,0 +1,50 @@
# S028 — MSE player integration and merge to main
> Category 05 Engine · Model: Opus · Effort: high · Depends on: S027 · Size: M · Human: no
> Files touched: `vendor/servo-media-gstreamer/{player,mse,lib}.rs`, `vendor/servo-media-player/*.rs`, `vendor/servo-script/dom/html/embedded_content/htmlmediaelement.rs`, `tests/smoke/mse*.txt`, `Cargo.toml`, `docs/DESIGN.md`, `docs/FEATURES.md`
## Goal
Make MSE playback robust in the player: seeking through msesrc, playback rate, errors, no blocking of the script
thread during attach (S022 saw a page stop answering scripts; `GStreamerPlayer::setup` blocks until
`source-setup`), and a correct codec table for `isTypeSupported` (Opus in WebM reads false today; AV1 when a dav1d
decoder exists). Then land the MSE branch on main. D-015.
**Branch and worktree:** `s022-mse-proto` in `~/Projects/Nacre-s022`; `git merge main` first. **Landing:** at the
end, with every smoke script green on the branch, merge `s022-mse-proto` into main (a merge commit, no
rebase or force push). Then remove the worktree (`git worktree remove`), keep the branch on origin. From S029 on,
work happens on main.
## Read
- `docs/engine/mse-spike.md`; S026/S027 PROGRESS entries
- `vendor/servo-media-gstreamer/player.rs` (`setup`, `source-setup`, seek, `is_ready`), `registry_scanner.rs`
- `docs/DESIGN.md` media section and "Engine limits"
## Steps
- [ ] `git merge main` into the branch; build; mse smoke green
- [ ] Attach without blocking the script thread: setup for `StreamType::MediaSource` returns at once; readiness
arrives as a player event; test: a page appends while the player starts and the `js` probe answers in <1 s
- [ ] Seeking: `currentTime =` inside and outside buffered ranges (waits for an append, then `seeked`); playback
rate; `ended` after endOfStream; smoke asserts each
- [ ] Errors: decode error → `MediaError` + `sourceended`/error events; append of garbage → SourceBuffer `error`
- [ ] Codec table: `isTypeSupported` consistent with `canPlayType` (registry scanner learns opus/webm, vp09.*, av01
when dav1d is installed); unit test for the mime/codec mapping
- [ ] Full smoke set green on the branch (launch, basics, input, chrome, keys, mse, settings; heavy-web where
the network allows) and `nice cargo test --release -j 2`
- [ ] Merge `s022-mse-proto` into main; build main; mse smoke green on main; remove the worktree
- [ ] DESIGN.md: media section (MSE path, vendored crates, patched gst_mse); "Engine limits": drop the MSE line,
keep DRM; FEATURES rows
- [ ] PROGRESS entry, INDEX line, commit `S028: …`, push main
## End criteria
- mse smoke (seek, rate, ended, errors, split A/V) passes on main; `cargo test` green; no smoke regressions.
- The script thread never blocks on attach (probe answers in <1 s).
- main contains the MSE work; the worktree is gone; DESIGN/FEATURES updated.
## Pitfalls
- The merge touches `Cargo.toml` `[patch.crates-io]` and maybe vendored servo-net (S023): resolve by keeping both.
- Main's `target/` will rebuild script and everything downstream after the merge (~10 min + the rest); one cargo
command at a time, and tell the orchestrator before building in the shared checkout.
- Seeking into an unbuffered range must not deadlock msesrc's pad tasks.
## Handoff (→ PROGRESS.md)
MSE on main; known gaps for the YouTube pass (S029).

View file

@ -0,0 +1,41 @@
# S029 — YouTube and Reddit video pass
> Category 05 Engine · Model: Opus · Effort: high · Depends on: S028 · Size: M · Human: 🧑 watches a visible run
> Files touched: `tests/smoke/heavy-web.txt`, `tests/smoke/site-doctor.txt`, `src/**` and `vendor/**` only for fixes found, `docs/FEATURES.md`, `docs/REVIEW.md`
## Goal
Real YouTube playback in the page, with YouTube's own controls, quality menu, captions, seeking, picture in
picture and ad blocking, and Reddit's HLS video (hls.js over MSE). Plus the video sites in site-doctor. Fix what
breaks, or record it exactly. The user's goal from D-013/D-015.
**Branch:** main (MSE merged in S028).
## Read
- `docs/engine/mse-spike.md` "YouTube with the prototype"; S026–S028 PROGRESS entries
- `tests/smoke/heavy-web.txt` (YouTube block), `tests/smoke/site-doctor.txt`; D-008 (PiP reloads the page)
## Steps
- [ ] heavy-web YouTube steps: drop the "can't play" notes; assert `currentTime > 5`, picture (videoWidth > 0 and
the shot shows frames), seek to 50 %, quality change via the settings menu, captions on/off
- [ ] PiP with MSE (D-008: the PiP view reloads the page and seeks), the media button, Discord presence and
MPRIS state from the MSE video
- [ ] Ad blocking still holds on the watch page (no ad slots, shield count > 0)
- [ ] Reddit video post (hls.js): plays, seeks; record the codec path
- [ ] site-doctor video sites: record each as plays / fails (why)
- [ ] Fix the blockers found (each with a smoke assert); anything big goes to PROGRESS "Later" with exact symptoms
- [ ] 🧑 Visible run for the user (`SMOKE_VISIBLE=1`, D-009) of the YouTube steps
- [ ] FEATURES/REVIEW rows; PROGRESS entry, INDEX line, commit `S029: …`, push
## End criteria
- `SMOKE_TIMEOUT=900 tools/smoke.sh tests/smoke/heavy-web.txt` passes the YouTube playback, seek and PiP checks.
- Reddit and site-doctor video results recorded in PROGRESS with shots.
## Pitfalls
- Needs internet; direct connections only, never Tor, VPN or proxy (keep Nacre's VPN off).
- YouTube A/B tests and SABR change behaviour between runs: run each check 3 times before calling it flaky or fixed.
- Hidden runs have no audio device; YouTube may stall on audio-clock issues that don't happen on the user's PC.
Confirm with a visible run.
- DRM videos stay unavailable (no EME).
## Handoff (→ PROGRESS.md)
What plays, what doesn't and why; anything for packaging (codecs the bundle must carry).

View file

@ -0,0 +1,43 @@
# S030 — Ship GStreamer with MSE (AppImage and Windows)
> Category 05 Engine · Model: Opus · Effort: medium · Depends on: S029 · Size: M · Human: no
> Files touched: packaging scripts (AppImage / tar.gz / Inno Setup, wherever the release plans put them), `tools/gst-mse.sh`, `docs/DESIGN.md`, `docs/engine/mse-spike.md` (Windows section)
## Goal
Release builds play MSE video on machines whose system GStreamer is old or missing: the AppImage and tar.gz bundle
GStreamer ≥ 1.26.11 with the mse plugin, our patched gst_mse (S026) and a dav1d AV1 decoder. The Windows installer
and portable zip bundle a subset of the official MSVC runtime (1.28.x) plus our patched gst_mse. Check it in the VM.
D-015.
**Branch:** main.
## Read
- `docs/engine/mse-spike.md` "Windows"; the S026 PROGRESS entry (how the patched gst_mse is built and loaded)
- The user's global CLAUDE.md "Building" (AppImage rules, Inno Setup in wine, the VM "Windows 10")
- GStreamer docs "Deploying on Windows" (which DLLs and plugin dir; `GST_PLUGIN_PATH`, registry)
## Steps
- [ ] List the plugins MSE playback needs (from the S029 runs: mse, isomp4, matroska, vpx, dav1d, libav, opus,
audio sinks, videoconvert/scale, gl if used) and their libraries
- [ ] Linux: bundle that GStreamer set (built or taken from a distro with ≥ 1.26.11) into the AppImage and tar.gz.
Make sure nothing is taken from /usr/lib at run time (`GST_PLUGIN_SYSTEM_PATH` empty, own registry file).
Smoke the AppImage with the mse smoke
- [ ] Windows: build the patched gst_mse with MSVC (in the VM) or MinGW; copy the runtime subset (1.28.x MSVC) next to
`nacre.exe`; measure the bundle size
- [ ] VM test: the installer and portable zip play `mse-basic.html` (software rendering), screenshot + status file
written through `Z:`
- [ ] Record sizes and the plugin list in DESIGN.md; licences (LGPL notices for GStreamer and gst_mse) in the bundle
- [ ] PROGRESS entry, INDEX line, commit `S030: …`, push (no release published; that is the release plan's job)
## End criteria
- The AppImage plays `tests/smoke/pages/mse-basic.html` on a hidden run with the host's GStreamer plugin path empty.
- The Windows build plays it in the VM (shot read and recorded); bundle size recorded.
## Pitfalls
- The 1.28 Windows runtime ships as a 517 MB exe (no merge modules): extract it, don't make users install it.
- Don't bundle /usr/lib system libraries outside GStreamer's own set (user rule); keep glibc from the host.
- VMs have no real GPU: software GL only. PowerShell rules from the global CLAUDE.md apply.
- LGPL: dynamic linking, ship licence texts and our gst_mse source changes.
## Handoff (→ PROGRESS.md)
Bundle sizes, plugin list, anything the release plan must know.

View file

@ -13,7 +13,7 @@ Tracker: https://claude.ai/artifact/9AD7fPfwJ4ASFzVTJGKU4h
## 02 Verify
- [x] [S005 — Per-tab painters on one GL context](02%20Verify/S005-gl-painters.md) · Opus high
- [x] [S006 — Browser basics pass](02%20Verify/S006-verify-basics.md) · Opus medium
- [ ] [S007 — Network pass](02%20Verify/S007-verify-network.md) · Opus medium
- [x] [S007 — Network pass](02%20Verify/S007-verify-network.md) · Opus medium
- [ ] [S008 — Stores and pages pass](02%20Verify/S008-verify-stores.md) · Sonnet high
- [ ] [S009 — Integrations pass](02%20Verify/S009-verify-integrations.md) · Sonnet high
- [ ] [S010 — Phase 2 review with the user](02%20Verify/S010-phase2-review.md) · Sonnet medium · 🧑
@ -34,7 +34,12 @@ Tracker: https://claude.ai/artifact/9AD7fPfwJ4ASFzVTJGKU4h
- [x] [S021 — Phase 4 review with the user](04%20UI%20redesign/S021-phase4-review.md) · Sonnet medium · 🧑
## 05 Engine
- [ ] [S022 — MediaSource (MSE) spike](05%20Engine/S022-mse-spike.md) · Opus high · 🧑
- [x] [S022 — MediaSource (MSE) spike](05%20Engine/S022-mse-spike.md) · Opus high · 🧑
- [ ] [S026 — Fix gst_mse for split audio/video MSE](05%20Engine/S026-gst-mse-fixes.md) · Opus high
- [ ] [S027 — MSE DOM to spec](05%20Engine/S027-mse-dom-spec.md) · Opus high
- [ ] [S028 — MSE player integration and merge to main](05%20Engine/S028-mse-player.md) · Opus high
- [ ] [S029 — YouTube and Reddit video pass](05%20Engine/S029-youtube-reddit-pass.md) · Opus high · 🧑
- [ ] [S030 — Ship GStreamer with MSE (AppImage and Windows)](05%20Engine/S030-media-packaging.md) · Opus medium
## 06 Privacy
- [ ] [S023 — Request headers and third-party cookies in servo-net](06%20Privacy/S023-net-headers-cookies.md) · Opus medium

View file

@ -16,3 +16,5 @@
- D-011 — 2026-11-12 — Privacy mode (R1-16: anti-fingerprinting, strict cookies, tracker blocking, Cover Your Tracks check, auto-on in incognito) and cookie theft protection (R1-19: Nacre-held cookies encrypted at rest with an OS-keyring key) get their own privacy plan, generated after S021 with /plan-generate; not part of S007. — The user chose it; both are large and touch hub, inject and store. — S007, the new privacy plan
- D-012 — 2026-11-12 — servo-net is vendored (`vendor/servo-net`, 0.7.0 + `http2_max_header_list_size(256 KiB)` in `connector.rs` `create_http_client`) via `[patch.crates-io]`. — hyper's 16 KiB HTTP/2 default rejects YouTube's ~19 KiB response headers; Servo can't configure it from the embedder. — any plan that upgrades Servo: drop the patch when servo-net sets the limit, re-run `tests/smoke/heavy-web.txt`
- D-013 — 2026-11-12 — New plans: S022 MSE spike (05 Engine) runs right after S006; privacy plans S023 (request headers + third-party cookies in the vendored servo-net), S024 (privacy mode, R1-16), S025 (encrypted cookies, R1-19) run after S009, before the S010 review. — The user wants real YouTube playback in the page (no yt-dlp workaround) and asked whether missing Servo features can be added from reference engines; the spike sizes MSE before committing weeks to it. — S006–S025 run order
- D-014 — 2026-11-12 — Two more Nacre patches in the vendored servo-net (D-012), marked "Nacre patch": `fetch/methods.rs` lets the certificate warning's `chrome:allowcert` request through (it ended as UnsupportedScheme, so "Open anyway" never worked); `http_cache.rs` `flush_to_disk` + `resource_thread.rs` Exit write the memory HTTP cache to the disk cache at quit (Servo only wrote evicted entries, so a session's cache was lost). — Both are Servo 0.7 bugs the embedder can't work around. — any plan that upgrades Servo: re-check both, re-run `tests/smoke/net-privacy.txt` and `cache.txt` + `cache-restart.txt`
- D-015 — 2026-11-12 — MSE: go, option A (S022). Keep GStreamer's gst_mse library for parsing and coded frame processing; Nacre fixes its three 1.28.9 defects (early update-end, idle ticks, split A/V init segments) in its own copy of the library and plugin, plus a thin MSE DOM in the vendored `servo-script`/`servo-script-bindings`/`servo-media*` crates (`[patch.crates-io]`, like D-012). Option B (an own MSE core in Rust feeding appsrc) is the fallback only if bug 3 can't be fixed in msesrc. Plans S026–S030 run after S009 and before S023–S025. The prototype branch `s022-mse-proto` carries S026–S027 and merges into main in S028. — Decided by the orchestrator overnight on the user's standing OK; the user wants engine fixes, not workarounds (no yt-dlp). The spike showed gst_mse does the hard parts, and the blockers are concrete (docs/engine/mse-spike.md). — S026–S030, any Servo upgrade (drop the patches when Servo ships MSE)

View file

@ -71,14 +71,14 @@ written.
## 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`) |
| 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) | written (PRIVACY_JS) |
| Secure DNS (Cloudflare, Quad9, Google, Mullvad, AdGuard, custom) | written (`net/dns.rs`) |
| HTTPS-only mode with fallback prompt and exceptions | written |
| Secure DNS (Cloudflare, Quad9, Google, Mullvad, AdGuard, custom) | verified S007 with a custom endpoint on a local stub (net-privacy.txt: names only the stub knows load); the public providers not contacted in tests |
| HTTPS-only mode with fallback prompt and exceptions | verified S007 (net-privacy.txt: upgrade via the `location.replace()` page, certificate warning "Open anyway" (fixed: servo-net patch), fallback prompt + Open anyway, site stays http this session, local addresses never upgraded); "Always for this site" not tapped |
| Site settings (defaults and per-site) | written |
| Delete browsing data (+ on exit) | written |
| Send Do Not Track and GPC | partial: JS only (no headers in Servo 0.7) |
| Remove tracking parameters | written |
| Remove tracking parameters | verified S007 (net-privacy.txt: utm_*/fbclid removed, other parameters kept, off keeps all) |
| Block third-party cookies | engine limit, shown as unavailable |
| Google sign-in quirk | written (UA switch + JS) |
| Sites where ad blocking is paused | written |
@ -88,11 +88,21 @@ written.
Block ads and trackers, filter engine status + update now, 22 filter lists in groups, your lists, own rules, hide
leftovers (cosmetic incl. generic hiding), animate removal, block YouTube ads, update automatically: written
(`adblock.rs`, `hub.rs`, COSMETIC_JS). Seed lists ship in `assets/filters`.
Verified S007 (net-adblock.txt, offline): seed lists build without network (210k rules); a custom list URL
(local) blocks a script and an image and hides elements by a site and a generic cosmetic rule; pausing for a site
lets everything through; a list that can't be downloaded is reported and the rules stay; per-page blocked count
(fixed: it was reset after the page's first requests were counted). Not checked: the 22 real lists' downloads,
YouTube ad blocking, own rules, removal animation, automatic updates.
## Downloads
Save to, ask where, show when they start, pause/resume (Range), retry, cancel, open/show in folder, external download
managers (AB Download Manager, aria2/Motrix, JDownloader 2, FDM, IDM) with ping status and fallback: written
(`net/download.rs`, `net/dlm.rs`). Downloads are detected by URL type, a header probe, and `<a download>`.
Verified S007 (net-downloads.txt, offline): by file type and by Content-Disposition from links and typed addresses
(fixed: typed addresses skipped detection), save-to folder, pause/resume with Range (file intact), cancel, size of
small files (fixed: showed 0 B), aria2/ABDM/JDownloader stubs and a dummy FDM get the link, fallback to Nacre's
downloader when the manager is down. Not checked: ask where (file dialog), retry, open/show in folder, `<a download>`,
IDM (Windows), a file at an address with no hint (no extension, no "download"-like path), which isn't probed.
## Media
Media button (when playing/always/never), player flyout (art, seek, controls, mute tab/site, PiP), visualizer

View file

@ -70,3 +70,8 @@ For the next `/orchestrate` run. Read this before picking the "first unchecked p
- User rules from this run: caveman chat (code/docs full quality); orchestrator makes the recommended calls alone overnight;
fix gaps inside the engine (vendored Servo crates), no yt-dlp-style workarounds. Smoke tap/drag scripts need hidden
SMOKE_SIZE runs (the visible window is ~772 px wide).
- Update: S006, S007, S022 done and validated. D-015 MSE go (option A), plans S026–S030. S008 running
(local_fe1e00f2-…). S026 runs in parallel in worktree ~/Projects/Nacre-s022 (branch s022-mse-proto, own target/) on
the former spare local_373e46d7-2d38-4d5a-94c4-855dae433f88. S027–S030 have no session yet: reuse an idle finished
session (r1-11 local_48b023e1-…, r1-10 local_3487b672-…, r1-flyouts local_fbdfe092-…, r1-21 local_4d846ded-…,
s021 local_3e6a6b37-…, s022 local_7fddd5dd-…) by message, or start fresh ones when the user is back.

View file

@ -243,6 +243,28 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done,
GitHub repo, README, file view OK. YouTube: loads, no playback (no MediaSource, engine limit). HTTP cache OK.
- Not done: Google sign-in past the email step; a real (non-test-key) Turnstile challenge.
## S007 — Network pass (2026-11-12)
- New (offline, `python3 tests/smoke/net/server.py &` first): `net-privacy.txt` (secure DNS on a local stub, bridge with
VPN off, HTTPS-only upgrade/warning/fallback, tracking params), `net-adblock.txt`, `net-downloads.txt` (+ dlm stubs,
`net/fake-fdm.sh`); `cache-restart.txt` (disk cache across a restart); `net-real.txt` (internet, Wikipedia caching).
- Fixed: certificate warning "Open anyway" did nothing and the HTTP disk cache was empty after quit (servo-net, D-014);
typed download addresses opened in the tab; per-page blocked count reset late (lost counts); small finished
downloads showed 0 B; bridge counted a tunnel's bytes only at close; "1 lists". Bridge test checks live counting.
- Green: net-privacy, net-adblock, net-downloads, cache + cache-restart, launch, input, basics, keys, dialogs,
restore (hidden Xvfb); 60 unit tests. net-real: Wikipedia article 887 KB fresh, 20 KB after a restart (disk cache).
- R1-04: caching works (memory + disk, local and real site). Captchas: widgets draw (S006); solving one is for the
user to try (an agent must not complete captchas). Turnstile black half-disc stays in Later.
- Not done: Tor/proxy routing and kill switch (never in tests), real filter list downloads, YouTube ad blocking,
ask-where dialog, retry, `<a download>`, IDM, "Always for this site".
## S022 — MediaSource (MSE) spike (2026-11-12)
- Done: upstream check (nothing merged; servo#40423 draft, #47269 closed); docs/engine/mse-spike.md with findings, sized plan, risks and recommendation. Prototype on branch `s022-mse-proto` (worktree ~/Projects/Nacre-s022, own target): MediaSource/SourceBuffer/SourceBufferList over gst_mse, vendored script, script-bindings, servo-media, player and gstreamer. `tests/smoke/mse.txt` passes on the branch (chunk-appended fMP4 and WebM play, frames shown).
- YouTube: own player, blob MediaSource. AV1 run: time 0→12 s with no picture (no AV1 decoder). isTypeSupported now needs a decoder. VP9+AAC stalls at readyState 0 (gst_mse bug 3: split A/V init segments).
- Rebuild cost: script edit 566 s, backend-only edit 106 s, first vendored build 593 s.
- Decision D-015: go, option A; follow-up plans S026–S030 written.
- Not done: Windows runtime not tried in the VM (sizes from the release index only); seeking and quality switches untested.
- Later: Servo refuses fetch/XHR of file:// from file:// pages (smoke clips are base64 scripts); the selftest `js` probe can hang when the script thread blocks (seen once on YouTube).
## Later
- Turnstile widget paints as a black half-disc (Servo painting of its iframe/shadow DOM, S006 site doctor).
- Google sign-in past the email step: press Next with a real account, by the user (S006).
@ -254,3 +276,7 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done,
- Packaging and first release (D-001: plan when the user asks).
- Shortcut icons: a favicon cache by host (today only open tabs' favicons show).
- Interface size above ~110 % on a narrow (772 px) window clips wide segmented rows at the right (R1-21 visible run).
- A test run (fresh profile, internet) moves ~200 KB before the first page and looks up the update host
(archlinux.tail7c4f5e.ts.net); find out which background fetch it is, maybe skip it in smoke runs (S007).
- Downloads at addresses that give no hint (no extension, no "download"-like path) aren't probed, so they aren't
treated as downloads (what Servo then shows wasn't checked) (S007).

156
docs/engine/mse-spike.md Normal file
View file

@ -0,0 +1,156 @@
# MSE spike (S022)
Can Nacre get Media Source Extensions into Servo 0.7, so YouTube (and Reddit's HLS player) play in the page?
Date: 2026-11-12. Prototype: branch `s022-mse-proto` on origin, worktree `~/Projects/Nacre-s022`.
## Answer
Yes. GStreamer ships its own MSE library, **gst_mse** (`libgstmse-1.0`, plugin `mse` with the `msesrc` element, since
1.24, Rust bindings `gstreamer-mse` 0.25 matching Servo 0.7's gstreamer-rs 0.25). It runs the MSE algorithms in C:
byte-stream parsing (fMP4, WebM, MPEG-TS), coded frame processing, track buffers, buffered ranges, eviction,
`remove`, `abort`, `timestampOffset`, append windows, duration and ready states. So Servo only needs a thin DOM and
a player source, not its own demuxer. The prototype is ~900 lines on top of vendored crates and:
- plays a chunk-appended local clip, fMP4 (H.264 + AAC) and WebM (VP9 + Opus): `tests/smoke/mse.txt` passes, and
the shots show frames with the clock running (1.68 s, 2.04 s);
- takes YouTube from "Your browser can't play this video" to its own player, with controls, captions, the
quality menu button and a `blob:` MediaSource src. In one run (AV1 + Opus picked) `currentTime` ran 0→12 s of
the 19 s video, with captions following, but showed no picture (no AV1 decoder installed). With VP9 + AAC (after
the decoder fix) it stays at readyState 0. That is gst_mse bug 3 below.
Three gst_mse 1.28.9 defects block YouTube. All three are in C code we can fix (see "Sized plan").
## Upstream state (step 1)
| Item | State | Notes |
|---|---|---|
| [servo#22416](https://github.com/servo/servo/issues/22416) | open since 2018, E-very-complex | Members (2025) prefer "Servo holds an opaque gst_mse handle and calls methods on it". |
| [servo#44403](https://github.com/servo/servo/issues/44403) | open, B-roadmap, assigned calvaris (2026-04) | Roadmap item "Implementing the Media Source API"; no code linked. |
| [servo#40423](https://github.com/servo/servo/pull/40423) | open draft (2025-11) | WebIDL + stubs (`todo!()`), gst_mse via a servo-media fork; isTypeSupported hard-coded. |
| [servo/media#458](https://github.com/servo/media/pull/458) | open, locked, conflicted; repo archived | MSE traits over gst_mse, ~450 lines. Media now lives in the servo monorepo. |
| [servo#47269](https://github.com/servo/servo/pull/47269) | closed unmerged 2026-08 (LLM-written, Servo's AI policy) | Own ISO BMFF/WebM parser feeding `servosrc`; one SourceBuffer, no coded frame processing. Ideas only. |
| Servo v0.8.0 (2026-11-09) | released | No MSE. |
Nothing can be backported. Nacre carries its own implementation (same direction as upstream), and drops it when
Servo ships MSE.
## How Nacre carries it (step 3)
`[patch.crates-io]` like servo-net (D-012): `vendor/servo-script`, `servo-script-bindings` (the WebIDL codegen lives
there), `servo-media` (Backend trait), `servo-media-player` (Player trait plus the `mse` traits),
`servo-media-gstreamer` (gst_mse backend and player), plus the new dependency `gstreamer-mse = 0.25`.
The prototype lives in a worktree with its own `target/` (a btrfs reflink copy of the main target, which takes 1 s).
Measured rebuilds (`nice cargo build --release -j 2`, warm target):
| Change | Rebuild |
|---|---|
| First build after vendoring the 5 crates | 593 s (24 crates: script and everything downstream) |
| Edit in `servo-script` / WebIDL | 566 s |
| Edit in `servo-media-gstreamer` only | 106 s (3 crates) |
Vendored `script` costs about 10 minutes per DOM edit. That is fine, but keep DOM edits batched.
## Prototype (step 4)
| File (branch `s022-mse-proto`) | What |
|---|---|
| `vendor/servo-media-player/mse.rs` | `MediaSourceBackend` / `SourceBufferBackend` traits, `MseEvent`, `StreamType::MediaSource`, `Player::set_media_source` (default: unsupported) |
| `vendor/servo-media/lib.rs` | `Backend::create_media_source`, `is_media_source_type_supported` (defaults: none) |
| `vendor/servo-media-gstreamer/mse.rs` | gst_mse wrapper: events from signals, `buffered` via FFI (no binding in 0.25), settle work-around |
| `vendor/servo-media-gstreamer/player.rs` | `mse://` uri, `source-setup` attaches the `GstMediaSource` to `msesrc`; seek and rate allowed |
| `vendor/servo-script-bindings/webidls/{MediaSource,SourceBuffer,SourceBufferList}.webidl`, `URL.webidl` | spec IDL (minus ManagedMediaSource, workers); `createObjectURL(Blob or MediaSource)` |
| `vendor/servo-script/dom/media/{mediasource,sourcebuffer,sourcebufferlist}.rs` | DOM mirror of the backend state, events through the media element task source |
| `htmlmediaelement.rs` | `blob:` URL of a MediaSource → MSE player, no fetch |
| `tests/smoke/mse.txt`, `pages/mse-basic.html`, `pages/mse-clip-{mp4,webm}.js` | offline smoke (clips are base64 scripts: Servo refuses `fetch`/XHR of `file://`) |
Spike shortcuts, which the real plans must replace: object URLs are never freed (pages revoke right after setting
`src`), every SourceBuffer counts as active, `mode = "sequence"` and `changeType` are stored only,
`removeSourceBuffer` only drops it from the list, `HTMLMediaElement.buffered` still comes from playbin (empty under
MSE, so YouTube's "buffer health" reads 0 s), there is no pref switch, and a `Trusted` in the event sink keeps each
MediaSource alive.
## YouTube with the prototype (step 5)
`watch?v=jNQXAC9IVRw`, hidden smoke run, direct connection:
1. Before the decoder fix: YouTube picks **AV1 + Opus** because `gst_media_source_is_type_supported` only checks
that it can parse the type. Arch has no AV1 decoder (no dav1d plugin). Audio runs, so `currentTime` goes 0→12 s
and the captions follow, but the video area stays empty and `videoWidth` is 0. Fixed in the prototype:
isTypeSupported also requires Servo's `can_play_type` (decoder present). Opus in WebM then reads unsupported
(Servo's registry scanner), so YouTube takes AAC.
2. After the fix: **VP9 (242) + AAC (140)**, two SourceBuffers. Both init segments are parsed, but msesrc creates
a stream for the video track only (the video init came 2 s before the audio's), so playbin waits at
readyState 0 with the spinner. gst_mse **bug 3**.
3. Across runs it is flaky (some runs stall at 2 s, one at 0). Also seen once: a later `js` probe never returned,
so the script thread may block. `GStreamerPlayer::setup` blocks the script thread until `source-setup` fires.
This needs a look in the real plan.
gst_mse 1.28.9 defects (read from its source, gst-plugins-bad `gst-libs/gst/mse/`, LGPL. Ideas only, no code copied):
1. **Early `update-end`**: `append_to_buffer_task_func` signals success once the bytes are pushed into the append
pipeline (`gst_append_pipeline_append`), before the end-of-append marker has been processed. `buffered` is
stale at every `updateend`, which is exactly when players read it. Prototype work-around: wait (≤ 250 ms) for
`buffered` to move. Proper fix: signal after the end-of-append message is handled (`consume_all_samples`).
2. **Idle ticks**: the same task emits `update` / `update-end` about every second with no pending data.
The prototype ignores them when no append is outstanding.
3. **Split A/V SourceBuffers**: msesrc exposes streams as soon as one SourceBuffer has its init segment. The spec
says HAVE_METADATA only after every SourceBuffer has received one, and WebKit waits for all of them. This blocks
YouTube, which always uses separate audio and video buffers.
What YouTube still lacks after MSE works: DRM videos (no EME, DESIGN.md), AV1 needs the dav1d plugin, and
PiP reloads the page in its own web view (D-008), so the MediaSource re-buffers there. Expected to work but
unverified: seeking, quality switches, live (`setLiveSeekableRange` is a no-op now).
## Windows (step 6)
- GStreamer packages the mse **library** in its binary installers since 1.24.2 ("Package new analytics and mse
libraries in binary packages") and the mse **plugin** (`msesrc`) since **1.26.11** (cerbero "gst-plugins-bad:
Ship the mse plugin"). The Windows build therefore needs the MSVC runtime ≥ 1.26.11, or 1.28.x.
- Official installers: 1.28.8 MSVC x86_64 is an exe of 517 MB (1.28 dropped merge modules), and 1.26.11 is an
84 MB msi. Nacre ships a subset next to `nacre.exe`: core, base, good (isomp4, matroska, vpx), bad (mse,
dav1d, codecparsers), libav, opus and the audio sinks. Estimate 80–150 MB unpacked. **Not measured or tried in the
VM yet.**
- Arch (1.28.9) already has everything except an AV1 decoder (`gst-plugin-dav1d`, or `gst-plugins-rs` dav1ddec).
An AppImage must bundle GStreamer ≥ 1.26.11 with the mse plugin, because older distros lack it.
## Sized plan (if go)
Each line is one session unless noted. Option A keeps gst_mse and fixes it, so the expensive parsing stays in
GStreamer.
1. **gst_mse fixes** (2 sessions): bugs 1–3 as a patch on gst-plugins-bad 1.28.9 `gst-libs/gst/mse` (C, LGPL).
Build our own `libgstmse-1.0.so` and `libgstmse.so` (the plugin), loaded from Nacre's lib dir ahead of the
system copy. Offer the patches upstream (an MR to GStreamer). A C unit test per bug, like the Python probes in
the spike.
2. **MSE DOM to spec** (2 sessions): ready-state and event ordering, duration change, `removeSourceBuffer`,
`activeSourceBuffers`, `changeType`, sequence mode, `abort`, `HTMLMediaElement.buffered`/`seekable` from the
MediaSource, object URL lifetime (Blob URL store entry, #40749), no `Trusted` leak, a `dom_media_source_enabled`
pref, and the WPT `media-source` subset as smoke.
3. **Player integration** (1 session): seeking through msesrc, playback rate, error paths. The script thread must
not block in `GStreamerPlayer::setup` (async attach). `isTypeSupported` codec table: Opus in WebM, AV1 with
dav1d.
4. **YouTube + Reddit pass** (1 session): heavy-web YouTube steps green (play, seek, quality menu, captions, PiP,
ad blocking), plus Reddit's HLS video (hls.js over MSE) and site-doctor's video sites.
5. **Packaging** (1–2 sessions): AppImage bundles GStreamer ≥ 1.26.11 with the mse plugin, our patched libgstmse and
dav1d. The Windows installer bundles the MSVC runtime subset; check playback in the VM (software rendering).
Total **7–8 sessions**. Option B (own MSE core in Rust: fMP4/WebM byte-stream parsers, coded frame processing and
track buffers feeding one `appsrc` per track, like WebKit's own GStreamer MSE) is the fallback if bug 3 can't be
fixed inside msesrc. It would add 5–6 sessions.
## Risks
- Patched gst_mse must ship as our own copy on every platform until upstream releases the fixes (version skew
with the system GStreamer on Linux; bundling avoids it).
- `script` rebuilds take about 10 minutes per DOM edit; a Servo upgrade means re-applying the vendored patches (as D-012).
- YouTube's SABR streaming and A/B tests change often; the flakiness seen in the spike may have more causes than
bug 3.
- No EME: DRM content stays unavailable.
- Windows GStreamer bundle size and software-GL video in the VM are unmeasured.
## Recommendation
**Go, option A.** The DOM plus backend are small (the prototype took one session), the hard part (coded frame
processing) already exists in gst_mse, and the three blockers are concrete and local. Start with plan 1 (gst_mse
fixes), because it decides whether option B is needed. Plans 2–3 can then run while YouTube is re-checked.

View file

@ -1132,6 +1132,29 @@ impl App {
}
return;
}
// Typed addresses don't pass through `request_navigation`: catch downloads here as links are.
if matches!(parsed.scheme(), "http" | "https") {
let page = win.tabs[i].url.clone();
if download::looks_like_download(&parsed) {
self.start_download(parsed, page, None);
return;
}
if download::worth_probing(&parsed) {
let headers = self.request_headers(&parsed, &page);
let probe_url = parsed.clone();
self.spawn("probe", move || download::probe(&probe_url, &headers), move |app, result| match result {
Ok(probe) if probe.is_download => app.start_download(parsed, page, Some(probe.file_name)),
_ => app.load_in_active_tab(window, url, parsed),
});
return;
}
}
self.load_in_active_tab(window, url, parsed);
}
fn load_in_active_tab(&mut self, window: WindowId, url: String, parsed: Url) {
let Some(win) = self.windows.get(&window) else { return };
let Some(i) = (!win.tabs.is_empty()).then_some(win.active) else { return };
let has_web = win.tabs[i].web.is_some();
if has_web {
let win = self.windows.get_mut(&window).expect("found");
@ -1766,7 +1789,10 @@ impl App {
d.state = DlState::Done;
d.path = path.clone();
d.finished = util::now();
d.received = d.received.max(d.total);
// A small file finishes before its first progress report: take the size from the file.
let size = std::fs::metadata(&path).map(|m| m.len()).unwrap_or(0);
d.received = d.received.max(d.total).max(size);
d.total = d.total.max(d.received);
d.speed = 0;
}
drop(downloads);
@ -1901,7 +1927,7 @@ impl App {
app.applied.adblock.last_update = app.shared.settings.borrow().adblock.last_update;
app.save_settings();
let failures = app.shared.adblock.failures.read().map(|f| f.len()).unwrap_or(0);
*app.shared.adblock_status.borrow_mut() = if failures > 0 { format!("{} rules · {failures} lists couldn't be downloaded", fmt_count(rules)) } else { format!("{} rules · {refreshed} lists updated", fmt_count(rules)) };
*app.shared.adblock_status.borrow_mut() = if failures > 0 { format!("{} rules · {failures} list{} couldn't be downloaded", fmt_count(rules), if failures == 1 { "" } else { "s" }) } else { format!("{} rules · {refreshed} list{} updated", fmt_count(rules), if refreshed == 1 { "" } else { "s" }) };
app.redraw_all();
});
}

View file

@ -779,7 +779,6 @@ impl App {
let Some((w, i)) = self.find_webview(id) else { return };
match status {
LoadStatus::Started => {
self.hub.blocked.borrow_mut().insert(id, 0);
let win = self.windows.get_mut(&w).expect("found");
let tab = &mut win.tabs[i];
tab.load_status = Some(status);

View file

@ -236,8 +236,10 @@ impl Hub {
return;
}
drop(config);
// The app resets the blocked count when the page starts loading (LoadStatus::Started).
// A new page: count its blocked requests from zero. Here, not at LoadStatus::Started: the app
// sees that event after the page's first sub-resources were already decided and counted.
if let Some(id) = id {
self.blocked.borrow_mut().insert(id, 0);
self.log_request(id, &method, url.as_str(), &kind, false);
}
return;

View file

@ -189,6 +189,7 @@ impl Bridge {
if !pending.is_empty() {
let mut u = &upstream;
u.write_all(&pending)?;
self.bytes.fetch_add(pending.len() as u64, Ordering::Relaxed);
}
pump(client, upstream, &self.bytes);
return Ok(());
@ -228,6 +229,7 @@ impl Bridge {
let pending = reader.buffer().to_vec();
if !pending.is_empty() {
u.write_all(&pending)?;
self.bytes.fetch_add(pending.len() as u64, Ordering::Relaxed);
}
}
pump(client, upstream, &self.bytes);
@ -409,29 +411,27 @@ fn pump(client: TcpStream, upstream: TcpStream, counter: &Arc<AtomicU64>) {
let (Ok(client2), Ok(upstream2)) = (client.try_clone(), upstream.try_clone()) else { return };
let counter2 = counter.clone();
let up = thread::Builder::new().stack_size(64 * 1024).spawn(move || {
let n = copy(&client2, &upstream2);
counter2.fetch_add(n, Ordering::Relaxed);
copy(&client2, &upstream2, &counter2);
let _ = upstream2.shutdown(Shutdown::Write);
});
let n = copy(&upstream, &client);
counter.fetch_add(n, Ordering::Relaxed);
copy(&upstream, &client, counter);
let _ = client.shutdown(Shutdown::Write);
if let Ok(handle) = up {
let _ = handle.join();
}
}
fn copy(mut from: &TcpStream, mut to: &TcpStream) -> u64 {
fn copy(mut from: &TcpStream, mut to: &TcpStream, counter: &AtomicU64) {
// Counted as the bytes flow: kept-alive tunnels (HTTP/2) stay open for minutes.
let mut buf = [0u8; 16 * 1024];
let mut total = 0u64;
loop {
match from.read(&mut buf) {
Ok(0) | Err(_) => return total,
Ok(0) | Err(_) => return,
Ok(n) => {
if to.write_all(&buf[..n]).is_err() {
return total;
return;
}
total += n as u64;
counter.fetch_add(n as u64, Ordering::Relaxed);
},
}
}
@ -469,6 +469,8 @@ mod tests {
let mut buf = [0u8; 5];
s.read_exact(&mut buf).unwrap();
s.write_all(b"pong!").unwrap();
// Keep the tunnel open until the client goes.
let _ = s.read(&mut buf);
});
let bridge = Bridge::start().unwrap();
let mut c = TcpStream::connect(("127.0.0.1", bridge.port)).unwrap();
@ -483,5 +485,11 @@ mod tests {
let mut reply = vec![0u8; "HTTP/1.1 200 Connection established\r\n\r\npong!".len()];
c.read_exact(&mut reply).unwrap();
assert!(String::from_utf8_lossy(&reply).ends_with("pong!"));
// Traffic is counted while the tunnel is still open (it used to be counted when it closed).
let counted = (0..100).any(|_| {
thread::sleep(std::time::Duration::from_millis(10));
bridge.bytes.load(Ordering::Relaxed) >= 10
});
assert!(counted, "bytes counted: {}", bridge.bytes.load(Ordering::Relaxed));
}
}

View file

@ -19,7 +19,8 @@
//! do <action> a shortcut action by its settings key, e.g. `do new_tab`
//! cmd <name> [arg] back, forward, reload, bookmark, install_app, pip, exitpip, free_memory,
//! update_lists, check_updates, close_tab, select <n>, zoom <step>,
//! find <text>, download <url>, navigate <typed text>, mute, pin
//! find <text>, download <url>, pause_download|resume_download|cancel_download [id] (newest),
//! navigate <typed text>, mute, pin
//! js <script> run JavaScript in the current tab; the result goes to the log
//! assert <js expression> the expression must give true, else `ASSERT FAILED` in the log fails the smoke run
//! expect <pointer> <json> a value of the `status` JSON must equal json (e.g. `expect /tabs/1/pinned true`;
@ -305,6 +306,7 @@ impl App {
let (name, arg) = rest.split_once(char::is_whitespace).map(|(n, a)| (n, a.trim())).unwrap_or((rest, ""));
let tab = self.windows.get(&window).and_then(|w| w.tab()).map(|t| t.id).unwrap_or(0);
let page = self.windows.get(&window).and_then(|w| w.tab()).map(|t| t.url.clone()).unwrap_or_default();
let newest = self.shared.downloads.borrow().items.first().map(|d| d.id).unwrap_or(1);
let command = match name {
"back" => Command::Back,
"forward" => Command::Forward,
@ -321,8 +323,9 @@ impl App {
"zoom" => Command::Zoom(arg.parse().unwrap_or(1)),
"find" => Command::Find { text: arg.to_owned(), forward: true, case: false },
"download" => Command::DownloadUrl { url: arg.to_owned(), page, name: String::new() },
"pause_download" => Command::Download(DownloadOp::Pause(arg.parse().unwrap_or(1))),
"resume_download" => Command::Download(DownloadOp::Resume(arg.parse().unwrap_or(1))),
"pause_download" => Command::Download(DownloadOp::Pause(arg.parse().unwrap_or(newest))),
"resume_download" => Command::Download(DownloadOp::Resume(arg.parse().unwrap_or(newest))),
"cancel_download" => Command::Download(DownloadOp::Cancel(arg.parse().unwrap_or(newest))),
"navigate" => Command::Navigate(arg.to_owned()),
"mute" => Command::MuteTab(tab),
"pin" => Command::PinTab(tab),

View file

@ -0,0 +1,15 @@
# HTTP disk cache across a restart (R1-04, S007): after tests/smoke/cache.txt fetched the stylesheet once, a new run
# on the same profile shows the page with it and the server still counts one fetch. Offline. Keep the same server
# running for both runs:
# python3 tests/smoke/cache/server.py &
# tools/smoke.sh tests/smoke/cache.txt target/smoke/cache-a
# SMOKE_HOME=target/smoke/cache-a/home tools/smoke.sh tests/smoke/cache-restart.txt
wait 3
open http://127.0.0.1:8765/
waitfor 20 document.title === "Cache" && getComputedStyle(document.body).backgroundColor === "rgb(34, 170, 119)"
js fetch("/count").then(r => r.text()).then(t => { window.count = t; })
waitfor 5 window.count !== undefined
js window.count
assert window.count === "1"
status done
quit

Some files were not shown because too many files have changed in this diff Show more