1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 07:13:32 +00:00

[PM-2197] Fix memory leaks in Safari (#5451)

* Remove reference cycle between ThemingService and the global window object

* Deregister messageListeners on a safari popup to avoid mem leaks

* Use pagehide event instead of unload
This commit is contained in:
Daniel García
2023-05-16 16:26:01 +02:00
committed by GitHub
parent c58b0c0753
commit 8e61184c0f
2 changed files with 18 additions and 6 deletions

View File

@@ -63,7 +63,7 @@ export class ThemingService implements AbstractThemingService {
protected monitorSystemThemeChanges(): void {
fromEvent<MediaQueryListEvent>(
this.window.matchMedia("(prefers-color-scheme: dark)"),
window.matchMedia("(prefers-color-scheme: dark)"),
"change"
).subscribe((event) => {
this.updateSystemTheme(event.matches ? ThemeType.Dark : ThemeType.Light);