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: address flakiness in frame handling #8688
Conversation
2ea6f88
to
e17a052
Compare
When we attach to a frame, we send a call to get the page frame tree from CDP. Based on the tree data we look up the parent frame if parentId is provided. The problem is that the call to get the page frame tree could take arbitrary time and the calls for the parent and child frames might happen at the same time. So the situation where the frame tree for the child frame is resolved before the parent frame is known is fairly common. This PR addresses the issue by awaiting for the parent frame id before attempting to register a child frame.
e17a052
to
b6c4b52
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a good non-flaky way to test any of this?
@mathiasbynens I have been thinking about record/replaying CDP messages for test that without an actual Chromium binary but I think it's too much effort to maintain such tests. |
I can imagine the rebaselining getting a bit out of hand, indeed… Oh well. Feel free to land this as-is! |
When we attach to a frame, we send a call to get the page frame tree from CDP. Based on the tree data we look up the parent frame if parentId is provided. The problem is that the call to get the page frame tree could take arbitrary time and the calls for the parent and child frames might happen at the same time. So the situation where the frame tree for the child frame is resolved before the parent frame is known is fairly common. This PR addresses the issue by awaiting for the parent frame id before attempting to register a child frame.
When we attach to a frame, we send a call to get
the page frame tree from CDP. Based on the tree data
we look up the parent frame if parentId is provided.
The problem is that the call to get the page frame
tree could take arbitrary time and the calls for the
parent and child frames might happen at the same time.
So the situation where the frame tree for the child frame
is resolved before the parent frame is known is fairly
common.
This PR addresses the issue by awaiting for the parent
frame id before attempting to register a child frame.