cmd/geth, jsre, rpc: run all JS code on the event loop

Some JSRE methods (PrettyPrint, ToVal) bypassed the event loop. All
calls to the JS VM are now wrapped. In order to make this somewhat more
foolproof, the otto VM is now a local variable inside the event loop.
This commit is contained in:
Felix Lange
2015-05-25 02:27:37 +02:00
parent 394826f520
commit e221a449e0
5 changed files with 126 additions and 178 deletions

View File

@ -104,7 +104,7 @@ func newJSRE(ethereum *eth.Ethereum, libPath, corsDomain string, interactive boo
func (js *jsre) apiBindings(f xeth.Frontend) {
xe := xeth.New(js.ethereum, f)
ethApi := rpc.NewEthereumApi(xe)
jeth := rpc.NewJeth(ethApi, js.re.ToVal, js.re)
jeth := rpc.NewJeth(ethApi, js.re)
js.re.Set("jeth", struct{}{})
t, _ := js.re.Get("jeth")