diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2022-07-25 14:44:27 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2022-07-25 14:44:27 +0200 |
| commit | 32197e6ffc5178ade939cdfaac2ec21c8b0f9c2c (patch) | |
| tree | 0715fefb337ad467131b2c5485d218f919968fba | |
| parent | 51176121fa7770fd4c7fea3e515221f9e81976f4 (diff) | |
| parent | b1e5893713be7e9c725e0dddffe748130cdb6b2e (diff) | |
| download | mullvadvpn-32197e6ffc5178ade939cdfaac2ec21c8b0f9c2c.tar.xz mullvadvpn-32197e6ffc5178ade939cdfaac2ec21c8b0f9c2c.zip | |
Merge branch 'add-flag-for-not-resetting-navigation'
| -rw-r--r-- | gui/src/main/index.ts | 18 | ||||
| -rw-r--r-- | gui/tasks/electron.js | 9 |
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', }); |
