Open gDev95 opened 3 years ago
Is this running in a different thread than the main thread ?
the mitm only forwards a message port (in some newer cases a readable stream) from the main thread to the service worker - that's it. once that is done it could almost basically be closed - but it sticks around to keep the service worker alive by pinging the service worker.
But yea, you are basically saving stuff from the main thread (top window) where you host the main streamsaver lib.
When is streamsaver grabbing the mitmHTML file (which exectute this script)?
StreamSaver opens up a iframe to mitm when it's time to open up a download stream (meaning it's lazy loaded when needed)
If you would like to
... then i recommend you to have a look at my new File System Adapter i recommend you to at least take a look at it. it can work without a service worker but it's recommended to install one for larger files to achieve similar functionality as StreamSaver
When I throw an error after the promise is rejected during the registration of the worker its never caught. I could trace back, based on your information regarding the lazy loading, that once we first write into the stream, the worker will try to register.
I have multiple layers of error handling that should catch the error and log/treat the error respectively but its nowhere caught.
The console however lets me know that the is an uncaught exception.
I could assume since the streamsaver module actually initiates the connection to the mitm it is not caught in streamsaver code and therefor falls through and isn't noticed by my error handling layers?
Or could be since the script is running inside an iframe the error is not bubbling to its caller?
Cannot find another explanation, do you have an idea?
Hi,
I am currently working on problem where a service worker cannot be registered in firefox because of user settings (the problem can be found on stackoverflow)
I am rethrowing the error but its not caught anywhere.
I extracted the mitmHTML script into its own .tsx file but it should be familiar ;)
mitmEntry.tsx
Now I have two questions:
Is this running in a different thread than the main thread ?
When is streamsaver grabbing the mitmHTML file (which exectute this script)?
Best regards,
Paul