Skip to content
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

Update futures implementation to not destroy callbacks #1649

Merged
merged 1 commit into from
Jul 10, 2019

Conversation

alexcrichton
Copy link
Contributor

JS engines guarantee that at least one of our then callbacks are
invoked, so that means if we destroy them prematurely they're guaranteed
to log an exception to the console! Instead to prevent exceptions from
happening tweak how the completion callbacks for JS futures are managed
and ensure that the closures stay alive until they're invoked later.

Closes #1637

JS engines guarantee that at least one of our `then` callbacks are
invoked, so that means if we destroy them prematurely they're guaranteed
to log an exception to the console! Instead to prevent exceptions from
happening tweak how the completion callbacks for JS futures are managed
and ensure that the closures stay alive until they're invoked later.

Closes rustwasm#1637
@tomaka
Copy link

tomaka commented Jul 10, 2019

I'm trying this patch locally because I was getting these benign closure invoked recursively ... errors.

After this PR, I'm getting more serious errors:

Screenshot from 2019-07-10 11-15-32

None of the backtraces are useful. The lowest readable symbol of the backtrace is a function in the API that returns a Promise.

@tomaka
Copy link

tomaka commented Jul 10, 2019

False alarm, I'm getting these errors on master as well compared to versions 0.2.47 and 0.3.24.

@alexcrichton alexcrichton merged commit b64f5c0 into rustwasm:master Jul 10, 2019
@alexcrichton alexcrichton deleted the fix-futures branch July 10, 2019 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with JSFuture::from(promise) imported from local source js file
2 participants