1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/app/scripts
Mark Stacey 9e2e353a24
Define global web3 as non-enumerable (#8634)
We inject `web3` globally on most websites. This has been breaking
websites that attempted to serialize the `window` object, because any
attempt to access certain `web3` properties (such as `web3.eth.mining`)
would throw an error. This is because `web3` defined a getter for these
properties that would call `.send([method])`, which doesn't work for
most methods.

An example of a site that this breaks is `Storybook`, when the
`@storybook/addon-actions` addon is being used. When using storybook
with this addon and with the MetaMask extension installed, actions
would not be properly dispatched because an error would be thrown in
the attempt to serialize the event (which includes a reference to the
`window`).

The `web3` global we inject is now defined as non-enumerable, so it
will be skipped automatically in any attempt to serialize the `window`
object.
2020-05-20 20:18:25 -07:00
..
account-import-strategies Clean up "JSON File" import strategy test output (#7855) 2020-01-17 19:59:47 -03:30
controllers Cleanup network enums (#8627) 2020-05-20 08:57:45 -07:00
lib Define global web3 as non-enumerable (#8634) 2020-05-20 20:18:25 -07:00
migrations Delete the ABTestController and its state (#8620) 2020-05-19 13:27:06 -02:30
platforms Move export defaults statements alongside their objects (#8525) 2020-05-05 19:49:38 -02:30
background.js Delete recent blocks controller (#8575) 2020-05-12 12:40:33 -07:00
chromereload.js Fix console.error references 2016-08-29 17:32:39 -07:00
contentscript.js Merge pull request #8056 from whymarrh/arrow-parens 2020-02-17 15:26:43 -07:00
first-time-state.js Migrate codebase to use ESM (#7730) 2020-01-09 00:04:58 -03:30
inpage.js Define global web3 as non-enumerable (#8634) 2020-05-20 20:18:25 -07:00
metamask-controller.js Delete the ABTestController and its state (#8620) 2020-05-19 13:27:06 -02:30
phishing-detect.js Replace METAMASK_UI_TYPE global with helper function (#8279) 2020-04-01 19:28:10 -03:00
ui.js Delete recent blocks controller (#8575) 2020-05-12 12:40:33 -07:00