SIGN IN SIGN UP

[DevTools] Reset extension backend on pagehide (#37155)

I have noticed inconsistency errors being thrown during browser
navigations that involve entries from BFCache. The main argument on why
this could be affecting React DevTools backend lifecycle is the fact
that Chrome kills the port manually, while freezing and preserving the
JavaScript heap -
https://developer.chrome.com/blog/bfcache-extension-messaging-changes.

Basically, we could end up in a permutation, where port is dead, but
Backend / Agent are alive. Such setup is not expected by React DevTools.

On `main`:


https://github.com/user-attachments/assets/9ca10286-b545-4384-bd6b-33d9a4ddde3d


With these changes:


https://github.com/user-attachments/assets/c4639c4a-6385-4248-a5c4-a39895d7fff6


I couldn't come up with a good test for this yet, but I will try to add
something. I am not convinced yet that emulating `pagehide` / `pageshow`
would be sufficient to reproduce browser environment during BFCache
entries.
R
Ruslan Lesiutin committed
0f42eac25e44090837e92304ac08d8d430ceef0a
Parent: 7acf005
Committed by GitHub <noreply@github.com> on 7/30/2026, 8:17:49 PM