-
Notifications
You must be signed in to change notification settings - Fork 43
Refactor Sobek out of screenshots and byte pointer changes #1198
Conversation
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.
This is great! If it isn't too much work for you, could we detach the file persisting logic out of this PR and make this PR focus only on de-gojafying? I believe adding the file persisting logic should be straightforward after this. Also, we'll make the Screenshot
accept an interface later. This way, we can avoid double work, and it'll also help us keep the commit history cleaner. Thanks.
Yep, this was done after the persister work. I believe this PR is separate from the Persister work, although it does depend on it unfortunately. I'd rather keep this as is and merge later once the persister PRs are merged into |
f161c6a
to
3cc7c51
Compare
f5d84de
to
ba94df5
Compare
c2f30b9
to
ab79ae7
Compare
ba94df5
to
ebec386
Compare
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.
This is nice 🎉 Some suggestions.
ebec386
to
0a093fd
Compare
As far as I can tell there is no reason to return a pointer to the slice of bytes, since the slice it self is referenced with a pointer.
11219b4
to
f8799f2
Compare
The remote parser no longer works with goja so the result from evaluate will not return a goja value. Now just type assert without goja.
f8799f2
to
0cddf7c
Compare
To fix the linter issue
What?
This refactors the parsing of the goja options for
frame.screenshot
andpage.screenshot
to the mapping layer, as well as moving goja out of screenshotter. This means that the screenshot business logic is free of goja.It also changes the
screenshotter
to return a[]byte
instead of a pointer to it (*[]byte
).Why?
The options should be parsed out of the
goja.Value
representation in the mapping layer to avoid goja escaping into the business logic which makes the business logic more complex and this will also help if we convert this method into async.There's no reason to return a
*[]byte
as far as i can tell.Checklist
Related PR(s)/Issue(s)
Updates: grafana/k6#4219