Skip to content

Commit 36edf48

Browse files
AleksanderBodurrileonsenft
authored andcommitted
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.
1 parent 543753f commit 36edf48

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

devtools/projects/shell-browser/src/app/chrome-message-bus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class ChromeMessageBus extends MessageBus<Events> {
8080
}
8181

8282
override destroy(): void {
83-
this._listeners.forEach((l) => window.removeEventListener('message', l));
83+
this._listeners.forEach((l) => this._port.onMessage.removeListener(l));
8484
this._listeners = [];
8585
}
8686
}

0 commit comments

Comments
 (0)