Clear worker key caches in openpgp.destroyWorker()

This commit is contained in:
Daniel Huigens 2020-01-24 17:07:30 +01:00
parent fb666f0624
commit 66acd979bf

View File

@ -89,10 +89,12 @@ export function getWorker() {
/** /**
* Cleanup the current instance of the web worker. * Cleanup the current instance of the web worker.
*/ */
export function destroyWorker() { export async function destroyWorker() {
if (asyncProxy) { const proxy = asyncProxy;
asyncProxy.terminate();
asyncProxy = undefined; asyncProxy = undefined;
if (proxy) {
await proxy.clearKeyCache();
proxy.terminate();
} }
} }