webdriver: Assume more consistently that the BrowsingContext exists (#37389)

1. Tidy up some WebDriver handling with browsing context
2. Enable more wpt-test which no longer panic

Testing: `./mach test-wpt -r --log-raw "D:\servo test log\all.txt"
.\tests\wpt\tests\webdriver\tests\classic\ --product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
Euclid Ye 2025-06-11 22:23:47 +08:00 committed by GitHub
parent fab958258e
commit c1ee354c38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 28 additions and 108 deletions

View file

@ -76,18 +76,10 @@ fn find_node_by_unique_id(
pipeline: PipelineId,
node_id: String,
) -> Result<DomRoot<Node>, ErrorStatus> {
match documents.find_document(pipeline) {
Some(doc) => find_node_by_unique_id_in_document(&doc, node_id),
None => {
// FIXME: This is unreacheable!! Because we already early return in Constellation
// To be Fixed soon
if ScriptThread::has_node_id(pipeline, &node_id) {
Err(ErrorStatus::StaleElementReference)
} else {
Err(ErrorStatus::NoSuchElement)
}
},
}
let doc = documents
.find_document(pipeline)
.expect("webdriver_handlers::Document should exists");
find_node_by_unique_id_in_document(&doc, node_id)
}
pub(crate) fn find_node_by_unique_id_in_document(