-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
chore(test): add tests for Promise #11260
base: master
Are you sure you want to change the base?
Conversation
|
@drauggres Can you create / link a JIRA ticket for this? It looks quite critical, but to schedule it, I think Appc needs a ticket to track it. And does this also apply for |
Done
It does: |
So my initial suspicion was that this was caused by the promise polyfill stuff. But even if I run on an iOS 13 sim and disable Promise polyfills (to use the native implementation) we see this issue.
So it certainly looks like crossing the "bridge" has some impact on deferred things like Promises. If we hit a call to a Ti API in top-level/current context, it seems to first allow any scheduled Promises to fire first. So let me try to illustrate what we should get versus what's happening: let result = '';
Promise.resolve()
.then(() => {
result += '2';
})
.then(() => {
result += '3';
});
console.log('1');
result += '1'; In this example, |
I still can reproduce this issue on I think this is really critical issue, because it is breaking code execution order. |
@drauggres Do you have a suggestion to move forward here? Happy to merge the new tests, but if I followed correctly, they focus on the example that iOS behaves differently, not on the fix so far. I can also try to take a look here, but I'm unsure that will be easy to fix. |
Thats odd. @sgtcoolguy Do you know by any chance if there was a change here last year fixing that issue? EDIT: Unfortunately not fixed. The following still returns Promise.resolve()
.then(() => console.log('A'));
console.log('B'); |
JIRA: https://jira.appcelerator.org/browse/TIMOB-27483
Execution order for
Promise
is broken on iOSMWE:
Correct output:
My guess is that jobs queue is drained after call to non-js-native methods (?).
Tests with names like
does not break execution order...
are same asfollows execution order...
ones, except they haveconsole.log
calls.UPD:
in my tests it works correctly on ios 9 (9.3.5) and fail on ios 10+ (10.3.1, 12.1.1, 12.3.1, 13.1.2)