[2026-09-10] eagle: work/projects/cpm-web-extension-breakage-findings.md
This commit is contained in:
@@ -1212,6 +1212,8 @@ Symptom match: all tabs, new tabs too, survives reload, banners not handled, das
|
||||
|
||||
**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`.
|
||||
|
||||
**Diagnostics added for this class (2026-09-10):** `CPMBackgroundWebViewDelegateProxy` — a forwarding `WKNavigationDelegate` installed in `didCreateBackgroundWebView` in front of WebKit's own `_WKWebExtensionContextDelegate` (which WebKit assigns before the callback and needs for its own unload). Forwards every selector the original answers (WebKit snapshots `respondsToSelector:` at assignment), retains the original for the view's life, and intercepts: `webViewWebContentProcessDidTerminate:` + private `_webView:webContentProcessDidTerminateWithReason:` (`_WKProcessTerminationReason`: memory_limit / cpu_limit / requested_by_client / crash / shared_crash_limit; WebKit calls only the private one when both exist, so the proxy re-dispatches to whichever the original implements), and WebKit's hang detection `_webViewWebProcessDidBecomeUnresponsive:` / `…Responsive:` (UI-side `ResponsivenessTimer`, 3 s per replied message; `BackgroundProcessResponsivenessTimer` for page-less processes: ping every 20 s doubling to 8 h, 90 s to answer — the same signals Safari's "not responding" uses). Recorder → pixel: `background_process_terminations`, `background_process_terminated` (age bucket), `background_process_termination_reason`, `background_process_unresponsive`, `background_process_unresponsive_count`, plus `background_web_process_responsive` from `WKWebView._webProcessIsResponsive` at snapshot time. Health-monitor state machine untouched; it receives these through the diagnostics provider.
|
||||
|
||||
**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."
|
||||
|
||||
Reference in New Issue
Block a user