Various fixes for webdriver conformance tests (#35737)

* servodriver: Ensure capabilities is always a non-empty value.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* webdriver: Serialize arguments object like an array.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* webdriver: Ensure script body is always valid JS.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* webdriver: Use current browsing context when getting element center point.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* webdriver: Propagate errors received from getting element center point.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* webdriver: Ensure opening a new window records a unique window handle.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* webdriver: Don't panic if script execution fails.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* webdriver: Do not update the current browsing context after closing a window.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* webdriver: Use more precise check for arguments exotic object.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-03-15 09:54:14 -04:00 committed by GitHub
parent bc4ee8b56a
commit 21ecfdd088
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 46 additions and 32 deletions

View file

@ -372,19 +372,15 @@ impl Handler {
PointerOrigin::Pointer => (start_x + x_offset, start_y + y_offset),
PointerOrigin::Element(ref x) => {
let (sender, receiver) = ipc::channel().unwrap();
self.top_level_script_command(WebDriverScriptCommand::GetElementInViewCenterPoint(
x.to_string(),
sender,
))
self.browsing_context_script_command(
WebDriverScriptCommand::GetElementInViewCenterPoint(x.to_string(), sender),
)
.unwrap();
match receiver.recv().unwrap() {
Ok(point) => match point {
Some(point) => point,
None => return Err(ErrorStatus::UnknownError),
},
Err(_) => return Err(ErrorStatus::UnknownError),
}
let Some(point) = receiver.recv().unwrap()? else {
return Err(ErrorStatus::UnknownError);
};
point
},
};