1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00
Commit Graph

3644 Commits

Author SHA1 Message Date
Whymarrh Whitby
c1e3c229bc
Fix import/order issues (#9239)
See [`import/order`](https://eslint.org/docs/rules/import/order) for more information.

This change enables `import/order` and fixes the issues raised by the rule.
2020-08-18 16:48:25 -02:30
Whymarrh Whitby
b7259e5d6a
Fix radix issues (#9247)
See [`radix`](https://eslint.org/docs/rules/radix) for more information.

This change enables `radix` and fixes the issues raised by the rule.
2020-08-18 16:38:22 -02:30
Whymarrh Whitby
4357cda7b8
Fix no-shadow issues (#9246)
See [`no-shadow`](https://eslint.org/docs/rules/no-shadow) for more information.

This change enables `no-shadow` and fixes the issues raised by the rule.
2020-08-18 14:06:45 -02:30
Mark Stacey
27e1189c91
Handle non-String web3 property access (#9256)
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
2020-08-18 12:01:43 -03:00
Whymarrh Whitby
e803807dd9
Fix no-param-reassign issues (#9235)
See [`no-param-reassign`](https://eslint.org/docs/rules/no-param-reassign) for more information.

This change enables `no-param-reassign` and fixes the issues raised by the rule.
2020-08-15 09:28:11 -02:30
Mark Stacey
52fd72feac Merge remote-tracking branch 'origin/develop' into sync-master
* origin/develop: (107 commits)
  Clear Account Details in AppState (#9238)
  Permit all-caps addresses (#9227)
  Send web3 usage metrics once per origin/property (#9237)
  Fix import/no-extraneous-dependencies issues (#9232)
  Remove unused buyEth fn from bg (#9236)
  Fix max-statements-per-line issues (#9218)
  Consolidate ESLint config files (#9231)
  Delete page-container.component.test.js (#9229)
  Tidy up getAccountLink (#9223)
  Tidy ConnectHardwareForm#checkIfUnlocked (#9224)
  Fix require-unicode-regexp issues (#9212)
  Fix no-negated-condition issues (#9222)
  Fix no-empty-function issues (#9216)
  Fix import/extensions issues (#9217)
  Dedupe glob-parent versions (#9220)
  Fix no-template-curly-in-string issues (#9221)
  Fix no-process-exit issues (#9219)
  Fix prefer-rest-params issues (#9215)
  Fix no-prototype-builtins issues (#9213)
  Fix no-nested-ternary issues (#9214)
  ...
2020-08-14 20:32:32 -03:00
MetaMask Bot
5db866bc88 Version v8.0.8 2020-08-14 19:39:41 -03:00
Mark Stacey
d49c44426f Send web3 usage metrics once per origin/property (#9237)
The usage metrics for the injected web3 instance were being sent upon
each use, which exceeded the limits of our Matomo plan. These metrics
are now only being sent upon the first usage, for each origin and
property.
2020-08-14 19:15:40 -03:00
Mark Stacey
f77151003e
Send web3 usage metrics once per origin/property (#9237)
The usage metrics for the injected web3 instance were being sent upon
each use, which exceeded the limits of our Matomo plan. These metrics
are now only being sent upon the first usage, for each origin and
property.
2020-08-14 19:15:21 -03:00
Patryk Łucka
74decc3407 Fix Etherscan redirect on notification click (#9211) 2020-08-14 19:15:03 -03:00
Mark Stacey
4d499cc39e Add version dimension to background metrics (#9167)
The background metrics were missing the `version` custom dimension. It
has now been added to all background metric events.
2020-08-14 19:05:27 -03:00
Whymarrh Whitby
c2edc342fb
Remove unused buyEth fn from bg (#9236) 2020-08-14 15:51:48 -02:30
Whymarrh Whitby
e021acdc0a
Fix max-statements-per-line issues (#9218)
See [`max-statements-per-line`](https://eslint.org/docs/rules/max-statements-per-line) for more information.

This change enables `max-statements-per-line` and fixes the issues raised by the rule.
2020-08-14 15:13:56 -02:30
Whymarrh Whitby
5d42a9b773
Fix require-unicode-regexp issues (#9212)
* Fix require-unicode-regexp issues

See [`require-unicode-regexp`](https://eslint.org/docs/rules/require-unicode-regexp) for more information.

This change enables `require-unicode-regexp` and fixes the issues raised by the rule.

* Remove case-insensitive flag from regexps
2020-08-14 09:18:42 -02:30
Whymarrh Whitby
884775cf71
Fix no-negated-condition issues (#9222)
See [`no-negated-condition`](https://eslint.org/docs/rules/no-negated-condition) for more information.

This change enables `no-negated-condition` and fixes the issues raised by the rule.
2020-08-14 09:17:43 -02:30
Whymarrh Whitby
c11888f287
Fix no-empty-function issues (#9216)
See [`no-empty-function`](https://eslint.org/docs/rules/no-empty-function) for more information.

This change enables `no-empty-function` and fixes the issues raised by the rule.
2020-08-14 09:17:02 -02:30
Whymarrh Whitby
9b78d3ab07
Fix import/extensions issues (#9217)
See [`import/extensions`](https://eslint.org/docs/rules/import/extensions) for more information.

This change enables `import/extensions` and fixes the issues raised by the rule.
2020-08-14 09:16:45 -02:30
Whymarrh Whitby
3bd22a2058
Fix no-template-curly-in-string issues (#9221)
See [`no-template-curly-in-string`](https://eslint.org/docs/rules/no-template-curly-in-string) for more information.

This change enables `no-template-curly-in-string` and fixes the issues raised by the rule.
2020-08-13 19:01:55 -02:30
Whymarrh Whitby
82a0ee27f3
Fix prefer-rest-params issues (#9215)
See [`prefer-rest-params`](https://eslint.org/docs/rules/prefer-rest-params) for more information.

This change enables `prefer-rest-params` and fixes the issues raised by the rule.
2020-08-13 18:05:18 -02:30
Whymarrh Whitby
146127c474
Fix no-prototype-builtins issues (#9213)
See [`no-prototype-builtins`](https://eslint.org/docs/rules/no-prototype-builtins) for more information.

This change enables `no-prototype-builtins` and fixes the issues raised by the rule.
2020-08-13 18:04:51 -02:30
Patryk Łucka
5991043cd7
Fix Etherscan redirect on notification click (#9211) 2020-08-13 13:51:31 -02:30
Whymarrh Whitby
cd370be728
Fix no-invalid-this issues (#9207)
See [`no-invalid-this`](https://eslint.org/docs/rules/no-invalid-this) for more information.

This change enables `no-invalid-this` and fixes the issues raised by the rule.
2020-08-12 21:19:33 -02:30
Whymarrh Whitby
c0f05ccae6
Fix implicit-arrow-linebreak issues (#9201)
See [`implicit-arrow-linebreak`](https://eslint.org/docs/rules/implicit-arrow-linebreak) for more information.

This change enables `implicit-arrow-linebreak` and fixes the issues raised by the rule.
2020-08-12 21:19:10 -02:30
Whymarrh Whitby
76bd7f98b6
Fix prefer-spread issues (#9203)
See [`prefer-spread`](https://eslint.org/docs/rules/prefer-spread) for more information.

This change enables `prefer-spread` and fixes the issues raised by the rule.
2020-08-12 20:42:07 -02:30
Whymarrh Whitby
310b15ba4a
Fix no-plusplus issues (#9206)
See [`no-plusplus`](https://eslint.org/docs/rules/no-plusplus) for more information.

This change enables `no-plusplus` and fixes the issues raised by the rule.
2020-08-12 20:36:44 -02:30
Whymarrh Whitby
88f54e29fb
Fix no-empty issues (#9202)
See [`no-empty`](https://eslint.org/docs/rules/no-empty) for more information.

This change enables `no-empty` and fixes the issues raised by the rule.
2020-08-12 18:20:29 -02:30
Whymarrh Whitby
9842b2f1ce
Fix no-useless-catch issues (#9198)
See [`no-useless-catch`](https://eslint.org/docs/rules/no-useless-catch) for more information.

This change enables `no-useless-catch` and fixes the issues raised by the rule.
2020-08-12 16:37:15 -02:30
Whymarrh Whitby
a8863a3446
Fix consistent-return issues (#9192)
See [`consistent-return`](https://eslint.org/docs/rules/consistent-return) for more information.

This change enables `consistent-return` and fixes the issues raised by the rule.
2020-08-12 16:36:57 -02:30
Whymarrh Whitby
885125ad03
Fix no-case-declarations issues (#9191)
See [`no-case-declarations`](https://eslint.org/docs/rules/no-case-declarations) for more information.

This change enables `no-case-declarations` and fixes the issues raised by the rule.
2020-08-12 14:11:27 -02:30
Mark Stacey
3d9b545771 Merge remote-tracking branch 'origin/master' into sync-master
* origin/master: (44 commits)
  Add category in eventOpts (#9164)
  Update changelog for v8.0.7 (#9161)
  Version v8.0.7
  Remove web3 e2e tests (#9159)
  Add web3 usage metrics, prepare for web3 removal (#9144)
  Use `pathname` instead of URL for `currentPath` metrics parameter (#9158)
  Remove `url` parameter from `metricsEvent` (#9157)
  Change MetaMetrics category for background events (#9155)
  remove .network-name height
  Use luxon@1.24.1 (#9154)
  Update 'react-devtools' to ^4.8.0 (#9140)
  Fix connection removal bug (#9137)
  Add source map validator to CI (#9135)
  Update source map validator target files (#9133)
  Improve sourcemap validator console report (#9131)
  Add `validate-source-maps` npm script (#9134)
  Non-zero exit code upon failure to validate source maps (#9132)
  Update `brfs` from v1.6.1 to v2.0.2 (#9115)
  Factor out `getEnvironment` function in build script (#9114)
  Update `browserify` from v16.2.3 to v16.5.1 (#9113)
  ...
2020-08-10 15:12:07 -03:00
Mark Stacey
cb503d9403
Refactor assignment of "Background" metrics category (#9168)
The "Background" metrics category was being set in the
`backgroundMetaMetricsEvent` function. This function might not
necessarily include any event at all though, so setting it here seemed
inappropriate. It would also crash if `eventData.eventOpts` was not
set, which is not great since that property is optional.

The background category is now set in the `sendBackgroundMetaMetrics`
function in `metamask-controller`. This method is used solely for event
data, so it would make sense for this category to be always set.

There is no functional difference, since `backgroundMetaMetricsEvent`
is called solely by `sendBackgroundMetaMetrics`.
2020-08-10 12:38:56 -03:00
Mark Stacey
c557e25ba6
Add version dimension to background metrics (#9167)
The background metrics were missing the `version` custom dimension. It
has now been added to all background metric events.
2020-08-10 12:10:30 -03:00
Thomas Huang
747f4bb5c3 Add category in eventOpts (#9164) 2020-08-09 00:43:20 -03:00
Thomas Huang
3a7097a4cf
Add category in eventOpts (#9164) 2020-08-09 00:42:36 -03:00
MetaMask Bot
8063a83d85 Version v8.0.7 2020-08-07 19:45:54 +00:00
Erik Marks
500dbf76cf Add web3 usage metrics, prepare for web3 removal (#9144)
* add web3 usage metrics

* move web3 metrics method to new middleware

* rename some methods, files, and exports
2020-08-07 16:42:48 -03:00
Mark Stacey
f39498703e Use pathname instead of URL for currentPath metrics parameter (#9158)
The `currentPath` parameter passed to our metrics utility had been
passed the full URL rather than just the path, contrary to what the
name would imply. We only used the path portion, so passing the full
URL did lead to complications.

Now just the `pathname` is passed in, rather than the full URL. This
simplifies the metrics logic, and it incidentally fixes two bugs.

The main bug fixed is regarding Firefox metrics. Previously we had
assumed the `currentPath` would start with `chrome-extension://`, which
of course was not true on Firefox. This lead to us incorrectly parsing
the `currentPath`, so path tracking was broken for Firefox events.
This broken parsing is now bypassed entirely, so metrics should now
work the same on Firefox as on Chrome.

The second bug was that we were incorrectly setting the tracking URL
for background events during tests. As a result, we were incorrectly
detecting ourselves as an internal site that had referred the user to
us. But this was not of major concern, since it only affected test
metrics (which get sent to the development Matomo project).

Lastly, this change let us discard the `pathname` parameter used in
the `overrides` parameter of the `metricsEvent` function. Now that
`currentPath` is equivalent to `pathname`, the `pathname` parameter is
redundant.
2020-08-07 16:42:48 -03:00
Mark Stacey
426ddc8010 Remove url parameter from metricsEvent (#9157)
* Remove `url` parameter from `metricsEvent`

The `url` parameter was used to override the `currentPath`, but it
never worked correctly. It was supposed to be used for setting the
`url` query parameter that was sent to Matomo, but `currentPath` was
always used even if it `url` was set and `currentPath` was empty.

Instead, `currentPath` is now always used. There was never a need to
provide an "override" for `currentPath` when it can be set directly.
The metrics provider does set `currentPath` automatically by default,
but this can be overwritten already by passing a second parameter to
`metricsEvent`.

There were two places this `url` parameter was being used: background
events, and path changes. Background events were submitted with no
`currentPath`, so because of the bug with the `url` parameter, the
metrics utility would crash upon each event. So those were never
actually sent. This commit will fix that crash.

The `currentPath` parameter was supplied as an empty string for the
path change events, so those never crashed. They just had the `url`
query string parameter set incorrectly (to an empty string). It should
now be correctly populated, which should mean we'll be capturing all
path changes now. Previously we were only capturing path changes to
pages that happened to include an event, because of this blank `url`
problem.

* Use `url` query parameter as fallback for generating `pv_id`

The `pv_id` parameter currently isn't generated correctly on Firefox,
as the generation assumes that the current URL starts with
`chrome-extension://`. The `url` query parameter is still unique for
each path, so it's probably good enough for generating an id for each
page.

This is just a temporary fix; it will be removed in a future PR, where
Firefox will be properly supported.
2020-08-07 16:42:48 -03:00
Mark Stacey
dc69e4e9d3 Change MetaMetrics category for background events (#9155)
Background events are now sent in the `Background` category, rather
than `backend`. Conventionally we use the term "background" over
"backend", as it's not really a "backend" in the normal sense since
it's a client background process. Also it's capitalized because all of
the other event categories are capitalized as well.

The metrics URL has been updated to use `background` instead of
`backend` as well, for consistency.

Luckily we don't have to worry about our metrics being disjointed due
to this name change, because the background metrics never worked to
begin with! So there will be none under the old name. The metrics will
be made functional in a separate PR.
2020-08-07 16:42:48 -03:00
Erik Marks
c33eecb33b Fix connection removal bug (#9137)
* fix remove connections bug
2020-08-07 16:42:48 -03:00
Whymarrh Whitby
e435291074 Use async/await for seedPhraseVerifier.verifyAccounts (#9100) 2020-08-07 16:42:48 -03:00
Whymarrh Whitby
a7089193c8 Use async/await for getRestrictedMethods (#9099) 2020-08-07 16:42:48 -03:00
Brad Decker
10a12b8033 update email us to contact us (#9104) 2020-08-07 16:42:48 -03:00
Mark Stacey
0b71e1a619 Use environment variable for production Sentry DSN (#9097)
The Sentry DSN is now expected to be provided via environment variable
for production builds. The build script will fail if it is missing, and
an error will be thrown at runtime if it is missing.

The `SENTRY_DSN` environment variable has been set in CI to the old
value for `SENTRY_PROD_DSN`. We can migrate to a new DSN at some point
in the future.
2020-08-07 16:42:47 -03:00
Mark Stacey
0fb931950c Disable Sentry in development (#9095)
In a non-production environment, Sentry was configured to send error
reports to a "test" MetaMask project. It will still do this during e2e
tests, but in development Sentry is now disabled completely.

In practice this was never useful in development.
2020-08-07 16:42:47 -03:00
Thomas Huang
f9e4023b04 Fix popup/notification when browser is in fullscreen, primarily on macOS. (#9075)
* Fix popup/notification when browser is in fullscreen, primarily on OSX.

The issue was reported internally via Slack. User was running Mac OSX Chrome in fullscreen mode where Chrome is created in a new Desktop workspace.

The issue reproduced on OSX Chrome in fullscreen/maximized view overrides the explicitly set width and height for `windows.create()`. Possibly not overrides, but creates a window based off of the window that it was created from. Found a related [Chromium bug](https://bugs.chromium.org/p/chromium/issues/detail?id=263092&q=window%20create%20width%20os%3DMac&can=2).
The fullscreen `popup.left` pixel will calculate the window position incorrectly since we set and assume the width of the created window. The incorrect `left` position the window and transition the focus Desktop/Workspace incorrectly and make is seem to lose focus of the new window/workspace. Incidentally this will make the popup full width/height, and create a new workspace for the view, which we have no control over until Chrome
fixes it.

This will check if the popup is 'fullscreen', which it gets passed from the origin window, if so then don't reposition the window. If Chrome fixes the issue we can revert this change.

* Feedback commit

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-08-07 16:42:47 -03:00
ryanml
230d43176d Fixes MetaMask/metamask-extension#8626 - verifies password on requesting seed phrase (#9063) 2020-08-07 16:42:47 -03:00
Erik Marks
e5cb63eea2
Add web3 usage metrics, prepare for web3 removal (#9144)
* add web3 usage metrics

* move web3 metrics method to new middleware

* rename some methods, files, and exports
2020-08-07 12:28:23 -07:00
Mark Stacey
1419c14fb6
Use pathname instead of URL for currentPath metrics parameter (#9158)
The `currentPath` parameter passed to our metrics utility had been
passed the full URL rather than just the path, contrary to what the
name would imply. We only used the path portion, so passing the full
URL did lead to complications.

Now just the `pathname` is passed in, rather than the full URL. This
simplifies the metrics logic, and it incidentally fixes two bugs.

The main bug fixed is regarding Firefox metrics. Previously we had
assumed the `currentPath` would start with `chrome-extension://`, which
of course was not true on Firefox. This lead to us incorrectly parsing
the `currentPath`, so path tracking was broken for Firefox events.
This broken parsing is now bypassed entirely, so metrics should now
work the same on Firefox as on Chrome.

The second bug was that we were incorrectly setting the tracking URL
for background events during tests. As a result, we were incorrectly
detecting ourselves as an internal site that had referred the user to
us. But this was not of major concern, since it only affected test
metrics (which get sent to the development Matomo project).

Lastly, this change let us discard the `pathname` parameter used in
the `overrides` parameter of the `metricsEvent` function. Now that
`currentPath` is equivalent to `pathname`, the `pathname` parameter is
redundant.
2020-08-07 15:32:46 -03:00
Mark Stacey
8713927e5e
Remove url parameter from metricsEvent (#9157)
* Remove `url` parameter from `metricsEvent`

The `url` parameter was used to override the `currentPath`, but it
never worked correctly. It was supposed to be used for setting the
`url` query parameter that was sent to Matomo, but `currentPath` was
always used even if it `url` was set and `currentPath` was empty.

Instead, `currentPath` is now always used. There was never a need to
provide an "override" for `currentPath` when it can be set directly.
The metrics provider does set `currentPath` automatically by default,
but this can be overwritten already by passing a second parameter to
`metricsEvent`.

There were two places this `url` parameter was being used: background
events, and path changes. Background events were submitted with no
`currentPath`, so because of the bug with the `url` parameter, the
metrics utility would crash upon each event. So those were never
actually sent. This commit will fix that crash.

The `currentPath` parameter was supplied as an empty string for the
path change events, so those never crashed. They just had the `url`
query string parameter set incorrectly (to an empty string). It should
now be correctly populated, which should mean we'll be capturing all
path changes now. Previously we were only capturing path changes to
pages that happened to include an event, because of this blank `url`
problem.

* Use `url` query parameter as fallback for generating `pv_id`

The `pv_id` parameter currently isn't generated correctly on Firefox,
as the generation assumes that the current URL starts with
`chrome-extension://`. The `url` query parameter is still unique for
each path, so it's probably good enough for generating an id for each
page.

This is just a temporary fix; it will be removed in a future PR, where
Firefox will be properly supported.
2020-08-07 14:57:27 -03:00