Ensuring that the goroutine can exit early if the context is closed.
Why?
There's a chance that the goroutine reading off the resultCh has or is exiting due to the context being closed. We don't want this goroutine to be hanging around waiting since nothing will read off the resultCh or errCh.
Checklist
[x] I have performed a self-review of my code
[ ] I have added tests for my changes
[ ] I have commented on my code, particularly in hard-to-understand areas
What?
Ensuring that the goroutine can exit early if the context is closed.
Why?
There's a chance that the goroutine reading off the
resultCh
has or is exiting due to the context being closed. We don't want this goroutine to be hanging around waiting since nothing will read off theresultCh
orerrCh
.Checklist
Related PR(s)/Issue(s)
Updates: https://github.com/grafana/xk6-browser/issues/1437