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

This commit is contained in:
Alexey Martemyanov
2026-09-08 21:02:57 +06:00
parent fb9127c758
commit bd5f34a658
@@ -75,7 +75,7 @@ The retained-failed-view state from the findings doc becomes persistent only whe
Repeat cycle per retry: message → `loadBackgroundWebView` → fail → second message arms timer → 30 s → unload → third message → fail again. Every retry records `BackgroundContentFailedToLoad`, so unlike A/B this variant **is** visible in `WKWebExtensionContext.errors`. Repeat cycle per retry: message → `loadBackgroundWebView` → fail → second message arms timer → 30 s → unload → third message → fail again. Every retry records `BackgroundContentFailedToLoad`, so unlike A/B this variant **is** visible in `WKWebExtensionContext.errors`.
App-side removal paths checked: `cleanupOrphanedExtensions` (`WebExtensionStorageProviding.swift:180-199`) only deletes identifiers not in the installation store; upgrade installs the new UUID before uninstalling the old (`WebExtensionManager+EmbeddedExtensions.swift:90-108`); scriptlet installer writes into the same directory (`ScriptletInstaller.swift:29-37`, prepareDirectory — verify it does not recreate the directory). No in-app path found that removes a loaded extension's files; external causes (disk cleaners, sync tools, disk full) remain possible. App-side removal paths checked: `cleanupOrphanedExtensions` (`WebExtensionStorageProviding.swift:180-199`) only deletes identifiers not in the installation store; upgrade installs the new UUID before uninstalling the old (`WebExtensionManager+EmbeddedExtensions.swift:90-108`); scriptlet installer only creates directories and overwrites individual files (`ScriptletInstaller.swift:29-59`), never removes the bundle. No in-app path found that removes a loaded extension's files; external causes (disk cleaners, sync tools, disk full) remain possible.
### D. Tab-local: sender page not resolvable ### D. Tab-local: sender page not resolvable
@@ -96,7 +96,7 @@ The "Evidence needed next" plan would misclassify A/B: `errors` is empty and `lo
## Fix candidates (app side, no WebKit change needed) ## Fix candidates (app side, no WebKit change needed)
1. On `cpmMessagingStuck`, call `WKWebExtensionContext.reload()` or `loadBackgroundContent` after forcing an unload — the only reliable way to recreate the worker is to drop the background view. There is no public "unload background" API; `reload()` is the supported path (that is what the debug menu does). 1. On `cpmMessagingStuck`, unload + load the context through `WKWebExtensionController` (the existing `reloadExtension(identifier:)` path). `loadBackgroundContent(completionHandler:)` alone does not help in A/B because WebKit already considers the background loaded; there is no public API to drop only the background view.
2. Set a stable `baseURL` (above). 2. Set a stable `baseURL` (above).
3. Use a persistent background page? Not available on iOS and not needed; alternatively keep the worker "non-idle" — not controllable from the extension. 3. Use a persistent background page? Not available on iOS and not needed; alternatively keep the worker "non-idle" — not controllable from the extension.
4. Have the content script retry `init` with backoff and treat `undefined` as failure; today `cpm.js` waits forever. 4. Have the content script retry `init` with backoff and treat `undefined` as failure; today `cpm.js` waits forever.