-
Notifications
You must be signed in to change notification settings - Fork 42
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 JSONValue to use parseConsoleRemoteObject #1190
Merged
Merged
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
ankur22
force-pushed
the
refactor/jsonValue
branch
from
January 24, 2024 12:52
b8cf42d
to
43c81a4
Compare
ankur22
changed the base branch from
main-next
to
refactor/parseConsoleRemoteObject
January 24, 2024 12:52
ankur22
force-pushed
the
refactor/jsonValue
branch
from
January 24, 2024 12:52
43c81a4
to
ebefa9d
Compare
3 tasks
ankur22
force-pushed
the
refactor/parseConsoleRemoteObject
branch
from
January 25, 2024 16:01
8d48cf6
to
fc47e2e
Compare
ankur22
force-pushed
the
refactor/jsonValue
branch
from
January 25, 2024 16:27
ebefa9d
to
8c16e25
Compare
inancgumus
reviewed
Jan 26, 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.
LGTM but one last thing.
inancgumus
reviewed
Jan 26, 2024
inancgumus
reviewed
Jan 29, 2024
inancgumus
approved these changes
Jan 29, 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.
🚀
ankur22
force-pushed
the
refactor/parseConsoleRemoteObject
branch
from
January 29, 2024 10:53
b0f41e7
to
5aedac1
Compare
ankur22
force-pushed
the
refactor/jsonValue
branch
from
January 29, 2024 10:54
cd36b6f
to
2da056b
Compare
inancgumus
previously approved these changes
Jan 29, 2024
Just wanted to clarify this with a comment that the browser module does capture other log types other than the usual info, warn, error and debug, such as console.table, but it defaults to debug.
JSONValue was using valueFromRemoteObject which returns a goja.Value but then converts that back to a string. This conversion is: 1. unnecessary, and it should just work with parseConsoleRemoteObject which returns a string. 2. dangerous since it could be called off the main goja thread (i.e. in a new goroutine or promise) which could cause unwanted panics since goja runtime should only be used on the main goja thread.
Instead of panicking which can cause unexpected side affects, return an error.
This refactors the implementation to make it clearer and to avoid duplication.
It's not needed and the return value can be added directly to remoteObject.
Co-authored-by: İnanç Gümüş <[email protected]>
ankur22
force-pushed
the
refactor/jsonValue
branch
from
January 29, 2024 11:13
2da056b
to
1ea662c
Compare
inancgumus
approved these changes
Jan 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?
Refactor
JSONValue
to useparseConsoleRemoteObject
.Why?
This will help avoid working with the goja runtime outside of the mapping layer and therefore avoid possible race conditions with the unsafe goja runtime.
JSONValue
wasn't ever working with the goja values and so it made sense to always work with string values.Checklist
Related PR(s)/Issue(s)
Updates: #1168