webdriver: Add handle any user prompts step for all commands (#38035)

- Add `handler any user prompt` step for all commands.
- Enable webdriver tests which were blocked by `handle any user prompt`
step.

---------

Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
This commit is contained in:
batu_hoang 2025-07-17 17:47:47 +08:00 committed by GitHub
parent 18d1a62add
commit 345733a5c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 859 additions and 472 deletions

View file

@ -21,7 +21,7 @@ use servo::{
AllowOrDenyRequest, AuthenticationRequest, FilterPattern, FormControl, GamepadHapticEffectType,
KeyboardEvent, LoadStatus, PermissionRequest, Servo, ServoDelegate, ServoError, SimpleDialog,
TraversalId, WebDriverCommandMsg, WebDriverJSResult, WebDriverJSValue, WebDriverLoadStatus,
WebView, WebViewBuilder, WebViewDelegate,
WebDriverUserPrompt, WebView, WebViewBuilder, WebViewDelegate,
};
use url::Url;
@ -340,13 +340,23 @@ impl RunningAppState {
}
pub(crate) fn webview_has_active_dialog(&self, webview_id: WebViewId) -> bool {
let inner = self.inner();
inner
self.inner()
.dialogs
.get(&webview_id)
.is_some_and(|dialogs| !dialogs.is_empty())
}
pub(crate) fn get_current_active_dialog_webdriver_type(
&self,
webview_id: WebViewId,
) -> Option<WebDriverUserPrompt> {
self.inner()
.dialogs
.get(&webview_id)
.and_then(|dialogs| dialogs.last())
.map(|dialog| dialog.webdriver_diaglog_type())
}
pub(crate) fn accept_active_dialogs(&self, webview_id: WebViewId) {
if let Some(dialogs) = self.inner_mut().dialogs.get_mut(&webview_id) {
dialogs.drain(..).for_each(|dialog| {