summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2021-12-28 13:08:45 +0100
committerOskar Nyberg <oskar@mullvad.net>2022-01-24 16:41:25 +0100
commitc613f13f1570048768c4eb9ded97e9aa9eb9f4f3 (patch)
tree35a782578f5020e2f04d6f4f22fe095a00652796 /gui
parent127fdb5bc7e9ca10ca4ce690ff1e986a2732a8c2 (diff)
downloadmullvadvpn-c613f13f1570048768c4eb9ded97e9aa9eb9f4f3.tar.xz
mullvadvpn-c613f13f1570048768c4eb9ded97e9aa9eb9f4f3.zip
Disable background throttling while resetting navigation while in background
Diffstat (limited to 'gui')
-rw-r--r--gui/src/main/index.ts13
-rw-r--r--gui/src/renderer/app.tsx4
-rw-r--r--gui/src/renderer/lib/history.tsx4
3 files changed, 14 insertions, 7 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);
});
}
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx
index 7fc2411855..7b4b63c969 100644
--- a/gui/src/renderer/app.tsx
+++ b/gui/src/renderer/app.tsx
@@ -177,7 +177,9 @@ export default class AppRenderer {
this.reduxActions.userInterface.setMacOsScrollbarVisibility(visibility);
});
- IpcRendererEventChannel.navigation.listenReset(() => this.history.dismiss(true));
+ IpcRendererEventChannel.navigation.listenReset(() =>
+ this.history.dismiss(true, transitions.none),
+ );
// Request the initial state from the main process
const initialState = IpcRendererEventChannel.state.get();
diff --git a/gui/src/renderer/lib/history.tsx b/gui/src/renderer/lib/history.tsx
index a391e70fee..4abdcd5fcb 100644
--- a/gui/src/renderer/lib/history.tsx
+++ b/gui/src/renderer/lib/history.tsx
@@ -88,9 +88,9 @@ export default class History {
this.notify(transitions.show);
};
- public dismiss = (all?: boolean) => {
+ public dismiss = (all?: boolean, transition = transitions.dismiss) => {
if (this.popImpl(all ? this.index : 1)) {
- this.notify(transitions.dismiss);
+ this.notify(transition);
}
};