Skip to content

Commit

Permalink
Disable timeout on browser process connection
Browse files Browse the repository at this point in the history
This commit modifies the browser connecting process to not pass a
context with timeout to the browser process implementation so its
closing handler is not triggered after the set timeout. Currently this
was done using as timeout the value set for the browser.timeout option,
which should serve a different purpose.
  • Loading branch information
ka3de committed May 2, 2023
1 parent a42d17e commit 1fa9bfb
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions chromium/browser_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (b *BrowserType) Connect(wsEndpoint string, opts goja.Value) api.Browser {
func (b *BrowserType) connect(
ctx context.Context, wsURL string, opts *common.LaunchOptions, logger *log.Logger,
) (*common.Browser, error) {
browserProc, err := b.link(ctx, wsURL, opts, logger)
browserProc, err := b.link(ctx, wsURL, logger)
if browserProc == nil {
return nil, fmt.Errorf("connecting to browser: %w", err)
}
Expand All @@ -140,10 +140,9 @@ func (b *BrowserType) connect(
}

func (b *BrowserType) link(
ctx context.Context, wsURL string,
opts *common.LaunchOptions, logger *log.Logger,
ctx context.Context, wsURL string, logger *log.Logger,
) (*common.BrowserProcess, error) {
bProcCtx, bProcCtxCancel := context.WithTimeout(ctx, opts.Timeout)
bProcCtx, bProcCtxCancel := context.WithCancel(ctx)
p, err := common.NewRemoteBrowserProcess(bProcCtx, wsURL, bProcCtxCancel, logger)
if err != nil {
bProcCtxCancel()
Expand Down

0 comments on commit 1fa9bfb

Please sign in to comment.