aboutsummaryrefslogtreecommitdiffstats
path: root/components/webdriver_server
diff options
context:
space:
mode:
authorGeorge Roman <george.roman.99@gmail.com>2019-08-11 00:37:24 +0300
committerGeorge Roman <george.roman.99@gmail.com>2019-08-21 19:28:32 +0300
commitc665a656900db286df275bd3a0f1a31b307844c1 (patch)
tree4f36db5c8ec067a88c7d74b2c44f1f203851a127 /components/webdriver_server
parent17f423723c0206c934f104eb3352f39a9533aa41 (diff)
downloadservo-c665a656900db286df275bd3a0f1a31b307844c1.tar.gz
servo-c665a656900db286df275bd3a0f1a31b307844c1.zip
Finish the JSON clone algorithm
Diffstat (limited to 'components/webdriver_server')
-rw-r--r--components/webdriver_server/lib.rs25
1 files changed, 18 insertions, 7 deletions
diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs
index 0bd7d140c32..3b5d223c3fb 100644
--- a/components/webdriver_server/lib.rs
+++ b/components/webdriver_server/lib.rs
@@ -241,11 +241,18 @@ impl Serialize for SendableWebDriverJSValue {
WebDriverJSValue::Number(x) => serializer.serialize_f64(x),
WebDriverJSValue::String(ref x) => serializer.serialize_str(&x),
WebDriverJSValue::Element(ref x) => x.serialize(serializer),
+ WebDriverJSValue::Frame(ref x) => x.serialize(serializer),
+ WebDriverJSValue::Window(ref x) => x.serialize(serializer),
WebDriverJSValue::ArrayLike(ref x) => x
.iter()
.map(|element| SendableWebDriverJSValue(element.clone()))
.collect::<Vec<SendableWebDriverJSValue>>()
.serialize(serializer),
+ WebDriverJSValue::Object(ref x) => x
+ .iter()
+ .map(|(k, v)| (k.clone(), SendableWebDriverJSValue(v.clone())))
+ .collect::<HashMap<String, SendableWebDriverJSValue>>()
+ .serialize(serializer),
}
}
}
@@ -1396,18 +1403,22 @@ impl Handler {
Ok(value) => Ok(WebDriverResponse::Generic(ValueResponse(
serde_json::to_value(SendableWebDriverJSValue(value))?,
))),
- Err(WebDriverJSError::Timeout) => Err(WebDriverError::new(ErrorStatus::Timeout, "")),
- Err(WebDriverJSError::UnknownType) => Err(WebDriverError::new(
- ErrorStatus::UnsupportedOperation,
- "Unsupported return type",
+ Err(WebDriverJSError::BrowsingContextNotFound) => Err(WebDriverError::new(
+ ErrorStatus::JavascriptError,
+ "Pipeline id not found in browsing context",
)),
Err(WebDriverJSError::JSError) => Err(WebDriverError::new(
ErrorStatus::JavascriptError,
"JS evaluation raised an exception",
)),
- Err(WebDriverJSError::BrowsingContextNotFound) => Err(WebDriverError::new(
- ErrorStatus::JavascriptError,
- "Pipeline id not found in browsing context",
+ Err(WebDriverJSError::StaleElementReference) => Err(WebDriverError::new(
+ ErrorStatus::StaleElementReference,
+ "Stale element",
+ )),
+ Err(WebDriverJSError::Timeout) => Err(WebDriverError::new(ErrorStatus::Timeout, "")),
+ Err(WebDriverJSError::UnknownType) => Err(WebDriverError::new(
+ ErrorStatus::UnsupportedOperation,
+ "Unsupported return type",
)),
}
}