Finalize property call fix

This commit is contained in:
Guillaume Ballet 2019-12-02 18:37:24 +01:00
parent f857b8076b
commit 2c78ae55f5

View file

@ -397,16 +397,12 @@ type jsonrpcCall struct {
// Send implements the web3 provider "send" method.
func (b *bridge) Send(call goja.FunctionCall) (response goja.Value) {
// Remarshal the request into a Go value.
stringify, isFunc := goja.AssertFunction(b.runtime.Get("JSON.stringify"))
if !isFunc {
throwJSException(b.runtime, "JSON.stringify isn't a function")
}
reqVal, err := stringify(call.Argument(0))
reqVal, err := call.Argument(0).ToObject(b.runtime).MarshalJSON()
if err != nil {
throwJSException(b.runtime, err.Error())
}
var (
rawReq = reqVal.String()
rawReq = string(reqVal)
dec = json.NewDecoder(strings.NewReader(rawReq))
reqs []jsonrpcCall
batch bool
@ -436,11 +432,7 @@ func (b *bridge) Send(call goja.FunctionCall) (response goja.Value) {
// raw message for some reason.
resp.Set("result", goja.Null())
} else {
parse, isFunc := goja.AssertFunction(b.runtime.Get("JSON.parse"))
if !isFunc {
throwJSException(b.runtime, "JSON.parse isn't a function")
}
resultVal, err := parse(b.runtime.ToValue(string(result)))
resultVal, err := b.runtime.RunString(string(result))
if err != nil {
setError(resp, -32603, err.Error())
} else {