Skip to content

fix(client): raise NodeNotFoundError for a node from another JavaScript world - #647

Merged
route merged 1 commit into
mainfrom
fix-stale-object-world
Oct 16, 2026
Merged

route merged 1 commit into
mainfrom
fix-stale-object-world

Conversation

@route

@route route commented Oct 16, 2026

Copy link
Copy Markdown
Member

Fixes rubycdp/cuprite#233.

When the page navigates between resolving a node (DOM.resolveNode) and evaluating with it, Chrome rejects the call with Argument should belong to the same JavaScript world as target object: the object belongs to the previous page's context. Ferrum raised it as a plain Ferrum::BrowserError, so Cuprite couldn't tell the node was stale, and Capybara failed within(...) { find(...) } immediately instead of finding the scope again and retrying.

It's now raised as Ferrum::NodeNotFoundError, like the other "node is gone" messages. Cuprite already turns that into ObsoleteNode, which Capybara retries.

The spec resolves a node, navigates, then evaluates with the old object. Without the fix it gets Ferrum::BrowserError.

@route
route merged commit 7ac9a96 into main Oct 16, 2026
7 checks passed
@route
route deleted the fix-stale-object-world branch October 16, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Race condition leading to Argument should belong to the same JavaScript world as target object

1 participant