From d55af4041d447ede6f13b064af30b8c1c34e3dee Mon Sep 17 00:00:00 2001 From: TheGoddessInari Date: Fri, 14 Feb 2020 13:21:10 -0800 Subject: [PATCH] Go back to slightly older style RemoveServiceFn, but respecting WebContents. Fix for a5e13d5. --- app/view/main/MainController.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/view/main/MainController.js b/app/view/main/MainController.js index 33829112..2bfdbe7b 100644 --- a/app/view/main/MainController.js +++ b/app/view/main/MainController.js @@ -139,27 +139,28 @@ Ext.define('Hamsket.view.main.MainController', { rec.set('enabled', true); me.onEnableDisableService(null, Ext.getStore('Services').indexOf(rec), true, null, true); const tab = Ext.getCmp('tab_'+serviceId); - const webview = tab.getWebView(); + const webcontents = tab.getWebContents(); webview.addEventListener("did-start-loading", function() { - clearData(tab, resolve); + clearData(webcontents, tab, resolve); }); } else { // Get Tab // Clear all trash data const tab = Ext.getCmp('tab_'+serviceId); - clearData(tab, resolve); + const webcontents = tab.getWebContents(); + clearData(webcontents, tab, resolve); } const config = ipc.sendSync('getConfig'); if ( config.default_service === rec.get('id') ) ipc.send('setConfig', Ext.apply(config, { default_service: 'hamsketTab' })); - function clearData(tab, resolve) { - tab.getWebContents().clearHistory(); - tab.getWebContents().session.flushStorageData(); - tab.getWebContents().session.clearCache() - .then(tab.getWebContents().session.clearStorageData) - .then(tab.getWebContents().session.cookies.flushStore) + function clearData(webcontents, tab, resolve) { + webcontents.clearHistory(); + webcontents.session.flushStorageData(); + webcontents.session.clearCache() + .then(webcontents.session.clearStorageData) + .then(webcontents.session.cookies.flushStore) .finally(function() { // Remove record from localStorage Ext.getStore('Services').remove(rec);