mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
webdriver: Focus WebView asynchronously (#39241)
#38160 added a webdriver-specific API to support waiting on focus operations to complete. Later, #38243 added a unique id to track each focus operation. Back then we wait on focusing webview in webdriver hoping to improve stability, but it does not matter as it turns out later. #39086 also focuses browsing context asynchronously. This PR would make webdriver's focusing-webview behaviour same as human interaction. Testing: [Before 1](https://github.com/yezhizhen/servo/actions/runs/17598288280), [Before 2](https://github.com/yezhizhen/servo/actions/runs/17598289360), [Before 3](https://github.com/yezhizhen/servo/actions/runs/17598290532) [After 1](https://github.com/yezhizhen/servo/actions/runs/17598282988), [After 2](https://github.com/yezhizhen/servo/actions/runs/17598280603), [After 3](https://github.com/yezhizhen/servo/actions/runs/17589228530) --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
parent
433a6bf47b
commit
726b456120
12 changed files with 42 additions and 124 deletions
|
@ -2515,15 +2515,8 @@ impl Handler {
|
|||
}
|
||||
}
|
||||
|
||||
fn focus_webview(&self, webview_id: WebViewId) -> Result<(), WebDriverError> {
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
self.send_message_to_embedder(WebDriverCommandMsg::FocusWebView(webview_id, sender))?;
|
||||
if wait_for_ipc_response(receiver)? {
|
||||
debug!("Focus new webview {webview_id} successfully");
|
||||
} else {
|
||||
debug!("Focus new webview failed, it may not exist anymore");
|
||||
}
|
||||
Ok(())
|
||||
fn focus_webview(&self, webview_id: WebViewId) -> WebDriverResult<()> {
|
||||
self.send_message_to_embedder(WebDriverCommandMsg::FocusWebView(webview_id))
|
||||
}
|
||||
|
||||
fn focus_browsing_context(&self, browsing_cotext_id: BrowsingContextId) -> WebDriverResult<()> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue