Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix frame panic #1542

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion common/frame_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,19 @@ func (m *FrameManager) frameNavigated(frameID cdp.FrameID, parentFrameID cdp.Fra
frame := m.frames[frameID]

if !isMainFrame && frame == nil {
return errors.New("we either navigate top level or have old version of the navigated frame")
m.logger.Debugf("FrameManager:frameNavigated:nil frame",
"fmid:%d fid:%v pfid:%v docid:%s fname:%s furl:%s initial:%t",
m.ID(), frameID, parentFrameID, documentID, name, url, initial)

// If the frame is nil at this point, then the cause of this is likely
// due to chrome not sending a frameAttached event ahead of time. This
// isn't a bug in chrome, and seems to be intended behavior. Instead
// of worrying about the nil frame and causing the test to fail when
// the frame is nil, we can instead return early. The frame will
// be initialized when getFrameTree CDP request is made, which will
// call onFrameAttached and onFrameNavigated.

return nil
}

m.logger.Debugf("FrameManager:frameNavigated:removeFrames",
Expand Down
Loading