From 633d338551b133a22ab15a26424044bb13491278 Mon Sep 17 00:00:00 2001 From: ankur22 Date: Tue, 30 Apr 2024 14:53:45 +0100 Subject: [PATCH] Update to the latest browser v1.5.1 --- go.mod | 2 +- go.sum | 4 ++-- .../grafana/xk6-browser/common/js_handle.go | 16 ++++++++++++++-- vendor/modules.txt | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index e3d395f4fbc..7c8ac0a8725 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( 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/xk6-browser v1.5.0 + github.com/grafana/xk6-browser v1.5.1 github.com/grafana/xk6-dashboard v0.7.2 github.com/grafana/xk6-output-prometheus-remote v0.3.1 github.com/grafana/xk6-redis v0.2.0 diff --git a/go.sum b/go.sum index 8bec1995d65..575250d8c1c 100644 --- a/go.sum +++ b/go.sum @@ -92,8 +92,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/xk6-browser v1.5.0 h1:K+1vpGQtKlAn5MGXfSjGGfNFSW4PANM0oM0IwFhFYGA= -github.com/grafana/xk6-browser v1.5.0/go.mod h1:hD9H1zpe1Fvs6RCENKnaPqpObh6alz+hX00Xf5qvDE4= +github.com/grafana/xk6-browser v1.5.1 h1:wexnBtx1raDniYcXkRQ9zfXvuJGjvixZag4kmiYG3tg= +github.com/grafana/xk6-browser v1.5.1/go.mod h1:hD9H1zpe1Fvs6RCENKnaPqpObh6alz+hX00Xf5qvDE4= github.com/grafana/xk6-dashboard v0.7.2 h1:CLaWeRfPZ388IS6rBn0nI+lqtX50QoQ73z0Hz5BIrS4= github.com/grafana/xk6-dashboard v0.7.2/go.mod h1:7HLAY4udlWGXGDQL5gWIi+In3eZRljXi8AnHt1Z+lFM= github.com/grafana/xk6-output-prometheus-remote v0.3.1 h1:X23rQzlJD8dXWB31DkxR4uPnuRFo8L0Y0H22fSG9xl0= diff --git a/vendor/github.com/grafana/xk6-browser/common/js_handle.go b/vendor/github.com/grafana/xk6-browser/common/js_handle.go index d021d7eb486..f52469e24a6 100644 --- a/vendor/github.com/grafana/xk6-browser/common/js_handle.go +++ b/vendor/github.com/grafana/xk6-browser/common/js_handle.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "strings" "github.com/grafana/xk6-browser/k6ext" "github.com/grafana/xk6-browser/log" @@ -84,9 +85,20 @@ func (h *BaseJSHandle) Dispose() { // context. The reason the context would be closed is due to the // iteration ending and therefore the associated browser and its assets // will be automatically deleted. - if !errors.Is(err, context.Canceled) { - k6ext.Panic(h.ctx, "dispose: %w", err) + if errors.Is(err, context.Canceled) { + h.logger.Debugf("BaseJSHandle:Dispose", "%v", err) + return } + // The following error indicates that the object we're trying to release + // cannot be found, which would mean that the object has already been + // removed/deleted. This can occur when a navigation occurs, usually when + // a page contains an iframe. + if strings.Contains(err.Error(), "Cannot find context with specified id") { + h.logger.Debugf("BaseJSHandle:Dispose", "%v", err) + return + } + + k6ext.Panic(h.ctx, "dispose: %w", err) } } diff --git a/vendor/modules.txt b/vendor/modules.txt index 413180affbb..7b70697d1d8 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -146,7 +146,7 @@ github.com/google/uuid # github.com/gorilla/websocket v1.5.1 ## explicit; go 1.20 github.com/gorilla/websocket -# github.com/grafana/xk6-browser v1.5.0 +# github.com/grafana/xk6-browser v1.5.1 ## explicit; go 1.20 github.com/grafana/xk6-browser/browser github.com/grafana/xk6-browser/chromium