Skip to content

Commit

Permalink
fix: Page.frameStoppedLoading should not wait for document_node_id re…
Browse files Browse the repository at this point in the history
…sponse
  • Loading branch information
route committed Aug 3, 2024
1 parent 11ccf79 commit 5ca5e9e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

- `:ws_url` option is now used without modifications WYSIWYG.
- `Network.requestWillBeSent` callback didn't handle params in a type-safe way
- `Page.frameStoppedLoading` callback shouldn't wait for document_node_id response

### Removed

Expand Down
4 changes: 3 additions & 1 deletion lib/ferrum/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,9 @@ def use_authorized_proxy?
use_proxy? && @proxy_user && @proxy_password
end

def document_node_id
def document_node_id(async: false)
return client.command("DOM.getDocument", async: true, depth: 0) if async

command("DOM.getDocument", depth: 0).dig("root", "nodeId")
end

Expand Down
2 changes: 1 addition & 1 deletion lib/ferrum/page/frames.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def subscribe_frame_stopped_loading
# node will change the id and all subsequent nodes have to change id too.
if @main_frame.id == params["frameId"]
@event.set if idling?
document_node_id
document_node_id(async: true)
end

frame = @frames[params["frameId"]]
Expand Down

0 comments on commit 5ca5e9e

Please sign in to comment.