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

Refactor parsing of options for waitForEvent #1188

Merged
merged 2 commits into from Jan 25, 2024
Merged

Conversation

ankur22
Copy link
Collaborator

@ankur22 ankur22 commented Jan 23, 2024

What?

Refactor the parsing of the options for the browserContext.waitForEvent API so that it is done outside the promise and therefore on the main goja thread.

Why?

This will help mitigate issues which can occur when trying to access the goja runtime from multiple goroutines, which can causes panics since the goja runtime is not thread safe.

Checklist

  • I have performed a self-review of my code
  • I have added tests for my changes
  • I have commented on my code, particularly in hard-to-understand areas

Related PR(s)/Issue(s)

Updates: #1187

This change moves the option parsing out of the promise for
browserContext.waitForEvent. The change will help mitigate the risk of
accessing the (non thread safe) goja runtime by multiple goroutines
and instead force the parse (and working with the goja runtime) in the
main goja thread.
browser/mapping.go Outdated Show resolved Hide resolved
@ankur22 ankur22 merged commit 65e6bd8 into main-next Jan 25, 2024
14 checks passed
@ankur22 ankur22 deleted the refactor/waitForEvent branch January 25, 2024 10:59
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.

None yet

3 participants