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

Adapt to Rhino's NativePromise #443

Merged
merged 1 commit into from
Jan 12, 2022
Merged

Adapt to Rhino's NativePromise #443

merged 1 commit into from
Jan 12, 2022

Conversation

grob
Copy link
Member

@grob grob commented Jan 4, 2022

When directly calling Function objects processMicrotasks must be called before exiting the current context, otherwise pending promises won't be settled (see [1])

Found just two places in Ringo where calling processMicrotasks is necessary, but i might have missed some. Added a very basic test and enabled three other rhino tests that weren't executed by default (dunno why).

[1] https://github.com/mozilla/rhino/blob/master/src/org/mozilla/javascript/Context.java#L2326

…mises are settled (see [1])

afais these two places are the only ones where functions are called directly, but there might be more

[1] https://github.com/mozilla/rhino/blob/master/src/org/mozilla/javascript/Context.java#L2326
@grob grob requested review from botic and oberhamsi January 4, 2022 13:45
@grob grob added this to the 3.0.0 milestone Jan 5, 2022
@botic
Copy link
Member

botic commented Jan 11, 2022

I found two more JS function calls in Java:

Object source = function.call(cx, scope, scope, args);

function.call(cx, scope, thisObj, args);

But not sure if this should trigger also the microtask queue.

@botic botic merged commit 57c2bb9 into master Jan 12, 2022
@botic botic deleted the native-promise branch January 12, 2022 13:23
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.

2 participants