[2026-09-10] eagle: work/projects/cpm-web-extension-breakage-findings.md

This commit is contained in:
Alexey Martemyanov
2026-09-10 11:25:19 +06:00
parent 9d1a4213c6
commit 44aa4afb25
@@ -1208,6 +1208,10 @@ Chain, all WebKit, all confirmed by the log:
Symptom match: all tabs, new tabs too, survives reload, banners not handled, dashboard `waiting`, Fire fixes, no visible error in the app. Pixel signature: `extension_context_errors=background_failed_to_load` + `background_view_alive=true` + `background_view_create_count` ≥ 2 + `network_process_restarted=false`.
**Why fetches do not matter / what keeps it dead.** The background is woken only by `runtime.sendMessage` from a *new document* (cpm.js at `document_start`, `all_frames: true`, `match_origin_as_fallback: true`) and by the one-shot `cpm-summary` alarm; the healthy worker registers only `runtime.onMessage`, `runtime.onConnect`, `alarms.onAlarm`. Realistic sustained sources: ad-slot iframes refreshing every 1530 s, embeds/chat widgets creating frames, `meta refresh`/`location.reload()` pages, the user's own navigation. Regimes: gaps < 30 s → the failed view is never unloaded at all (timer re-armed on every wake); 3040 s → unload/retry loop that fails; > 40 s → self-heal.
**Test page:** `cpm-ad-churn.html` in the repo root — privacy-test-pages autoconsent markup (`#privacy-test-page-cmp-test` / `#reject-all`, no reload guard) plus a fake ad iframe recreated every `?period=` s (default 10), each frame with its own fake CMP; per-frame ✅/⏳ table shows whether CPM handled it. Deploy to Eagle Pages: `sudo cp ~/DuckDuckGo/apple-browsers.git/cpm-breakage-pixel/cpm-ad-churn.html /Library/WebServer/Documents/``http://localhost/local-pages/cpm-ad-churn.html` (dashboard reads the directory live). Debug → Web Extensions now shows a disabled "CPM Background WebContent PID: …" item for the `kill -9`.
**Reproduction (DEBUG, 100 %):** "Print CPM Diagnostics Snapshot" → `kill -9 <background_web_process_pid>` → reload any tab with a cookie banner. Log with
`log stream --level debug --predicate '(subsystem == "com.apple.WebKit" AND category == "ServiceWorker") OR category == "Extensions" OR composedMessage CONTAINS "[CPM"'`
and look for "creating a new service worker process" followed by "Created service worker N in process PID <≠ webProcessPID of the view>" and "Job N failed with error Script error."