From 23d8f910b7a51a6f6ad9091c8d43a2c5b2779286 Mon Sep 17 00:00:00 2001 From: Mihail Stoykov Date: Thu, 13 Jun 2024 15:46:56 +0300 Subject: [PATCH] Update sobek and goja respectfully --- go.mod | 4 ++-- go.sum | 8 ++++---- vendor/github.com/dop251/goja/object_goreflect.go | 9 ++++++--- vendor/github.com/dop251/goja/runtime.go | 10 ++++++++-- vendor/modules.txt | 4 ++-- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 3df238da64b..85bad3bb2fb 100644 --- a/go.mod +++ b/go.mod @@ -8,13 +8,13 @@ require ( github.com/PuerkitoBio/goquery v1.9.1 github.com/Soontao/goHttpDigestClient v0.0.0-20170320082612-6d28bb1415c5 github.com/andybalholm/brotli v1.1.0 - github.com/dop251/goja v0.0.0-20240516125602-ccbae20bcec2 + github.com/dop251/goja v0.0.0-20240610225006-393f6d42497b github.com/evanw/esbuild v0.21.2 github.com/fatih/color v1.16.0 github.com/go-sourcemap/sourcemap v2.1.4+incompatible github.com/golang/protobuf v1.5.4 github.com/gorilla/websocket v1.5.1 - github.com/grafana/sobek v0.0.0-20240607083612-4f0cd64f4e78 + github.com/grafana/sobek v0.0.0-20240613124309-cb36746e8fee github.com/grafana/xk6-browser v1.5.2-0.20240607140836-ffcc1f5169ad github.com/grafana/xk6-dashboard v0.7.4 github.com/grafana/xk6-output-prometheus-remote v0.4.0 diff --git a/go.sum b/go.sum index b7ea98f0d1a..451c6ed1cf2 100644 --- a/go.sum +++ b/go.sum @@ -42,8 +42,8 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dlclark/regexp2 v1.9.0 h1:pTK/l/3qYIKaRXuHnEnIf7Y5NxfRPfpb7dis6/gdlVI= github.com/dlclark/regexp2 v1.9.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/dop251/goja v0.0.0-20240516125602-ccbae20bcec2 h1:OFTHt+yJDo/uaIKMGjEKzc3DGhrpQZoqvMUIloZv6ZY= -github.com/dop251/goja v0.0.0-20240516125602-ccbae20bcec2/go.mod h1:o31y53rb/qiIAONF7w3FHJZRqqP3fzHUr1HqanthByw= +github.com/dop251/goja v0.0.0-20240610225006-393f6d42497b h1:fMKDnOAKCGXSZBphY/ilLtu7cmwMnjqE+xJxUkfkpCY= +github.com/dop251/goja v0.0.0-20240610225006-393f6d42497b/go.mod h1:o31y53rb/qiIAONF7w3FHJZRqqP3fzHUr1HqanthByw= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -83,8 +83,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= -github.com/grafana/sobek v0.0.0-20240607083612-4f0cd64f4e78 h1:rVCZdB+13G+aQoGm3CBVaDGl0uxZxfjvQgEJy4IeHTA= -github.com/grafana/sobek v0.0.0-20240607083612-4f0cd64f4e78/go.mod h1:6ZH0b0iOxyigeTh+/IlGoL0Hd3lVXA94xoXf0ldNgCM= +github.com/grafana/sobek v0.0.0-20240613124309-cb36746e8fee h1:KjQPRiLoSZMz+oMdEyh8fE/rurMpx3lpRH8PIR66nzo= +github.com/grafana/sobek v0.0.0-20240613124309-cb36746e8fee/go.mod h1:4uA93vCOP7fFfkAEByuRieuU72pAc5DH05b71yCIVsQ= github.com/grafana/xk6-browser v1.5.2-0.20240607140836-ffcc1f5169ad h1:q3sB942oYrD7NlcsS9hz26I9W+EKfpKVmhKe7dWUp3s= github.com/grafana/xk6-browser v1.5.2-0.20240607140836-ffcc1f5169ad/go.mod h1:xLaGGhTMHIRsMvkVWFYh9RPy87kG2n4L4Or6DeI8U+o= github.com/grafana/xk6-dashboard v0.7.4 h1:0ZRPTAXW+6A3Xqq/a/OaIZhxUt1SOMwUFff0IPwBHrs= diff --git a/vendor/github.com/dop251/goja/object_goreflect.go b/vendor/github.com/dop251/goja/object_goreflect.go index 7ad5970efb8..f8ca6d05a6f 100644 --- a/vendor/github.com/dop251/goja/object_goreflect.go +++ b/vendor/github.com/dop251/goja/object_goreflect.go @@ -535,14 +535,17 @@ func (r *Runtime) buildFieldInfo(t reflect.Type, index []int, info *reflectField for i := 0; i < n; i++ { field := t.Field(i) name := field.Name - if !ast.IsExported(name) { + isExported := ast.IsExported(name) + + if !isExported && !field.Anonymous { continue } + if r.fieldNameMapper != nil { name = r.fieldNameMapper.FieldName(t, field) } - if name != "" { + if name != "" && isExported { if inf, exists := info.Fields[name]; !exists { info.Names = append(info.Names, name) } else { @@ -557,7 +560,7 @@ func (r *Runtime) buildFieldInfo(t reflect.Type, index []int, info *reflectField copy(idx, index) idx[len(idx)-1] = i - if name != "" { + if name != "" && isExported { info.Fields[name] = reflectFieldInfo{ Index: idx, Anonymous: field.Anonymous, diff --git a/vendor/github.com/dop251/goja/runtime.go b/vendor/github.com/dop251/goja/runtime.go index 0139ef10db1..e9a500da5a2 100644 --- a/vendor/github.com/dop251/goja/runtime.go +++ b/vendor/github.com/dop251/goja/runtime.go @@ -386,11 +386,13 @@ func (e *Exception) String() string { } func (e *Exception) Error() string { - if e == nil || e.val == nil { + if e == nil { return "" } var b bytes.Buffer - b.WriteString(e.val.String()) + if e.val != nil { + b.WriteString(e.val.String()) + } e.writeShortStack(&b) return b.String() } @@ -411,6 +413,10 @@ func (e *Exception) Unwrap() error { return nil } +func (e *Exception) Stack() []StackFrame { + return e.stack +} + func (r *Runtime) createIterProto(val *Object) objectImpl { o := newBaseObjectObj(val, r.global.ObjectPrototype, classObject) diff --git a/vendor/modules.txt b/vendor/modules.txt index a468c7cea71..06b4ab96922 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -105,7 +105,7 @@ github.com/dgryski/go-rendezvous ## explicit; go 1.13 github.com/dlclark/regexp2 github.com/dlclark/regexp2/syntax -# github.com/dop251/goja v0.0.0-20240516125602-ccbae20bcec2 +# github.com/dop251/goja v0.0.0-20240610225006-393f6d42497b ## explicit; go 1.20 github.com/dop251/goja github.com/dop251/goja/ast @@ -173,7 +173,7 @@ github.com/google/uuid # github.com/gorilla/websocket v1.5.1 ## explicit; go 1.20 github.com/gorilla/websocket -# github.com/grafana/sobek v0.0.0-20240607083612-4f0cd64f4e78 +# github.com/grafana/sobek v0.0.0-20240613124309-cb36746e8fee ## explicit; go 1.20 github.com/grafana/sobek # github.com/grafana/xk6-browser v1.5.2-0.20240607140836-ffcc1f5169ad