Skip to content

Commit

Permalink
Fix empty newDocument on page.reload
Browse files Browse the repository at this point in the history
  • Loading branch information
inancgumus committed Jun 19, 2024
1 parent f00ad8c commit 513f11e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion common/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,11 @@ func (p *Page) Reload(opts sobek.Value) (*Response, error) { //nolint:funlen,cyc
}

var resp *Response
if req := navigationEvent.newDocument.request; req != nil {

// Sometimes the new document is not yet available when the navigation event is emitted.
newDocument := navigationEvent.newDocument
if newDocument != nil && newDocument.request != nil {
req := newDocument.request
req.responseMu.RLock()
resp = req.response
req.responseMu.RUnlock()
Expand Down

0 comments on commit 513f11e

Please sign in to comment.