Skip to content

Commit

Permalink
Fix a bug that was not canceling the original context
Browse files Browse the repository at this point in the history
  • Loading branch information
noahshinn committed Dec 25, 2023
1 parent 410eb5c commit f422c3d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions browser/browser.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ func (b *Browser) RunHeadful(ctx context.Context) error {
log.Println("running the browser in headful mode; warning: you will lose all non-location state from the current browser")
newOps := append(b.options, BrowserOptionHeadful)
newBrowserCtx, newBrowserCancelFunc := newBrowser(ctx, newOps...)
b.cancel()
b.ctx = newBrowserCtx
b.cancel = newBrowserCancelFunc
if err := b.Navigate(b.display.Location); err != nil {
Expand All @@ -301,6 +302,7 @@ func (b *Browser) RunHeadless(ctx context.Context) error {
return option != BrowserOptionHeadful
})
newBrowserCtx, newBrowserCancelFunc := newBrowser(ctx, newOps...)
b.cancel()
b.ctx = newBrowserCtx
b.cancel = newBrowserCancelFunc
if err := b.Navigate(b.display.Location); err != nil {
Expand Down

0 comments on commit f422c3d

Please sign in to comment.