Skip to content
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

Handle non-String web3 property access #9256

Merged
merged 1 commit into from Aug 18, 2020

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Aug 18, 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

@Gudahtt Gudahtt marked this pull request as ready for review August 18, 2020 01:36
@Gudahtt Gudahtt requested a review from a team as a code owner August 18, 2020 01:36
@metamaskbot
Copy link
Collaborator

Builds ready [7ff6754]
Page Load Metrics (642 ± 78 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint32115472311
domContentLoaded25494964116378
load25595164216378
domInteractive25494964116378

rekmarks
rekmarks previously approved these changes Aug 18, 2020
Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic find!

One nit, non-blocking.

Comment on lines 47 to 49
const name = typeof key === 'string'
? key
: `typeof ${typeof key}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably DRY this up, but I'm not gonna block on it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

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
@metamaskbot
Copy link
Collaborator

Builds ready [8197349]
Page Load Metrics (625 ± 45 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint329551209
domContentLoaded3167466249445
load3187486259445
domInteractive3167466249445

Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 👍 👍

@Gudahtt Gudahtt merged commit 27e1189 into develop Aug 18, 2020
@Gudahtt Gudahtt deleted the handle-non-string-web3-property-access branch August 18, 2020 15:01
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
@metamaskbot metamaskbot mentioned this pull request Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants