SDA-3662 - Fix window will navigate issue on main webContents (#1395)

This commit is contained in:
Kiran Niranjan 2022-04-26 13:04:39 +05:30 committed by GitHub
parent ca983d847e
commit 4494e19956
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

2
package-lock.json generated
View File

@ -18997,4 +18997,4 @@
}
}
}
}
}

View File

@ -158,7 +158,14 @@ export const preventWindowNavigation = (
}
};
browserWindow.webContents.on('will-navigate', listener);
if (isPopOutWindow) {
browserWindow.webContents.on('will-navigate', listener);
} else {
const mainWebContents = windowHandler.getMainWebContents();
if (mainWebContents && !mainWebContents.isDestroyed()) {
mainWebContents.on('will-navigate', listener);
}
}
browserWindow.once('close', () => {
browserWindow.webContents.removeListener('will-navigate', listener);