-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: waitForDomNetworkQuiet() can hang forever
#1284
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: waitForDomNetworkQuiet() can hang forever
#1284
Conversation
🦋 Changeset detectedLatest commit: 094ce98 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Greptile Summary
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant ActHandler
participant waitForDomNetworkQuiet
participant Frame
participant CDP
User->>ActHandler: "act(instruction)"
ActHandler->>waitForDomNetworkQuiet: "waitForDomNetworkQuiet(frame, timeout)"
Note over waitForDomNetworkQuiet: "Start timer (settleStart)"
waitForDomNetworkQuiet->>Frame: "evaluate('document.readyState')"
Frame->>CDP: "Runtime.evaluate"
CDP-->>Frame: "readyState value"
Frame-->>waitForDomNetworkQuiet: "readyState result"
alt "Document not ready"
waitForDomNetworkQuiet->>Frame: "waitForLoadState('domcontentloaded', timeout)"
Frame->>CDP: "Page.enable"
Frame->>CDP: "Listen for Page.lifecycleEvent"
CDP-->>Frame: "LifecycleEvent(name='DOMContentLoaded')"
Note over Frame: "Normalize to lowercase"
Note over Frame: "Match 'domcontentloaded'"
Frame-->>waitForDomNetworkQuiet: "Load state reached"
end
Note over waitForDomNetworkQuiet: "Calculate elapsed & remainingBudget"
waitForDomNetworkQuiet->>CDP: "Network.enable, Page.enable"
Note over waitForDomNetworkQuiet: "Monitor network requests"
waitForDomNetworkQuiet->>CDP: "Listen for Network events"
CDP-->>waitForDomNetworkQuiet: "Network quiet (500ms)"
waitForDomNetworkQuiet-->>ActHandler: "DOM settled"
ActHandler-->>User: "Action completed"
|
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.
2 files reviewed, no comments
Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format
why
waitForDomNetworkQuiet()does not resolveframe.waitForLoadState()was not listening for the correct lifecycle events from CDP. instead of listening forDOMContentLoaded, it was listening fordomcontentloadedframe.waitForLoadState()did not accept a timeout parameterwaitForDomNetworkQuiet()did not include the call toframe.waitForLoadState()as part of the total time that it waits forwhat changed
frame.waitForLoadState()(fixes the first issue)frame.waitForLoadState()waitForDomNetworkQuiet(), I included the call toframe.waitForLoadState()as part of the total time that it waits fortest plan