diff --git a/app/scripts/background.js b/app/scripts/background.js index bf1903a8c..6eedeeea4 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -319,7 +319,7 @@ function setupController (initState, initLangCode) { [ENVIRONMENT_TYPE_FULLSCREEN]: true, } - const metamaskBlocklistedPorts = [ + const metamaskBlockedPorts = [ 'trezor-connect', ] @@ -343,7 +343,7 @@ function setupController (initState, initLangCode) { const processName = remotePort.name const isMetaMaskInternalProcess = metamaskInternalProcessHash[processName] - if (metamaskBlocklistedPorts.includes(remotePort.name)) { + if (metamaskBlockedPorts.includes(remotePort.name)) { return false } diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js index f4eeca4d4..17eeabf89 100644 --- a/app/scripts/contentscript.js +++ b/app/scripts/contentscript.js @@ -127,7 +127,7 @@ function logStreamDisconnectWarning (remoteLabel, err) { */ function shouldInjectProvider () { return doctypeCheck() && suffixCheck() && - documentElementCheck() && !blocklistedDomainCheck() + documentElementCheck() && !blockedDomainCheck() } /** @@ -185,8 +185,8 @@ function documentElementCheck () { * * @returns {boolean} {@code true} - if the current domain is blocked */ -function blocklistedDomainCheck () { - const blocklistedDomains = [ +function blockedDomainCheck () { + const blockedDomains = [ 'uscourts.gov', 'dropbox.com', 'webbyawards.com', @@ -200,9 +200,9 @@ function blocklistedDomainCheck () { ] const currentUrl = window.location.href let currentRegex - for (let i = 0; i < blocklistedDomains.length; i++) { - const blocklistedDomain = blocklistedDomains[i].replace('.', '\\.') - currentRegex = new RegExp(`(?:https?:\\/\\/)(?:(?!${blocklistedDomain}).)*$`) + for (let i = 0; i < blockedDomains.length; i++) { + const blockedDomain = blockedDomains[i].replace('.', '\\.') + currentRegex = new RegExp(`(?:https?:\\/\\/)(?:(?!${blockedDomain}).)*$`) if (!currentRegex.test(currentUrl)) { return true } diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index 8b4c23e08..43e13b77a 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -25,7 +25,7 @@ import NonceTracker from 'nonce-tracker' import * as txUtils from './lib/util' import cleanErrorStack from '../../lib/cleanErrorStack' import log from 'loglevel' -import { throwIfAccountIsBlockListed } from './lib/recipient-blocklist-checker' +import { throwIfAccountIsBlocked } from './lib/recipient-blocklist-checker' import { TRANSACTION_TYPE_CANCEL, @@ -241,7 +241,7 @@ export default class TransactionController extends EventEmitter { this.emit('newUnapprovedTx', txMeta) try { - throwIfAccountIsBlockListed(txMeta.metamaskNetworkId, normalizedTxParams.to) + throwIfAccountIsBlocked(txMeta.metamaskNetworkId, normalizedTxParams.to) txMeta = await this.addTxGasDefaults(txMeta, getCodeResponse) } catch (error) { log.warn(error) diff --git a/app/scripts/controllers/transactions/lib/recipient-blocklist-checker.js b/app/scripts/controllers/transactions/lib/recipient-blocklist-checker.js index 5460057a3..15a1e777c 100644 --- a/app/scripts/controllers/transactions/lib/recipient-blocklist-checker.js +++ b/app/scripts/controllers/transactions/lib/recipient-blocklist-checker.js @@ -6,7 +6,7 @@ import blocklist from './recipient-blocklist' * @param {string} account * @throws {Error} if the account is blocked on mainnet */ -export function throwIfAccountIsBlockListed (networkId, account) { +export function throwIfAccountIsBlocked (networkId, account) { const mainnetId = 1 if (networkId !== mainnetId) { return diff --git a/test/unit/app/controllers/transactions/recipient-blocklist-checker-test.js b/test/unit/app/controllers/transactions/recipient-blocklist-checker-test.js index e695d6fac..47a3fefe3 100644 --- a/test/unit/app/controllers/transactions/recipient-blocklist-checker-test.js +++ b/test/unit/app/controllers/transactions/recipient-blocklist-checker-test.js @@ -1,9 +1,9 @@ import { strict as assert } from 'assert' -import { throwIfAccountIsBlockListed } from '../../../../../app/scripts/controllers/transactions/lib/recipient-blocklist-checker' +import { throwIfAccountIsBlocked } from '../../../../../app/scripts/controllers/transactions/lib/recipient-blocklist-checker' import { ROPSTEN_NETWORK_ID, RINKEBY_NETWORK_ID, KOVAN_NETWORK_ID, GOERLI_NETWORK_ID } from '../../../../../app/scripts/controllers/network/enums' describe('Recipient Blocklist Checker', function () { - describe('#throwIfAccountIsBlockListed', function () { + describe('#throwIfAccountIsBlocked', function () { // Accounts from Ganache's original default seed phrase const publicAccounts = [ '0x627306090abab3a6e1400e9345bc60c78a8bef57', @@ -22,7 +22,7 @@ describe('Recipient Blocklist Checker', function () { const networks = [ROPSTEN_NETWORK_ID, RINKEBY_NETWORK_ID, KOVAN_NETWORK_ID, GOERLI_NETWORK_ID] for (const networkId of networks) { for (const account of publicAccounts) { - assert.doesNotThrow(() => throwIfAccountIsBlockListed(networkId, account)) + assert.doesNotThrow(() => throwIfAccountIsBlocked(networkId, account)) } } }) @@ -30,7 +30,7 @@ describe('Recipient Blocklist Checker', function () { it('fails on mainnet', function () { for (const account of publicAccounts) { assert.throws( - () => throwIfAccountIsBlockListed(1, account), + () => throwIfAccountIsBlocked(1, account), { message: 'Recipient is a public account' }, ) } @@ -38,14 +38,14 @@ describe('Recipient Blocklist Checker', function () { it('fails for public account - uppercase', function () { assert.throws( - () => throwIfAccountIsBlockListed(1, '0X0D1D4E623D10F9FBA5DB95830F7D3839406C6AF2'), + () => throwIfAccountIsBlocked(1, '0X0D1D4E623D10F9FBA5DB95830F7D3839406C6AF2'), { message: 'Recipient is a public account' }, ) }) it('fails for public account - lowercase', function () { assert.throws( - () => throwIfAccountIsBlockListed(1, '0x0d1d4e623d10f9fba5db95830f7d3839406c6af2'), + () => throwIfAccountIsBlocked(1, '0x0d1d4e623d10f9fba5db95830f7d3839406c6af2'), { message: 'Recipient is a public account' }, ) })