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 oopif flakiness #294

Merged
merged 1 commit into from Jan 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/puppeteer/frame_manager.rb
Expand Up @@ -21,6 +21,8 @@ def initialize(client, page, ignore_https_errors, timeout_settings)
# @type {!Map<string, !Frame>}
@frames = {}

@frame_naviigated_received = Set.new

# @type {!Map<number, !ExecutionContext>}
@context_id_to_context = {}

Expand All @@ -42,6 +44,7 @@ def initialize(client, page, ignore_https_errors, timeout_settings)
handle_frame_attached(client, event['frameId'], event['parentFrameId'])
end
client.on_event('Page.frameNavigated') do |event|
@frame_naviigated_received << event['frame']['id']
handle_frame_navigated(event['frame'])
end
client.on_event('Page.navigatedWithinDocument') do |event|
Expand Down Expand Up @@ -227,7 +230,9 @@ def handle_frame_tree(session, frame_tree)
if frame_tree['frame']['parentId']
handle_frame_attached(session, frame_tree['frame']['id'], frame_tree['frame']['parentId'])
end
handle_frame_navigated(frame_tree['frame'])
unless @frame_naviigated_received.delete?(frame_tree['frame']['id'])
handle_frame_navigated(frame_tree['frame'])
end
return if !frame_tree['childFrames']

frame_tree['childFrames'].each do |child|
Expand Down