webdriver: Simplify webview related steps that are guaranteed to succeed (#38855)

Testing: Semantically it is the same. But still run the test locally and
in [try](https://github.com/yezhizhen/servo/actions/runs/17159323926) as
I was worried about some unexpected side effect from
176e42d36d. But seems everything is good.

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
This commit is contained in:
Euclid Ye 2025-08-23 01:19:12 +08:00 committed by GitHub
parent 4082f57003
commit f323e67024
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 31 additions and 38 deletions

View file

@ -60,6 +60,7 @@ pub struct WebDriverSession {
strict_file_interactability: bool,
/// <https://w3c.github.io/webdriver/#dfn-user-prompt-handler>
user_prompt_handler: UserPromptHandler,
/// <https://w3c.github.io/webdriver/#dfn-input-state-map>
@ -84,12 +85,12 @@ impl WebDriverSession {
}
}
pub fn set_webview_id(&mut self, webview_id: Option<WebViewId>) {
self.webview_id = webview_id;
pub fn set_webview_id(&mut self, webview_id: WebViewId) {
self.webview_id = Some(webview_id);
}
pub fn set_browsing_context_id(&mut self, browsing_context_id: Option<BrowsingContextId>) {
self.browsing_context_id = browsing_context_id;
pub fn set_browsing_context_id(&mut self, browsing_context_id: BrowsingContextId) {
self.browsing_context_id = Some(browsing_context_id);
}
pub fn current_webview_id(&self) -> Option<WebViewId> {