summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2022-07-24 15:05:17 +0200
committerOskar Nyberg <oskar@mullvad.net>2022-07-25 13:54:04 +0200
commitb1e5893713be7e9c725e0dddffe748130cdb6b2e (patch)
tree0715fefb337ad467131b2c5485d218f919968fba
parent51176121fa7770fd4c7fea3e515221f9e81976f4 (diff)
downloadmullvadvpn-b1e5893713be7e9c725e0dddffe748130cdb6b2e.tar.xz
mullvadvpn-b1e5893713be7e9c725e0dddffe748130cdb6b2e.zip
Add flag that prevents navigation to be reset 2 minutes after blur
-rw-r--r--gui/src/main/index.ts18
-rw-r--r--gui/tasks/electron.js9
2 files changed, 19 insertions, 8 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index 0b3bb1b834..461cac3214 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -109,6 +109,7 @@ const ALLOWED_PERMISSIONS = ['clipboard-sanitized-write'];
enum Options {
quitWithoutDisconnect = '--quit-without-disconnect',
showChanges = '--show-changes',
+ disableResetNavigation = '--disable-reset-navigation', // development only
}
enum AppQuitStage {
@@ -250,6 +251,7 @@ class ApplicationMain {
},
);
+ private disableResetNavigation = process.argv.includes(Options.disableResetNavigation);
private blurNavigationResetScheduler = new Scheduler();
private backgroundThrottleScheduler = new Scheduler();
@@ -1261,14 +1263,16 @@ 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(() => {
- this.windowController?.webContents?.setBackgroundThrottling(false);
- IpcMainEventChannel.navigation.notifyReset(windowController.webContents);
+ if (process.env.NODE_ENV !== 'development' || !this.disableResetNavigation) {
+ 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);
+ this.backgroundThrottleScheduler.schedule(() => {
+ this.windowController?.webContents?.setBackgroundThrottling(true);
+ }, 1_000);
+ }, 120_000);
+ }
});
}
diff --git a/gui/tasks/electron.js b/gui/tasks/electron.js
index 889e501931..3469756397 100644
--- a/gui/tasks/electron.js
+++ b/gui/tasks/electron.js
@@ -1,10 +1,17 @@
const { spawn } = require('child_process');
const electron = require('electron');
+const DISABLE_RESET_NAVIGATION = '--disable-reset-navigation';
+
let subprocess;
function startElectron(done) {
- subprocess = spawn(electron, ['.'], {
+ const args = [];
+ if (process.argv.includes(DISABLE_RESET_NAVIGATION)) {
+ args.push(DISABLE_RESET_NAVIGATION);
+ }
+
+ subprocess = spawn(electron, ['.', ...args], {
env: { ...process.env, NODE_ENV: 'development' },
stdio: 'inherit',
});