mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-15 17:55:15 -10:00
- Previously, if a port is disconnected by the other end, then memory would be leaked to `ProxyMessenger.ports` in ExtensionParent.jsm. To fix this, the port descriptor is now saved separately, keyed by port ID instead of message manager. - Previously, when a message manager was disconnected (e.g. window closed/tab crashed), the port is disconnected only if the port was created from that page. This patch adds bookkeeping to keep track of the message managers at both the sender and receiver's side, so that the port is always disconnected when the other side goes away. - The new test browser_ext_port_disconnect_on_crash.js checks whether the ports are disconnected as expected. Previously, the subtest connect_from_tab_to_bg_and_crash_tab failed because of the previous point. - Although not as deterministic as the crash test, the new browser_ext_port_disconnect_on_window_close.js reproduces the original test failure and serves as a regression test for the bug. - Previously, the data structure in ProxyMessenger.ports contained the original `sender` and `recipient`. For the purpose of sending port disconnection messages, these are not necessary and therefore they have been removed. - Fix incorrect JSDoc (type of portId is number, not string) MozReview-Commit-ID: BoaKRVAUKuq