From ad79f42d27cae63625866b21a3f023336e42db1f Mon Sep 17 00:00:00 2001 From: Kiran Niranjan Date: Mon, 23 Dec 2024 22:19:16 +0530 Subject: [PATCH] SDA-4757 - Add safety check for chrome flags & wait for app ready for dialog --- src/app/chrome-flags.ts | 10 +++++----- src/app/config-handler.ts | 2 +- src/app/window-handler.ts | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/app/chrome-flags.ts b/src/app/chrome-flags.ts index 2a676e067..7f9b07029 100644 --- a/src/app/chrome-flags.ts +++ b/src/app/chrome-flags.ts @@ -39,17 +39,17 @@ export const setChromeFlags = () => { ]) as any; const configFlags: object = { 'auth-negotiate-delegate-whitelist': - flagsConfig.customFlags.authNegotiateDelegateWhitelist, - 'auth-server-whitelist': flagsConfig.customFlags.authServerWhitelist, + flagsConfig.customFlags?.authNegotiateDelegateWhitelist, + 'auth-server-whitelist': flagsConfig.customFlags?.authServerWhitelist, 'disable-background-timer-throttling': 'true', 'disable-d3d11': true, - 'disable-gpu': flagsConfig.disableGpu || null, - 'disable-gpu-compositing': flagsConfig.disableGpu || null, + 'disable-gpu': flagsConfig?.disableGpu || null, + 'disable-gpu-compositing': flagsConfig?.disableGpu || null, 'enable-blink-features': 'RTCInsertableStreams', 'disable-features': 'ChromeRootStoreUsed', }; if ( - flagsConfig.customFlags.disableThrottling === + flagsConfig.customFlags?.disableThrottling === CloudConfigDataTypes.ENABLED || disableThrottling === CloudConfigDataTypes.ENABLED ) { diff --git a/src/app/config-handler.ts b/src/app/config-handler.ts index 4d31c7e42..e827266d0 100644 --- a/src/app/config-handler.ts +++ b/src/app/config-handler.ts @@ -75,7 +75,7 @@ export interface IConfig { autoLaunchPath: string; userDataPath: string; permissions: IPermission; - customFlags: ICustomFlag; + customFlags?: ICustomFlag; buildNumber?: string; configVersion?: string; notificationSettings: INotificationSetting; diff --git a/src/app/window-handler.ts b/src/app/window-handler.ts index 7acb3451d..d86020820 100644 --- a/src/app/window-handler.ts +++ b/src/app/window-handler.ts @@ -238,6 +238,7 @@ export class WindowHandler { // Handle uncaught exception and terminate application process.on('uncaughtException', async (error) => { logger.error('window-handler: uncaught exception', error); + await app.whenReady(); const messageBoxOptions: MessageBoxSyncOptions = { type: 'question', title: i18n.t('Relaunch Application')(), @@ -281,7 +282,7 @@ export class WindowHandler { this.contextIsolation = this.globalConfig.contextIsolation; } this.backgroundThrottling = - customFlags.disableThrottling !== CloudConfigDataTypes.ENABLED || + customFlags?.disableThrottling !== CloudConfigDataTypes.ENABLED || disableThrottling !== CloudConfigDataTypes.ENABLED; this.isCustomTitleBar = isWindowsOS &&