Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
22450c06
G
go-ethereum
项目概览
whqwjb
/
go-ethereum
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
go-ethereum
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
22450c06
编写于
4月 21, 2015
作者:
Z
zelig
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
js console: add cors domain optional argument to startRpc
上级
a3fb4198
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
8 deletion
+17
-8
cmd/geth/admin.go
cmd/geth/admin.go
+10
-1
cmd/geth/js_test.go
cmd/geth/js_test.go
+7
-7
未找到文件。
cmd/geth/admin.go
浏览文件 @
22450c06
...
...
@@ -209,10 +209,19 @@ func (js *jsre) startRPC(call otto.FunctionCall) otto.Value {
return
otto
.
FalseValue
()
}
var
corsDomain
string
if
len
(
call
.
ArgumentList
)
>
2
{
corsDomain
,
err
=
call
.
Argument
(
2
)
.
ToString
()
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
otto
.
FalseValue
()
}
}
config
:=
rpc
.
RpcConfig
{
ListenAddress
:
addr
,
ListenPort
:
uint
(
port
),
// CorsDomain: ctx.GlobalString(RPCCORSDomainFlag.Name)
,
CorsDomain
:
corsDomain
,
}
xeth
:=
xeth
.
New
(
js
.
ethereum
,
nil
)
...
...
cmd/geth/js_test.go
浏览文件 @
22450c06
...
...
@@ -3,16 +3,16 @@ package main
import
(
"fmt"
"io/ioutil"
"path/filepath"
"os"
"path"
"path/filepath"
"testing"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
"runtime"
"regexp"
"runtime"
"strconv"
)
...
...
@@ -70,8 +70,8 @@ func TestAccounts(t *testing.T) {
t
.
Errorf
(
"address not hex: %q"
,
addr
)
}
checkEvalJSON
(
t
,
repl
,
`eth.accounts`
,
`["`
+
addr
+
`"]`
)
checkEvalJSON
(
t
,
repl
,
`eth.coinbase`
,
`"`
+
addr
+
`"`
)
checkEvalJSON
(
t
,
repl
,
`eth.accounts`
,
`["`
+
addr
+
`"]`
)
checkEvalJSON
(
t
,
repl
,
`eth.coinbase`
,
`"`
+
addr
+
`"`
)
}
func
TestBlockChain
(
t
*
testing
.
T
)
{
...
...
@@ -97,13 +97,13 @@ func TestBlockChain(t *testing.T) {
tmpfile
:=
filepath
.
Join
(
tmp
,
"export.chain"
)
tmpfileq
:=
strconv
.
Quote
(
tmpfile
)
checkEvalJSON
(
t
,
repl
,
`admin.export(`
+
tmpfileq
+
`)`
,
`true`
)
checkEvalJSON
(
t
,
repl
,
`admin.export(`
+
tmpfileq
+
`)`
,
`true`
)
if
_
,
err
:=
os
.
Stat
(
tmpfile
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
// check import, verify that dumpBlock gives the same result.
checkEvalJSON
(
t
,
repl
,
`admin.import(`
+
tmpfileq
+
`)`
,
`true`
)
checkEvalJSON
(
t
,
repl
,
`admin.import(`
+
tmpfileq
+
`)`
,
`true`
)
checkEvalJSON
(
t
,
repl
,
`admin.debug.dumpBlock()`
,
beforeExport
)
}
...
...
@@ -129,7 +129,7 @@ func TestRPC(t *testing.T) {
}
func
checkEvalJSON
(
t
*
testing
.
T
,
re
*
jsre
,
expr
,
want
string
)
error
{
val
,
err
:=
re
.
re
.
Run
(
"JSON.stringify("
+
expr
+
")"
)
val
,
err
:=
re
.
re
.
Run
(
"JSON.stringify("
+
expr
+
")"
)
if
err
==
nil
&&
val
.
String
()
!=
want
{
err
=
fmt
.
Errorf
(
"Output mismatch for `%s`:
\n
got: %s
\n
want: %s"
,
expr
,
val
.
String
(),
want
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录