AbortController and AbortSignal globals #678
TaylorBeeston
started this conversation in
Ideas
Replies: 1 comment
-
Hey @TaylorBeeston, we already had I've added it now in #682, and so the next release of Flask should fix your errors. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there 👋 I'm Taylor from the LEF, working on making a LearnCard snap!
While building out the snap, I managed to work around every issue I came across except one:
AbortController
andAbortSignal
not being globally available.@learncard/core
internally depends on Ceramic libraries, which internally have a wrapper function aroundfetch
that automatically times out via the use of anAbortController
. In the past I've managed to get around environments that don't have theAbortController
global available by using theabort-controller
package to polyfill it, but when doing this inside of the SES runtime, I am running into this error when the fetch call gets made:I dug around a lot to try and find where this error is thrown, and I eventually found myself in the Chromium source code, where it seems like the native
fetch
object will only want to accept nativeAbortSignal
objects (not "fake"AbortSignal
objects created by a polyfill library with JS 😥). I'm not very good at reading C++ code (particularly a codebase as complicated as that!), so I could be wrong in that assumption, but that is where I landed!So, for now, I am using
sed
against my bundled snap file to actually remove thatAbortSignal
object from being passed in when callingfetch
, and everything is happy! This is, however, a pretty bad hack, and I would love it if we could instead just expose the browser's nativeAbortController
andAbortSignal
objects inside of the snap's SES runtime, as I believe that will fix the problem!AFAIK, there's really no harm that one could cause if they got access to these two globals, though I am also definitely not a security expert, and I am aware of how seemingly innocuous things can become malicious quickly with JS, so I understand that there would probably need to be some research into what possible security risks could be associated with adding these in.
tl;dr My snap is in a hacky, potentially buggy state until
AbortController
andAbortSignal
can become globally available inside the snap runtime!Beta Was this translation helpful? Give feedback.
All reactions