Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 513f11e

Browse files
committed
Fix empty newDocument on page.reload
1 parent f00ad8c commit 513f11e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

common/page.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,11 @@ func (p *Page) Reload(opts sobek.Value) (*Response, error) { //nolint:funlen,cyc
11001100
}
11011101

11021102
var resp *Response
1103-
if req := navigationEvent.newDocument.request; req != nil {
1103+
1104+
// Sometimes the new document is not yet available when the navigation event is emitted.
1105+
newDocument := navigationEvent.newDocument
1106+
if newDocument != nil && newDocument.request != nil {
1107+
req := newDocument.request
11041108
req.responseMu.RLock()
11051109
resp = req.response
11061110
req.responseMu.RUnlock()

0 commit comments

Comments
 (0)