chore: bump electron version to 12.0.6

* Bump electron version to 12.0.6
* Move web content clean up logic to window close event

Reference from electron release notes:
> Fixed the window-all-closed event being emitted while the last
BrowserWindow was still in the process of being closed.
This commit is contained in:
Svallinn 2021-05-01 03:43:28 +01:00
parent 2e69c40514
commit 91776441f1
No known key found for this signature in database
GPG Key ID: 09FB527F34037CCA
3 changed files with 20 additions and 18 deletions

6
package-lock.json generated
View File

@ -7290,9 +7290,9 @@
} }
}, },
"electron": { "electron": {
"version": "12.0.5", "version": "12.0.6",
"resolved": "https://registry.npmjs.org/electron/-/electron-12.0.5.tgz", "resolved": "https://registry.npmjs.org/electron/-/electron-12.0.6.tgz",
"integrity": "sha512-z0xYB3sPr0qZcDrHUUWqooPKe3yUzBDxQcgQe3f2TLstA84JIFXBoaIJCPh/fJW0+JdF/ZFVeK2SNgLhYtRV+Q==", "integrity": "sha512-+fqhpdG6Fd6LzsizMdaSPC1I8tfsMT8/7fsYBgABED3hEWdus/rt6CQ54P3/EWZyQebtyHR6HXtlofUqKMV3KQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@electron/get": "^1.0.1", "@electron/get": "^1.0.1",

View File

@ -70,7 +70,7 @@
"copy-webpack-plugin": "8.0.0", "copy-webpack-plugin": "8.0.0",
"css-loader": "^5.1.1", "css-loader": "^5.1.1",
"devtron": "^1.4.0", "devtron": "^1.4.0",
"electron": "^12.0.5", "electron": "^12.0.6",
"electron-builder": "^22.10.5", "electron-builder": "^22.10.5",
"electron-builder-squirrel-windows": "^22.10.5", "electron-builder-squirrel-windows": "^22.10.5",
"electron-debug": "^3.2.0", "electron-debug": "^3.2.0",

View File

@ -326,6 +326,22 @@ function runApp() {
newWindow.focus() newWindow.focus()
}) })
newWindow.on('close', () => {
newWindow.webContents.session.clearCache()
newWindow.webContents.session.clearStorageData({
storages: [
'appcache',
'cookies',
'filesystem',
'indexdb',
'shadercache',
'websql',
'serviceworkers',
'cachestorage'
]
})
})
newWindow.on('closed', () => { newWindow.on('closed', () => {
// Remove closed window // Remove closed window
openedWindows = openedWindows.filter((window) => window !== newWindow) openedWindows = openedWindows.filter((window) => window !== newWindow)
@ -406,20 +422,6 @@ function runApp() {
if (process.platform !== 'darwin') { if (process.platform !== 'darwin') {
app.quit() app.quit()
} }
mainWindow.webContents.session.clearCache()
mainWindow.webContents.session.clearStorageData({
storages: [
'appcache',
'cookies',
'filesystem',
'indexdb',
'shadercache',
'websql',
'serviceworkers',
'cachestorage'
]
})
}) })
app.on('activate', () => { app.on('activate', () => {