aboutsummaryrefslogtreecommitdiffstats
path: root/jsre
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-02-12 09:19:52 +0800
committerFelix Lange <fjl@twurst.com>2016-02-12 09:19:52 +0800
commit2680e23b1589f686c53d080b1384ba67f5dc3326 (patch)
tree490ec95397cb1ff7dd7fbdd90469fa9b69d4ddd3 /jsre
parentd6c6bcc9f3157d87081db900c7f3903dbaa1e9d9 (diff)
downloaddexon-2680e23b1589f686c53d080b1384ba67f5dc3326.tar
dexon-2680e23b1589f686c53d080b1384ba67f5dc3326.tar.gz
dexon-2680e23b1589f686c53d080b1384ba67f5dc3326.tar.bz2
dexon-2680e23b1589f686c53d080b1384ba67f5dc3326.tar.lz
dexon-2680e23b1589f686c53d080b1384ba67f5dc3326.tar.xz
dexon-2680e23b1589f686c53d080b1384ba67f5dc3326.tar.zst
dexon-2680e23b1589f686c53d080b1384ba67f5dc3326.zip
jsre: fix pretty printer for upstream otto change
Diffstat (limited to 'jsre')
-rw-r--r--jsre/pretty.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/jsre/pretty.go b/jsre/pretty.go
index 99aa9b33e..64f0a95c9 100644
--- a/jsre/pretty.go
+++ b/jsre/pretty.go
@@ -202,8 +202,17 @@ func (ctx ppctx) doOwnProperties(v otto.Value, f func(string)) {
Object, _ := ctx.vm.Object("Object")
rv, _ := Object.Call("getOwnPropertyNames", v)
gv, _ := rv.Export()
- for _, v := range gv.([]interface{}) {
- f(v.(string))
+ switch gv := gv.(type) {
+ case []interface{}:
+ for _, v := range gv {
+ f(v.(string))
+ }
+ case []string:
+ for _, v := range gv {
+ f(v)
+ }
+ default:
+ panic(fmt.Errorf("Object.getOwnPropertyNames returned unexpected type %T", gv))
}
}