Crypter icon indicating copy to clipboard operation
Crypter copied to clipboard

Only register the service worker when downloading a file

Open Jack-Edwards opened this issue 1 year ago • 0 comments

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

Jack-Edwards avatar Jul 06 '24 18:07 Jack-Edwards