mirror of
https://github.com/servo/servo.git
synced 2025-08-29 17:18:23 +01:00
webdriver: Focus when "switch to window" (#38889)
Add logic that was accidentally removed in #38745. Otherwise it is very weird when using webdriver as a human, as we still stays on the original tab. Testing: ~this should not affect any test. Even if the tab is not "visible" previously, all programmatic interaction works fine.~ Stably pass `test_history_pushstate` in `back.py` and `forward.py`. --------- Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
This commit is contained in:
parent
71db9494bb
commit
0b5bcfbf17
3 changed files with 7 additions and 7 deletions
|
@ -1067,7 +1067,7 @@ impl Handler {
|
||||||
/// <https://w3c.github.io/webdriver/#get-window-handles>
|
/// <https://w3c.github.io/webdriver/#get-window-handles>
|
||||||
fn handle_window_handles(&mut self) -> WebDriverResult<WebDriverResponse> {
|
fn handle_window_handles(&mut self) -> WebDriverResult<WebDriverResponse> {
|
||||||
let mut handles = self.get_window_handles();
|
let mut handles = self.get_window_handles();
|
||||||
handles.sort();
|
handles.sort_unstable();
|
||||||
|
|
||||||
Ok(WebDriverResponse::Generic(ValueResponse(
|
Ok(WebDriverResponse::Generic(ValueResponse(
|
||||||
serde_json::to_value(handles)?,
|
serde_json::to_value(handles)?,
|
||||||
|
@ -1266,6 +1266,12 @@ impl Handler {
|
||||||
let session = self.session_mut()?;
|
let session = self.session_mut()?;
|
||||||
session.set_webview_id(webview_id);
|
session.set_webview_id(webview_id);
|
||||||
session.set_browsing_context_id(BrowsingContextId::from(webview_id));
|
session.set_browsing_context_id(BrowsingContextId::from(webview_id));
|
||||||
|
|
||||||
|
// Step 5. Update any implementation-specific state that would result
|
||||||
|
// from the user selecting session's current browsing context for interaction,
|
||||||
|
// without altering OS-level focus.
|
||||||
|
self.focus_webview(webview_id)?;
|
||||||
|
|
||||||
Ok(WebDriverResponse::Void)
|
Ok(WebDriverResponse::Void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,3 @@
|
||||||
|
|
||||||
[test_seen_nodes[https coop\]]
|
[test_seen_nodes[https coop\]]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_history_pushstate]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -13,6 +13,3 @@
|
||||||
|
|
||||||
[test_removed_iframe]
|
[test_removed_iframe]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[test_history_pushstate]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue