Skip to content

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.

3 participants