This repository was archived by the owner on Jan 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ka3de
reviewed
Jan 22, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, just left a nit comment. Also, there is a linting error for tests/webvital_test.go
not being "gci-ed"
@@ -468,11 +468,16 @@ func mapPage(vu moduleVU, p *common.Page) mapping { | |||
"addStyleTag": p.AddStyleTag, | |||
"bringToFront": p.BringToFront, | |||
"check": p.Check, | |||
"click": func(selector string, opts goja.Value) *goja.Promise { | |||
"click": func(selector string, opts goja.Value) (*goja.Promise, error) { | |||
popts, err := parseFrameClickOptions(vu.Context(), opts, p.Timeout()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: s/popts/clickOpts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do a mass renaming later if we need. Sticking with popts for now.
inancgumus
approved these changes
Jan 22, 2024
8b21fdf
to
0aabdc8
Compare
7875f68
to
3b92c86
Compare
0aabdc8
to
76cbf90
Compare
This timeout method is to be called from the mapping layer when parsing options.
47c1d65
to
9cbdd2f
Compare
This helps avoid using the goja runtime when it comes to parsing the options. The options parsing has been moved to the mapping layer and so has been moved back on to the main goja thread, which will mitigate the possibility of a panic which could occur when multiple goroutines try to work with the goja runtime (which is not thread safe). There is another issue to tackle more of the goja refactoring in
9cbdd2f
to
d57dba3
Compare
# for free
to subscribe to this conversation on GitHub.
Already have an account?
#.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
This refactors the option parsing out of the promise and into the mapping layer for
page.click
.Why?
This will help mitigate the risk of a panic occurring due to multiple goroutines accessing the goja runtime (which is not thread safe) concurrently.
More works needs to be done to totally remove the goja runtime usage from within the
page.click
promise which can be tracked in #1170.Checklist
Related PR(s)/Issue(s)
Updates: #1174