diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2021-12-28 13:08:45 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2022-01-24 16:41:25 +0100 |
| commit | c613f13f1570048768c4eb9ded97e9aa9eb9f4f3 (patch) | |
| tree | 35a782578f5020e2f04d6f4f22fe095a00652796 /gui/src/main | |
| parent | 127fdb5bc7e9ca10ca4ce690ff1e986a2732a8c2 (diff) | |
| download | mullvadvpn-c613f13f1570048768c4eb9ded97e9aa9eb9f4f3.tar.xz mullvadvpn-c613f13f1570048768c4eb9ded97e9aa9eb9f4f3.zip | |
Disable background throttling while resetting navigation while in background
Diffstat (limited to 'gui/src/main')
| -rw-r--r-- | gui/src/main/index.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index 5e361da04c..294bddc494 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -249,6 +249,7 @@ class ApplicationMain { private autoConnectFallbackScheduler = new Scheduler(); private blurNavigationResetScheduler = new Scheduler(); + private backgroundThrottleScheduler = new Scheduler(); private rendererLog?: Logger; private translations: ITranslations = { locale: this.locale }; @@ -1192,10 +1193,14 @@ class ApplicationMain { // Use hide instead of blur to prevent the navigation reset from happening when bluring an // unpinned window. windowController.window?.on('hide', () => { - this.blurNavigationResetScheduler.schedule( - () => IpcMainEventChannel.navigation.notifyReset(windowController.webContents), - 120_000, - ); + this.blurNavigationResetScheduler.schedule(() => { + this.windowController?.webContents?.setBackgroundThrottling(false); + IpcMainEventChannel.navigation.notifyReset(windowController.webContents); + + this.backgroundThrottleScheduler.schedule(() => { + this.windowController?.webContents?.setBackgroundThrottling(true); + }, 1_000); + }, 120_000); }); } |
