Skip to content

Commit

Permalink
Worker: delay object URL clean up (#1430)
Browse files Browse the repository at this point in the history
  • Loading branch information
sohkai authored May 28, 2020
1 parent 0292f0b commit a49f496
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/worker/SandboxedWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,13 @@ class SandboxedWorker extends EventTarget {
}
})
// Clean up the url we created to spawn the worker
URL.revokeObjectURL(workerUrl)
window.addEventListener('unload', () => {
// Clean up the url we created to spawn the worker when the iframe is unloaded
// Note that we **NEED** to do this late, as Chrome 83+ appears to have
// introduced a race condition with starting workers using object URLs,
// preventing us from synchronously revoking this object URL immediately.
URL.revokeObjectURL(workerUrl)
})
}
init()
Expand Down

0 comments on commit a49f496

Please sign in to comment.