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 waitForNavigation #1186

Merged
merged 2 commits into from
Jan 25, 2024

Conversation

ankur22
Copy link
Collaborator

@ankur22 ankur22 commented Jan 23, 2024

What?

Refactor the parsing of the options of waitForNavigation APIs so that they are 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: #1184 & #1185

The parsing of the options for frame.waitForNavigation has been moved
outside of the promise. This change will mitigate any issues when
working with the goja runtime with multiple goroutines (goja is not
thread safe).
The parsing of the options for page.waitForNavigation has been moved
outside of the promise. This change will mitigate any issues when
working with the goja runtime with multiple goroutines (goja is not
thread safe).
Copy link
Collaborator

@ka3de ka3de left a comment

Choose a reason for hiding this comment

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

LGTM. Notice, thought, that the PR title is incorrect (s/waitForFunction/waitForNavigation).

@ankur22 ankur22 changed the title Refactor parsing of options for waitForFunction Refactor parsing of options for waitForNavigation Jan 24, 2024
@ankur22 ankur22 merged commit 3624a68 into main-next Jan 25, 2024
17 checks passed
@ankur22 ankur22 deleted the refactor/waitForNavigation 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.

3 participants