Bug 323386
| Summary: | WebDriver reports "stale element reference" for a node reference from a different browsing context | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Brent Fulgham <bfulgham> |
| Component: | New Bugs | Assignee: | Brent Fulgham <bfulgham> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Brent Fulgham
Each frame's injected WebAutomationSessionProxy.js keeps its own map of node handles. _nodeForIdentifier() throws NodeNotFound whenever a handle is absent from that map, which conflates two different situations:
(1) the node was in this frame and has since been detached (a stale handle)
(2) the node was never in this frame, because it belongs to a different frame or window
CommandResult.cpp maps NodeNotFound to StaleElementReference, so both report stale element reference. Per the spec the second case is no such element (or no such shadow root for a shadow root reference).
_clearStaleNodes() already knows the difference: it evicts exactly those handles whose node is no longer rooted in this document. Recording what it evicts lets _nodeForIdentifier() throw a distinct StaleNode error for the detached case and keep NodeNotFound for the foreign one.
This fix improves 16 subtests across webdriver/tests/classic/execute_script/arguments.py and execute_async_script/arguments.py
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/186615759>
Brent Fulgham
Pull request: https://github.com/WebKit/WebKit/pull/73206
EWS
Committed 320518@main (f56eb24b3195): <https://commits.webkit.org/320518@main>
Reviewed commits have been landed. Closing PR #73206 and removing active labels.