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:
@ -3,18 +3,18 @@ package rpc
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/ethereum/go-ethereum/jsre"
|
||||
"github.com/robertkrimen/otto"
|
||||
)
|
||||
|
||||
type Jeth struct {
|
||||
ethApi *EthereumApi
|
||||
toVal func(interface{}) otto.Value
|
||||
re *jsre.JSRE
|
||||
}
|
||||
|
||||
func NewJeth(ethApi *EthereumApi, toVal func(interface{}) otto.Value, re *jsre.JSRE) *Jeth {
|
||||
return &Jeth{ethApi, toVal, re}
|
||||
func NewJeth(ethApi *EthereumApi, re *jsre.JSRE) *Jeth {
|
||||
return &Jeth{ethApi, re}
|
||||
}
|
||||
|
||||
func (self *Jeth) err(call otto.FunctionCall, code int, msg string, id interface{}) (response otto.Value) {
|
||||
|
Reference in New Issue
Block a user