diff --git a/go.mod b/go.mod index 00b6f388a03..c852f2c1fee 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/PuerkitoBio/goquery v1.8.1 github.com/Soontao/goHttpDigestClient v0.0.0-20170320082612-6d28bb1415c5 github.com/andybalholm/brotli v1.0.5 - github.com/dop251/goja v0.0.0-20231024180952-594410467bc6 + github.com/dop251/goja v0.0.0-20231027120936-b396bb4c349d github.com/fatih/color v1.15.0 github.com/go-sourcemap/sourcemap v2.1.4-0.20211119122758-180fcef48034+incompatible github.com/golang/protobuf v1.5.3 diff --git a/go.sum b/go.sum index 5ceed337db6..c3097ce2dd7 100644 --- a/go.sum +++ b/go.sum @@ -45,8 +45,8 @@ github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnm 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-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= -github.com/dop251/goja v0.0.0-20231024180952-594410467bc6 h1:U9bRrSlYCu0P8hMulhIdYpr5HUao66tKPdNgD88Zi5M= -github.com/dop251/goja v0.0.0-20231024180952-594410467bc6/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= +github.com/dop251/goja v0.0.0-20231027120936-b396bb4c349d h1:wi6jN5LVt/ljaBG4ue79Ekzb12QfJ52L9Q98tl8SWhw= +github.com/dop251/goja v0.0.0-20231027120936-b396bb4c349d/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= diff --git a/vendor/github.com/dop251/goja/vm.go b/vendor/github.com/dop251/goja/vm.go index dd328444d1b..031870c9429 100644 --- a/vendor/github.com/dop251/goja/vm.go +++ b/vendor/github.com/dop251/goja/vm.go @@ -4437,28 +4437,20 @@ var throw _throw func (_throw) exec(vm *vm) { v := vm.stack[vm.sp-1] - var ex *Exception + ex := &Exception{ + val: v, + } + if o, ok := v.(*Object); ok { if e, ok := o.self.(*errorObject); ok { if len(e.stack) > 0 { - frame0 := e.stack[0] - // If the Error was created immediately before throwing it (i.e. 'throw new Error(....)') - // avoid capturing the stack again by the reusing the stack from the Error. - // These stacks would be almost identical and the difference doesn't matter for debugging. - if frame0.prg == vm.prg && vm.pc-frame0.pc == 1 { - ex = &Exception{ - val: v, - stack: e.stack, - } - } + ex.stack = e.stack } } } - if ex == nil { - ex = &Exception{ - val: v, - stack: vm.captureStack(make([]StackFrame, 0, len(vm.callStack)+1), 0), - } + + if ex.stack == nil { + ex.stack = vm.captureStack(make([]StackFrame, 0, len(vm.callStack)+1), 0) } if ex = vm.handleThrow(ex); ex != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index 3d142913aa4..9c669acd7b7 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -101,7 +101,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-20231024180952-594410467bc6 +# github.com/dop251/goja v0.0.0-20231027120936-b396bb4c349d ## explicit; go 1.16 github.com/dop251/goja github.com/dop251/goja/ast