mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
script: Support decomposing ShadowRoot from mozjs HandleValue
(#38984)
- Add `ShadowRoot` to `JSValue` to avoid `WebDriverJSError::UnknownType`, and `JavaScriptEvaluationError::SerializationError` when execute JS from embedder. - Add unit test. - Move [is_detached](https://w3c.github.io/webdriver/#dfn-is-detached) to `fn is_detached` to be reused. - Other random simplification. Testing: WebDriver conformance tests. --------- Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
This commit is contained in:
parent
5308228436
commit
3ac226e841
12 changed files with 43 additions and 39 deletions
|
@ -260,6 +260,7 @@ impl Serialize for SendableJSValue {
|
|||
JSValue::Number(x) => serializer.serialize_f64(x),
|
||||
JSValue::String(ref x) => serializer.serialize_str(x),
|
||||
JSValue::Element(ref x) => WebElement(x.clone()).serialize(serializer),
|
||||
JSValue::ShadowRoot(ref x) => ShadowRoot(x.clone()).serialize(serializer),
|
||||
JSValue::Frame(ref x) => WebFrame(x.clone()).serialize(serializer),
|
||||
JSValue::Window(ref x) => WebWindow(x.clone()).serialize(serializer),
|
||||
JSValue::Array(ref x) => x
|
||||
|
@ -2066,6 +2067,10 @@ impl Handler {
|
|||
ErrorStatus::StaleElementReference,
|
||||
"Stale element",
|
||||
)),
|
||||
Err(WebDriverJSError::DetachedShadowRoot) => Err(WebDriverError::new(
|
||||
ErrorStatus::DetachedShadowRoot,
|
||||
"Detached shadow root",
|
||||
)),
|
||||
Err(WebDriverJSError::Timeout) => {
|
||||
Err(WebDriverError::new(ErrorStatus::ScriptTimeout, ""))
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue