A Blazor WASM web application that offers end-to-end encrypted file and message transfer using Libsodium, Entity Framework, Hangfire, Docker, NUnit, and Mailkit.
To work around the Chromium issues linked below, this PR ensures the "download" service worker is only present as a file is being downloaded. Otherwise, a "no op" service worker is made active.
The reason for using a "no op" service worker, instead of simply unregistering the "download" service worker, is unregistration still requires the tab to be reloaded or a navigation to occur before the unregistered service worker stops working. Replacing the service worker with one that does not have a "fetch" event handler works instantaneously and doesn't seem to interfere with file uploads.
Still not an ideal solution, as simultaneous upload and download will probably break, but the UI really doesn't lend to that usage anyway.
To work around the Chromium issues linked below, this PR ensures the "download" service worker is only present as a file is being downloaded. Otherwise, a "no op" service worker is made active.
The reason for using a "no op" service worker, instead of simply unregistering the "download" service worker, is unregistration still requires the tab to be reloaded or a navigation to occur before the unregistered service worker stops working. Replacing the service worker with one that does not have a "fetch" event handler works instantaneously and doesn't seem to interfere with file uploads.
Still not an ideal solution, as simultaneous upload and download will probably break, but the UI really doesn't lend to that usage anyway.
https://issues.chromium.org/issues/339788214 https://issues.chromium.org/issues/41360286