diff options
author | 2021-09-08 19:27:23 +0530 | |
---|---|---|
committer | 2021-09-08 19:49:43 +0530 | |
commit | 7a446f7b8e9d4162d8e81eb863e151ef0ab66554 (patch) | |
tree | 2bd7794fb5080ad16d44420bc1f94ca2638435b7 /recipes/lastpass/webview.js | |
parent | execute prepare script with npx to avoid missing husky dependency error (#676) (diff) | |
download | ferdium-recipes-7a446f7b8e9d4162d8e81eb863e151ef0ab66554.tar.gz ferdium-recipes-7a446f7b8e9d4162d8e81eb863e151ef0ab66554.tar.zst ferdium-recipes-7a446f7b8e9d4162d8e81eb863e151ef0ab66554.zip |
refactor: use the exposed methods for session handling from the main repo
Diffstat (limited to 'recipes/lastpass/webview.js')
-rw-r--r-- | recipes/lastpass/webview.js | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/recipes/lastpass/webview.js b/recipes/lastpass/webview.js index 878fa5e..4a92e0c 100644 --- a/recipes/lastpass/webview.js +++ b/recipes/lastpass/webview.js | |||
@@ -7,21 +7,10 @@ setTimeout(() => { | |||
7 | window.location.reload(); | 7 | window.location.reload(); |
8 | } | 8 | } |
9 | }, 1000); | 9 | }, 1000); |
10 | |||
10 | window.addEventListener('beforeunload', async () => { | 11 | window.addEventListener('beforeunload', async () => { |
11 | try { | 12 | Ferdi.clearStorageData(['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb']); |
12 | const { session } = Ferdi.getCurrentWebContents(); | 13 | Ferdi.releaseServiceWorkers(); |
13 | session.flushStorageData(); | ||
14 | session.clearStorageData({ | ||
15 | storages: ['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb'], | ||
16 | }); | ||
17 | const registrations = await window.navigator.serviceWorker.getRegistrations(); | ||
18 | registrations.forEach(r => { | ||
19 | r.unregister(); | ||
20 | console.log('ServiceWorker unregistered'); | ||
21 | }); | ||
22 | } catch (err) { | ||
23 | console.err(err); | ||
24 | } | ||
25 | }); | 14 | }); |
26 | 15 | ||
27 | module.exports = Ferdi => { | 16 | module.exports = Ferdi => { |