-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
small fixes #3
small fixes #3
Conversation
Nice! I believe on By the way, should we not check if the readable is locked when we test for transferable stream compatibility? And is it not possible for a polifilled TransformStream to return a transferable ReadableStream? I think I'll have time to test the webtorrent example the day after tomorrow. |
Not necessary really... it will catch an error when it fails to transfer a stream. and it will always be locked (there is no buggy implementation somewhere where locked are incorrect).
Like i sad earlier, if you try to pass something to that isn't transferable in the array of transferable it will throw ann error. that includes polyfilled objects, they need to be natively supported to know what a transferable object is.
https://developer.mozilla.org/en-US/docs/Web/API/Transferable mdn don't list TransformStream but it's new and not listed...
Not so picky about that when folks tries to help with PR. can just fix them the next time i encounter them myself 😉 |
I think i see now what the problem was |
Fixed the port now. The problem still persist... still the other examples worked out grate but the webtorrent example if (iframe && !loaded) {
iframe.addEventListener('load', () => {
window.location = url
}, { once: true })
} else {
window.location = url
} firefox tries to navigate away from the page (to the download url - intercept-me#), therefore stopping webtorrent from creating any new webrtc connections resulting with no connection -> no metadata -> nothing to download -> nothing to write -> leading to the save dialog not showing. Don't remember if i had this problem before when i used to create a download link and clicking on it... |
Yeah, navigating away from the page with I guess we can do what you say: remove the option of navigating to the download link, and replace it with the hidden iframe approach. It should work on all contexts that are currently using When I talked about the polifilled TransformStream, I was thinking that maybe a polifilled TransformStream could provide a native and transferable ReadableStream on its readable property, even though TransformStream itself isn't. Or maybe that is not possible, I have no idea. |
Think I would like to have I iframe approach. Hmm. Never thought about only having transferable readablestream. We have never tried that. Most likely a polyfilled transformer would also return a polyfilled readablestream as well. So we would have to pipe a polyfilled writable to a native readablestream ourselves. That's more complicated. Let's hold back on that for now and do what is being done now. Can dig into it when that scenario happens |
There, what do you think now? Good if someone else could test it also. (seems to work fine in chrome and firefox) |
Sorry, I forgot to say the "closed connections" situation only happens when navigating away from the top page, it should not affect iframes at all. So your lines 99 through 104 and line 97 are not necessary anymore, as they will do nothing but delay the download and clutter the code. In fact, they are bad because they create iframes that are never removed. Line 98 sets up the iframe to be removed once the download starts. Also, your change to the secure context detection must have broken Web Extension's background pages on Firefox, since they were purposefully being treated as insecure by me before, despite If you set your const isSecureContext = window.isSecureContext && (!firefox || !background) I still can't dedicate much time to this, the deadline on another project is only a few hours away. I'll do a lot of tests on everything tomorrow, and get the PR up to date. :) |
always create a iframe
...While trying out webtorrent in Firefox with your code i notice that it didn't work. Do you know why?