Main: Clear cache and storage data only when the last window is closed

This prevents the CONSENT cookie from being deleted after a window
is closed by the user, making it so that the user can no
longer load the comment section.
This commit is contained in:
Svallinn 2021-05-10 06:01:35 +01:00
parent b37c46f12d
commit 640ed6818a
No known key found for this signature in database
GPG Key ID: 09FB527F34037CCA
1 changed files with 16 additions and 13 deletions

View File

@ -327,6 +327,8 @@ function runApp() {
}) })
newWindow.on('close', () => { newWindow.on('close', () => {
// Clear cache and storage if it's the last window
if (openedWindows.length === 1) {
newWindow.webContents.session.clearCache() newWindow.webContents.session.clearCache()
newWindow.webContents.session.clearStorageData({ newWindow.webContents.session.clearStorageData({
storages: [ storages: [
@ -340,6 +342,7 @@ function runApp() {
'cachestorage' 'cachestorage'
] ]
}) })
}
}) })
newWindow.on('closed', () => { newWindow.on('closed', () => {