bug 1502864: webdriver: add strictFileInteractability capability; r=jgraham

Depends on D10272

Depends on D10272

Differential Revision: https://phabricator.services.mozilla.com/D10273

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Tolfsen 2018-11-03 16:32:34 +00:00
parent 188b9d80bf
commit 4a6bb55dbf

View File

@ -43,6 +43,9 @@ pub trait BrowserCapabilities {
/// repositioning commands.
fn set_window_rect(&mut self, &Capabilities) -> WebDriverResult<bool>;
/// Indicates that interactability checks will be applied to `<input type=file>`.
fn strict_file_interactability(&mut self, &Capabilities) -> WebDriverResult<bool>;
fn accept_proxy(
&mut self,
proxy_settings: &Map<String, Value>,
@ -123,7 +126,7 @@ impl SpecNewSessionParameters {
for (key, value) in &capabilities {
match &**key {
x @ "acceptInsecureCerts" | x @ "setWindowRect" => if !value.is_boolean() {
x @ "acceptInsecureCerts" | x @ "setWindowRect" | x @ "strictFileInteractability" => if !value.is_boolean() {
return Err(WebDriverError::new(
ErrorStatus::InvalidArgument,
format!("{} is not boolean: {}", x, value),
@ -482,6 +485,15 @@ impl CapabilitiesMatching for SpecNewSessionParameters {
return None;
}
}
"strictFileInteractability" => {
if value.as_bool().unwrap_or(false)
&& !browser_capabilities
.strict_file_interactability(merged)
.unwrap_or(false)
{
return None;
}
}
"proxy" => {
let default = Map::new();
let proxy = value.as_object().unwrap_or(&default);