mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 02:10:12 +01:00
Return after 'reject' in Promise constructor (#8857)
There were three cases where execution unintentionally continued after an error was encountered. These cases likely are impossible to encounter in practice due to recent validation improvements in the `eth-json-rpc-middleware/wallet` module, but they were broken nonetheless. Execution inside the Promise constructor now halts immediately after `reject` is called.
This commit is contained in:
parent
1d2644423e
commit
828ec0530a
@ -82,7 +82,7 @@ export default class DecryptMessageManager extends EventEmitter {
|
||||
addUnapprovedMessageAsync (msgParams, req) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!msgParams.from) {
|
||||
reject(new Error('MetaMask Decryption: from field is required.'))
|
||||
return reject(new Error('MetaMask Decryption: from field is required.'))
|
||||
}
|
||||
const msgId = this.addUnapprovedMessage(msgParams, req)
|
||||
this.once(`${msgId}:finished`, (data) => {
|
||||
|
@ -79,7 +79,7 @@ export default class EncryptionPublicKeyManager extends EventEmitter {
|
||||
addUnapprovedMessageAsync (address, req) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!address) {
|
||||
reject(new Error('MetaMask Message: address field is required.'))
|
||||
return reject(new Error('MetaMask Message: address field is required.'))
|
||||
}
|
||||
const msgId = this.addUnapprovedMessage(address, req)
|
||||
this.once(`${msgId}:finished`, (data) => {
|
||||
|
@ -85,7 +85,7 @@ export default class PersonalMessageManager extends EventEmitter {
|
||||
addUnapprovedMessageAsync (msgParams, req) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!msgParams.from) {
|
||||
reject(new Error('MetaMask Message Signature: from field is required.'))
|
||||
return reject(new Error('MetaMask Message Signature: from field is required.'))
|
||||
}
|
||||
const msgId = this.addUnapprovedMessage(msgParams, req)
|
||||
this.once(`${msgId}:finished`, (data) => {
|
||||
|
Loading…
Reference in New Issue
Block a user