1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00
metamask-extension/app
Mark Stacey 9c06b07c3c
Synchronously update transaction status (#8563)
All transaction status updates were moved into a `setTimeout` callback
and wrapped in a `try...catch` block in #4131, apparently in an attempt
to prevent failures in event subscribers from interrupting the
transaction logic. The `try...catch` block did accomplish that, but by
putting the status update in a `setTimeout` callback the operation was
made asynchronous.

Transaction status updates now happen unpredictably, in some future
event loop from when they're triggered. This creates a race condition,
where the transaction status update may occur before or after
subsequent state changes. This also introduces a risk of accidentally
undoing a change to the transaction state, as the update made to the
transaction inside the `setTimeout` callback uses a reference to
`txMeta` obtained synchronously before the `setTimeout` call. Any
replacement of the `txMeta` between the `setTxStatus` call and the
execution of the timeout would be erased. Luckily the `txMeta` object
is more often than not mutated rather than replaced, which may explain
why we haven't seen this happen yet.

Everything seems to work correctly with the `setTimeout` call removed,
and now the transaction logic is easier to understand.
2020-05-09 10:46:58 -03:00
..
_locales Add missing period to localized message (#8562) 2020-05-08 21:48:21 -03:00
fonts Use @fortawesome/fontawesome-free npm package (#8256) 2020-03-30 20:05:51 -03:00
images Connect flow via popup (#8269) 2020-04-07 16:08:15 -02:30
manifest Build system refactor (#8140) 2020-03-09 08:55:02 +08:00
scripts Synchronously update transaction status (#8563) 2020-05-09 10:46:58 -03:00
vendor/trezor Close window after opening fullscreen (#6966) 2019-08-08 11:50:32 -03:00
home.html Add optional portal to Popover component (#8253) 2020-03-30 18:25:17 -02:30
loading.html refactor & change html pages 2019-05-04 18:57:19 +02:00
notification.html Fix connection modal style issues (#8433) 2020-05-04 12:04:41 -03:00
phishing.html Use main style bundle for phishing page (#8255) 2020-03-30 19:44:46 -03:00
popup.html Add optional portal to Popover component (#8253) 2020-03-30 18:25:17 -02:30
trezor-usb-permissions.html trezor v5 working on firefox 2018-08-05 02:43:02 -04:00
unsupport.html Rename files 2018-05-29 12:44:37 +08:00