diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index afc3d0f569..ce059b91ca 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.js @@ -200,7 +200,7 @@ function runTab (container, appAPI, appEvents, opts) { var selectExEnv = el.querySelector('#selectExEnvOptions') selectExEnv.addEventListener('change', function (event) { executionContext.executionContextChange(selectExEnv.options[selectExEnv.selectedIndex].value, null, () => { - // set the new context. if that fails, rollback the current one. + // set the final context. Cause it is possible that this is not the one we've originaly selected selectExEnv.value = executionContext.getProvider() }) diff --git a/src/execution-context.js b/src/execution-context.js index 2cb0341f82..6840fc4f80 100644 --- a/src/execution-context.js +++ b/src/execution-context.js @@ -112,8 +112,8 @@ function ExecutionContext () { } this.executionContextChange = function (context, endPointUrl, cb) { + if (!cb) cb = () => {} function runPrompt () { - console.log('runPrompt') executionContext = context if (!endPointUrl) { endPointUrl = 'http://localhost:8545' @@ -121,6 +121,10 @@ function ExecutionContext () { modalDialogCustom.prompt(null, 'Web3 Provider Endpoint', endPointUrl, (target) => { setProviderFromEndpoint(target) self.event.trigger('contextChanged', ['web3']) + cb() + }, () => { + self.event.trigger('contextChanged', ['web3']) + cb() }) } @@ -135,9 +139,7 @@ function ExecutionContext () { executionContext = context web3.setProvider(injectedProvider) self.event.trigger('contextChanged', ['injected']) - console.log('injected') } else if (context === 'vm') { - console.log('vm!!') executionContext = context vm.stateManager.revert(function () { vm.stateManager.checkpoint()