mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
Implement webdriver extract script arguments (#38357)
Fix script parsing step. Implement webdriver `extract script arguments`. Implement `deserialize_web_element` and `deserialize_shadow_root` from script command argument. Testing: `/tests/wpt/tests/webdriver/tests/classic/execute_script/` `/tests/wpt/tests/webdriver/tests/classic/execute_async_script/` cc: @xiaochengh --------- Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
This commit is contained in:
parent
c0d884ddb2
commit
9effdce5a1
9 changed files with 228 additions and 169 deletions
|
@ -1524,9 +1524,22 @@ impl WindowMethods<crate::DomTypeHolder> for Window {
|
|||
.map(Root::upcast::<Element>)
|
||||
}
|
||||
|
||||
fn WebdriverWindow(&self, _id: DOMString) -> Option<DomRoot<Window>> {
|
||||
warn!("Window references are not supported in webdriver yet");
|
||||
None
|
||||
fn WebdriverWindow(&self, id: DOMString) -> Option<DomRoot<WindowProxy>> {
|
||||
let window_proxy = self.window_proxy.get()?;
|
||||
|
||||
// Window must be top level browsing context.
|
||||
if window_proxy.browsing_context_id() != window_proxy.webview_id() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let pipeline_id = window_proxy.currently_active()?;
|
||||
let document = ScriptThread::find_document(pipeline_id)?;
|
||||
|
||||
if document.upcast::<Node>().unique_id(pipeline_id) == id.str() {
|
||||
Some(DomRoot::from_ref(&window_proxy))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn WebdriverShadowRoot(&self, id: DOMString) -> Option<DomRoot<ShadowRoot>> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue