4.3 KiB
4.3 KiB
S044 — Engine seam: pure logic out of the Servo files
Category 08 WebKit engine · Model: Opus · Effort: medium · Depends on: — · Size: M · Human: no · cargo (main target/) Files touched: src/hub.rs, src/net/privacy.rs (new), src/adblock.rs, src/tabs.rs, src/app.rs, src/actions.rs, src/selftest.rs, src/store/cookies.rs, Cargo.toml (no dep changes)
Goal
First step of docs/engine/servo-removal.md §7: everything that must survive Servo moves out of Servo-typed code, and
the event surface the glue produces becomes engine-neutral, so S045 can swap the engine without touching app logic.
The app still builds and runs on Servo at the end of this plan.
Read
docs/engine/servo-removal.md§3 (all), §7.src/hub.rs(whole),src/tabs.rs(types),src/app.rshandle_event(547–800), thehub::uses insrc/actions.rs(grep).
Steps
- Move
privacy_headers,strip_tracking, the Firefox-style language list and third-party matching (fromhub.rs/net::nacrecallers) intosrc/net/privacy.rswith their unit tests (privacy_language_list_is_firefox_style,privacy_headers_follow_the_settings_and_reach_requests,third_party_matching_keeps_same_site_subdomains); Servo code calls the new module. - Move
HubConfigand the request decision (HTTPS-only upgrade, tracking strip, image permission, ad-block verdict →Decisionenum with Block/Replace/Redirect/Allow) out ofHub::decideinto an engine-neutralfn decide(cfg, req) -> Decision(pure, unit-tested);load_web_resourcebecomes a thin adapter. - Give tabs a Nacre-owned view id (
ViewId(u64), reusenew_tab_id) and makehub::Eventcarry it instead ofWebViewId; one mapWebViewId → ViewIdlives in the Servo glue only. — moved to S045 (orchestrator, 2026-11-13, D-041) - Replace Servo payload types in
Eventandtabs.rs(LoadStatus,JSValue,ContextMenu,EmbedderControl,PermissionRequest,ConsoleLogLevel, …) by small Nacre enums/structs (LoadState,JsValue=serde_json::Value,PageMenuRequest,Control,PermissionAsk, …) holding a glue-side handle (boxed responder closure) where Servo needs an answer object. — moved to S045 (orchestrator, 2026-11-13, D-041) - Port
selftest.rsJS-result matches andfakeloadto the neutral types. — moved to S045 (orchestrator, 2026-11-13, D-041) nice cargo build --release -j 2green;nice cargo test --release -j 2green (new tests counted).- Smoke on Servo still green:
tools/smoke.sh tests/smoke/launch.txt,basics.txt,input.txt(hidden). - PROGRESS entry, INDEX line, tracker, commit
S044: …, push.
WIP — stopped here (2026-11-13, context limit of the spike session)
- Done (boxes 1–2):
src/net/privacy.rs(privacy headers, tracking strip, language list + tests),src/net/policy.rs(HubConfig,Request,Outcome, puredecide()+ 4 tests);Hub::decideis a thin Servo adapter. The third-party test stays inhub.rs(it tests vendored servo-net; WebKit's cookie policy replaces it). Note:Outcome, notDecision(name taken bystore::permissions). - Verified on the WIP: release build green,
cargo test74 green (was 70), smokes launch, basics, input, net-adblock, net-privacy exit 0 (hidden, Servo). - Not done: boxes 3–4 (ViewId, neutral payload types). Finding: 56 uses of Servo payload types outside
hub.rsplus 14WebViewIdsites in app/actions; converting them now means new Servo adapters that S045/S048 delete again. Recommendation for the orchestrator: fold boxes 3–4 into S045 (Event surface defined there directly on WebKit, with the payload types S047/S048 need), then tick 5–7 here on what exists and close S044.
End criteria
grep -rn "servo::" src --include=*.rs | grep -v -E "src/(hub|window|app|resources)\.rs"lists only glue adapters (each named in PROGRESS);src/net/privacy.rshas noservoimport.cargo testgreen, launch/basics/input smokes green.
Pitfalls
- No behaviour change: this is a move, not a rewrite (CLAUDE.md §3). Keep the
hub::Event-after-spin design. - Servo needs answers synchronously in
load_web_resource; keep the decision pure and fast. - One cargo user per target/ (CLAUDE.md §4).
Handoff (→ PROGRESS.md)
List the neutral types and where the glue adapters live; S045 implements the same Event surface on WebKit.