From 4bfffa81185c5ec774b66ade347532e6acbd7bb9 Mon Sep 17 00:00:00 2001 From: Tim Voronov Date: Wed, 21 Oct 2020 22:30:58 -0400 Subject: [PATCH] Fixed open tab on error (#564) --- pkg/drivers/cdp/page.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/drivers/cdp/page.go b/pkg/drivers/cdp/page.go index f9d8e889..023ff952 100644 --- a/pkg/drivers/cdp/page.go +++ b/pkg/drivers/cdp/page.go @@ -52,10 +52,18 @@ func LoadHTMLPage( return nil, err } - closers := make([]io.Closer, 0, 2) + closers := make([]io.Closer, 0, 4) defer func() { if err != nil { + if err := client.Page.Close(context.Background()); err != nil { + logger.Error().Err(err) + } + + if err := conn.Close(); err != nil { + logger.Error().Err(err) + } + common.CloseAll(logger, closers, "failed to close a Page resource") } }()