cli/js console: if corsDomain is not given to startRpc, we fall back to value set on command line with -corsDomain

This commit is contained in:
zelig
2015-04-22 14:55:01 +01:00
parent 1b7c017076
commit 6b1b5a4a2a
4 changed files with 14 additions and 11 deletions

View File

@ -203,13 +203,14 @@ func (js *jsre) startRPC(call otto.FunctionCall) otto.Value {
fmt.Println(err)
return otto.FalseValue()
}
port, err := call.Argument(1).ToInteger()
if err != nil {
fmt.Println(err)
return otto.FalseValue()
}
var corsDomain string
corsDomain := js.corsDomain
if len(call.ArgumentList) > 2 {
corsDomain, err = call.Argument(2).ToString()
if err != nil {