From 2680e23b1589f686c53d080b1384ba67f5dc3326 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 12 Feb 2016 02:19:52 +0100 Subject: [PATCH] jsre: fix pretty printer for upstream otto change --- jsre/pretty.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/jsre/pretty.go b/jsre/pretty.go index 99aa9b33e5..64f0a95c96 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)) } }