Extensions: WT: Fix UAF in WebTransport proxy during profile teardown
When an Incognito window is closed, hanging WebTransport connections
can cause the proxy to outlive its associated `BrowserContext`.
Because `WebRequestAPI` spans both regular and Incognito profiles,
proxies tied to the Incognito context miss the standard KeyedService
shutdown event. When the hanging network connection eventually times
out or errors, the proxy attempts to access the destroyed
`BrowserContext`, triggering a fatal BackupRefPtr (BRP) Use-After-Free
crash.
This CL fixes the Use-After-Free by:
1. Introducing `WebRequestProxyingWebTransportShutdownNotifierFactory`
to proactively listen for the specific `BrowserContext`'s
destruction.
2. Updating `WebTransportHandshakeProxy` to subscribe to this notifier
and cleanly self-destruct (and sever its Mojo pipes) before the
profile memory is quarantined.
3. Adding factory dependencies to ensure `WebRequestEventRouterFactory`
outlives `WebRequestAPI` so network errors can be safely broadcasted
during the teardown sequence.
Additionally, a comprehensive regression test is added to
deterministically race asynchronous cross-process WebTransport Mojo
network errors against Incognito profile destruction.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Thanks, Solomon!
webRequest -> andreaorru
(Feel free to add me back if there's anything that needs my specific review)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |