mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(devtools): fix incorrect logic in destroy function for ChromeMessageBus
Destroy uses window.removeEventListener but the ChromeMessageBus doesn't actually depend on a window object. In practice this code is unlikely to ever be reached. If a tab is closed the entire context script JS process is killed so this is not an bug that would be very common or even reachable. That being said for correctness this should not be using window.
This commit is contained in:
committed by
Leon Senft
parent
543753f551
commit
36edf4870f
@@ -80,7 +80,7 @@ export class ChromeMessageBus extends MessageBus<Events> {
|
||||
}
|
||||
|
||||
override destroy(): void {
|
||||
this._listeners.forEach((l) => window.removeEventListener('message', l));
|
||||
this._listeners.forEach((l) => this._port.onMessage.removeListener(l));
|
||||
this._listeners = [];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user