Commit 44390f54 authored by holgerd77's avatar holgerd77

Simplify confusing and error-provoking context conditionals in executionContextChange

parent 70c7710b
...@@ -128,25 +128,29 @@ function ExecutionContext () { ...@@ -128,25 +128,29 @@ function ExecutionContext () {
}) })
} }
if (context === 'web3') { if (context === 'vm') {
modalDialogCustom.confirm(null, 'Are you sure you want to connect to an ethereum node?', executionContext = context
() => { runPrompt(endPointUrl) }, () => { cb() } vm.stateManager.revert(function () {
) vm.stateManager.checkpoint()
} else if (context === 'injected' && injectedProvider === undefined) { })
cb() self.event.trigger('contextChanged', ['vm'])
} else { }
if (context === 'injected') {
if (context === 'injected') {
if (injectedProvider === undefined) {
cb()
} else {
executionContext = context executionContext = context
web3.setProvider(injectedProvider) web3.setProvider(injectedProvider)
self.event.trigger('contextChanged', ['injected']) 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 () { this.currentblockGasLimit = function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment