Skip to content
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

Refactor "get a known element" and "get a known shadow root" #1712

Merged
merged 1 commit into from
Jan 13, 2023

Conversation

whimboo
Copy link
Contributor

@whimboo whimboo commented Jan 10, 2023

With #1707 the browsing context check for an element or shadow root is done after the staleness check. Hereby a staleness check wouldn't be necessary at all if we know that the element's associated browsing context is not the currently selected one. Means moving the content of step 3.1 into step 2 would simplify those two independent checks.

https://w3c.github.io/webdriver/#dfn-get-a-known-element

Example: An element reference from a frame will never be a valid reference within the top-level frame, as such the staleness check will always be false.


Preview | Diff

@whimboo
Copy link
Contributor Author

whimboo commented Jan 11, 2023

As it looks like the proposed changes are not enough. When get a node returns null because an element has been garbage collected, its web element reference is still known and as such step 2 should not throw a no such element error.

@whimboo
Copy link
Contributor Author

whimboo commented Jan 12, 2023

There was one more regression that the most recent update fixes now. Without it we only checked for a node reference is known in case of the element is null. But that's broken and the check has to always be performed. As such we can do that at the very beginning even before get node given that both work independently from each other.

@whimboo whimboo changed the title Separate out existence check of element and shadow root nodes from staleness check Refactor "get a known element" Jan 12, 2023
@whimboo whimboo changed the title Refactor "get a known element" Refactor "get a known element" and "get a known shadow root" Jan 12, 2023
@whimboo
Copy link
Contributor Author

whimboo commented Jan 13, 2023

Related changes should not affect the behavior of current WebDriver classic tests. This can be proven by the wdspec results for my appropriate changes for Firefox in https://bugzilla.mozilla.org/show_bug.cgi?id=1807227.

index.html Show resolved Hide resolved
@jgraham jgraham merged commit 80b6d5d into master Jan 13, 2023
@jgraham jgraham deleted the known_element branch January 13, 2023 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants