-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Unhandled rejection #8558
Unhandled rejection #8558
Conversation
Thanks @bas-d! Doesn't that catch stop the error from being thrown? So no error is reported? We need to figure out that test failure |
Looks like it does. I've been thinking, libsodium uses
The problem is that if wasm can't load because it is not allowed (as is the case with loading it into a chrome extension with a CSP without
If the recover function is not assigned, it would exit normally, otherwise it allows to fall back to asm.js or do something else. |
Hmm, maybe the best solution is to just test for WebAssembly directly in your code? Something like, fall back to asm.js if |
Ok it turned out that the fallback in essence worked, but things went wrong because uglifyjs was used with the That leaves the uncaught rejection of abort in the console, which is still kind of ugly. I was able to get rid of it by overriding Lines 1044 to 1082 in d449897
instantiateAsync() ), where all promises are properly returned, it would allow a user to catch the abort if necessary by overriding instantiateWasm with something like
Preamble.js simply calls the function without catching the error. The advantage is that this wouldn't make any functional changes in the code, so should be able to pass all tests then :). If this sounds OK I can adjust this PR into the refactor or make a new one if you don't want the previous commits in it. |
I don't think we run uglify compress - we just use it to minify whitespace. Maybe I misunderstood what you meant? Refactoring the code to be properly async sounds good in general. And it's fine to use this PR for that (we'll squash the commits anyhow). However, we'd need to be sure code size does not regress in that refactoring. |
No I meant that if others apply |
Thanks, looks good with minor comments. I didn't follow the issue with |
I'm not sure what happens exactly either, I think has to do something with this: mishoo/UglifyJS#1399, mishoo/UglifyJS#2557. For libsodium, either disabling |
Looks nicer. Is there a reason not to wrap the instantiate[A]sync dunctions in #ifdef? I guess the JS optimizer will eliminate them anyway? |
@sbc100 good point, yeah, we should ifdef those on |
On |
Ah, yes, BINARYEN_ASYNC_COMPILATION was renamed to WASM_ASYNC_COMPILATION yesterday. Please use the new name only: WASM_ASYNC_COMPILATION. |
Thanks @bas-d! Code looks good. I think those test failures are because of an unrelated problem on earlier incoming. It's been fixed, so if you merge in latest incoming we should see them pass and can merge this. |
Is this merge still hung up on one remaining mystery test failure? |
I think that's a test that randomly fails sometimes, so not a blocker. Merging, thanks! |
Refactor wasm initialization code to use promises correctly.
Abort throws an error that isn't catched, resulting in an unhandled Promise rejection. This should fix #6255.