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

Fix WasmJS Promise.await() never resumes if promise rejected from JS with non-Kotlin exception #4120

Merged
merged 6 commits into from
Dec 9, 2024

Conversation

shepeliev
Copy link
Contributor

No description provided.

Copy link
Collaborator

@dkhalanskyjb dkhalanskyjb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks, looks good. Could you base the PR on top of develop instead of master (see https://github.com/Kotlin/kotlinx.coroutines/blob/master/CONTRIBUTING.md) and also port this fix to kotlinx-coroutines-core/js/, where this issue also exists?

@shepeliev shepeliev changed the base branch from master to develop December 5, 2024 16:25
@shepeliev shepeliev force-pushed the fix-wasm-promise-await branch from 0f22826 to 9561681 Compare December 5, 2024 17:03
@shepeliev
Copy link
Contributor Author

It seems that the behavior of evaluating JS exceptions has changed since Kotlin 2.0.0 was released. So the WasmJS doesn't have this issue anymore. When a promise rejects with a non-Kotlin exception, await resumes with a JsException without getting stuck.

On the other hand, JS target really still has the issue. I've added a couple of tests, ported the solution to JS target and reverted the changes to WasmJS Promise.await() since it now appears to work as expected.

Copy link
Collaborator

@dkhalanskyjb dkhalanskyjb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, thanks!

@dkhalanskyjb dkhalanskyjb merged commit 6b73546 into Kotlin:develop Dec 9, 2024
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