Handle non-String web3 property access#9256
Merged
Conversation
Collaborator
Builds ready [7ff6754]
Page Load Metrics (642 ± 78 ms)
|
rekmarks
previously approved these changes
Aug 18, 2020
Member
rekmarks
left a comment
There was a problem hiding this comment.
Fantastic find!
One nit, non-blocking.
app/scripts/lib/setupWeb3.js
Outdated
Comment on lines
+47
to
+49
| const name = typeof key === 'string' | ||
| ? key | ||
| : `typeof ${typeof key}` |
Member
There was a problem hiding this comment.
We should probably DRY this up, but I'm not gonna block on it.
The web3 usage metrics added in #9144 assumed that all web3 properties were strings. When a `Symbol` property is accessed, our `inpage.js` script crashes because the `Symbol` cannot be serialized correctly. A check has been added for non-string property access. The metric event in these cases is set to the string "typeof ", followed by the type of the key. (e.g. `typeof symbol` for a `Symbol` property). Fixes #9234
7ff6754 to
8197349
Compare
Collaborator
Builds ready [8197349]
Page Load Metrics (625 ± 45 ms)
|
Gudahtt
added a commit
that referenced
this pull request
Aug 19, 2020
The web3 usage metrics added in #9144 assumed that all web3 properties were strings. When a `Symbol` property is accessed, our `inpage.js` script crashes because the `Symbol` cannot be serialized correctly. A check has been added for non-string property access. The metric event in these cases is set to the string "typeof ", followed by the type of the key. (e.g. `typeof symbol` for a `Symbol` property). Fixes #9234
Merged
This file contains hidden or 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
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.
The web3 usage metrics added in #9144 assumed that all web3 properties were strings. When a
Symbolproperty is accessed, ourinpage.jsscript crashes because theSymbolcannot be serialized correctly.A check has been added for non-string property access. The metric event in these cases is set to the string "typeof ", followed by the type of the key. (e.g.
typeof symbolfor aSymbolproperty).Fixes #9234