1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/app/scripts/lib
Mark Stacey 5ee1291662
Prevent accidental use of globals (#8340)
Previously all browser globals were allowed to be used anywhere by
ESLint because we had set the `env` property to `browser` in the ESLint
config. This has made it easy to accidentally use browser globals
(e.g. #8338), so it has been removed. Instead we now have a short list
of allowed globals.

All browser globals are now accessed as properties on `window`.

Unfortunately this change resulted in a few different confusing unit
test errors, as some of our unit tests setup assumed that a particular
global would be used via `window` or `global`. In particular,
`window.fetch` didn't work correctly because it wasn't patched by the
AbortController polyfill (only `global.fetch` was being patched).
The `jsdom-global` package we were using complicated matters by setting
all of the JSDOM `window` properties directly on `global`, overwriting
the `AbortController` for example.

The `helpers.js` test setup module has been simplified somewhat by
removing `jsdom-global` and constructing the JSDOM instance manually.
The JSDOM window is set on `window`, and a few properties are set on
`global` as well as needed by various dependencies. `node-fetch` and
the AbortController polyfill/patch now work as expected as well,
though `fetch` is only available on `window` now.
2020-04-15 14:23:27 -03:00
..
ens-ipfs Prevent accidental use of globals (#8340) 2020-04-15 14:23:27 -03:00
migrator Clean up Migrator test cases (#7835) 2020-01-15 13:54:28 -08:00
account-tracker.js Enable arrow-parens ESLint rule 2020-02-15 17:04:21 -03:30
auto-reload.js update inpage-provider; minor fixes (#7997) 2020-02-06 07:57:54 -08:00
backend-metametrics.js Migrate codebase to use ESM (#7730) 2020-01-09 00:04:58 -03:30
buy-eth-url.js Update Wyre ETH purchase url (#8051) 2020-02-14 14:07:24 -08:00
cleanErrorStack.js Consistent jsdoc syntax (#7755) 2020-01-13 14:36:36 -04:00
ComposableObservableStore.js Migrate codebase to use ESM (#7730) 2020-01-09 00:04:58 -03:30
createDnodeRemoteGetter.js Enable arrow-parens ESLint rule 2020-02-15 17:04:21 -03:30
createLoggerMiddleware.js Migrate codebase to use ESM (#7730) 2020-01-09 00:04:58 -03:30
createOnboardingMiddleware.js Assign tabId to middleware request, if provided (#7695) 2020-02-20 18:39:00 -04:00
createOriginMiddleware.js Migrate codebase to use ESM (#7730) 2020-01-09 00:04:58 -03:30
createStreamSink.js Migrate codebase to use ESM (#7730) 2020-01-09 00:04:58 -03:30
createTabIdMiddleware.js Assign tabId to middleware request, if provided (#7695) 2020-02-20 18:39:00 -04:00
decrypt-message-manager.js Implementation encrypt/decrypt feature (#7831) 2020-02-19 14:24:16 -04:00
encryption-public-key-manager.js LoginPerSite: Support multiple accounts without automatic switching (#8079) 2020-03-06 13:34:56 -08:00
enums.js Migrate codebase to use ESM (#7730) 2020-01-09 00:04:58 -03:30
extractEthjsErrorMessage.js Consistent jsdoc syntax (#7755) 2020-01-13 14:36:36 -04:00
fetch-with-timeout.js Prevent accidental use of globals (#8340) 2020-04-15 14:23:27 -03:00
freezeGlobals.js Consistent jsdoc syntax (#7755) 2020-01-13 14:36:36 -04:00
get-first-preferred-lang-code.js Enable arrow-parens ESLint rule 2020-02-15 17:04:21 -03:30
getObjStructure.js Replace clone dependency with cloneDeep from lodash (#7926) 2020-01-29 13:14:33 -04:00
local-store.js Consistent jsdoc syntax (#7755) 2020-01-13 14:36:36 -04:00
message-manager.js Enable arrow-parens ESLint rule 2020-02-15 17:04:21 -03:30
network-store.js Prevent accidental use of globals (#8340) 2020-04-15 14:23:27 -03:00
nodeify.js Consistent jsdoc syntax (#7755) 2020-01-13 14:36:36 -04:00
notification-manager.js Refactor notification manager and triggerUi to use extension platform (#8317) 2020-04-11 12:12:45 -03:00
pending-balance-calculator.js Consistent jsdoc syntax (#7755) 2020-01-13 14:36:36 -04:00
personal-message-manager.js Enable arrow-parens ESLint rule 2020-02-15 17:04:21 -03:30
random-id.js Migrate codebase to use ESM (#7730) 2020-01-09 00:04:58 -03:30
reportFailedTxToSentry.js Migrate codebase to use ESM (#7730) 2020-01-09 00:04:58 -03:30
seed-phrase-verifier.js Consistent jsdoc syntax (#7755) 2020-01-13 14:36:36 -04:00
select-chain-id.js Migrate codebase to use ESM (#7730) 2020-01-09 00:04:58 -03:30
setupFetchDebugging.js Prevent accidental use of globals (#8340) 2020-04-15 14:23:27 -03:00
setupSentry.js Prevent accidental use of globals (#8340) 2020-04-15 14:23:27 -03:00
stream-utils.js Consistent jsdoc syntax (#7755) 2020-01-13 14:36:36 -04:00
typed-message-manager.js Enable arrow-parens ESLint rule 2020-02-15 17:04:21 -03:30
util.js Prevent accidental use of globals (#8340) 2020-04-15 14:23:27 -03:00