-
Notifications
You must be signed in to change notification settings - Fork 43
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 elementHandle.click parse #1171
Conversation
3228f1d
to
e1e13bf
Compare
44eeb8d
to
44440af
Compare
"click": func(opts goja.Value) (*goja.Promise, error) { | ||
ctx := vu.Context() | ||
|
||
popts := common.NewElementHandleClickOptions(eh.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: What does popts
stand for? Should it be 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 think copts
would be fine for "click options".
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.
popts
-> parsed options
. Aren't opts
before being parsed also click options? I prefer popts
.
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.
popts
and copts
are both fine to me.
This will be used in the mapping layer to retrieve the default timeout that needs to be used when parsing options.
Move the parsing of the options for elementHandle.click outside of the promise goroutine and back onto the main goja thread in the mapping layer. This will help mitigate the risk of a panic if more than one goroutine is accessing the goja runtime off the main goja thread. This doesn't solve the problem completely though since this API calls to other areas of the codebase which does still interact with the goja runtime. See #1170 for further details.
44440af
to
f8f0f35
Compare
What?
Move the parse logic for
elementHandle.click
into the mapping layer to reduce the call to the goja runtime by one less call.Why?
This will mitigate the risk of a panic occurring due to using the goja runtime in a new goroutine off the main goja thread. This doesn't solve the complete problem and it still relie on using the goja runtime, but that issue can be tracked separately (#1170).
Checklist
Related PR(s)/Issue(s)
Updates: #1169