diff --git a/src/execution-context.js b/src/execution-context.js index 29a8a9c810..0307b66738 100644 --- a/src/execution-context.js +++ b/src/execution-context.js @@ -128,25 +128,29 @@ function ExecutionContext () { }) } - if (context === 'web3') { - modalDialogCustom.confirm(null, 'Are you sure you want to connect to an ethereum node?', - () => { runPrompt(endPointUrl) }, () => { cb() } - ) - } else if (context === 'injected' && injectedProvider === undefined) { - cb() - } else { - if (context === 'injected') { + if (context === 'vm') { + executionContext = context + vm.stateManager.revert(function () { + vm.stateManager.checkpoint() + }) + self.event.trigger('contextChanged', ['vm']) + } + + if (context === 'injected') { + if (injectedProvider === undefined) { + cb() + } else { executionContext = context web3.setProvider(injectedProvider) self.event.trigger('contextChanged', ['injected']) - } else if (context === 'vm') { - executionContext = context - vm.stateManager.revert(function () { - vm.stateManager.checkpoint() - }) - self.event.trigger('contextChanged', ['vm']) } } + + if (context === 'web3') { + modalDialogCustom.confirm(null, 'Are you sure you want to connect to an ethereum node?', + () => { runPrompt(endPointUrl) }, () => { cb() } + ) + } } this.currentblockGasLimit = function () {