mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Rework on webdriver wait for navigation complete (#38234)
For current implementation, when a command may trigger a navigation, webdriver only waits for document readiness state. However, not all navigations make change in document. This PR handles more cases for waiting for a navigation, and apply to `element_click`. - Before sending a command which may trigger a navigation, `webdriver` sets `load status send` to `embedder`, `constelltation` and `script thread` to listen to `navigation events`. - Webdriver check if there is a navigation with `script thread`. - If the navigation is loading a new url, webdriver checks if the request is approved with `constellation`, then waits for document readiness state. - If the navigation is a hashchange, webdriver waits untill all new generated dom events have been processed. Testing: `tests/wpt/tests/webdriver/tests/classic/element_click/navigate.py` `tests/wpt/tests/webdriver/tests/classic/element_click/user_prompts.py` https://github.com/longvatrong111/servo/actions/runs/16488690749 cc: @xiaochengh --------- Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
This commit is contained in:
parent
8b3e7b1c6a
commit
37ac4ffeb4
9 changed files with 188 additions and 125 deletions
|
@ -169,8 +169,6 @@ pub enum WebDriverCommandMsg {
|
|||
),
|
||||
GetAlertText(WebViewId, IpcSender<Result<String, ()>>),
|
||||
SendAlertText(WebViewId, String),
|
||||
AddLoadStatusSender(WebViewId, IpcSender<WebDriverLoadStatus>),
|
||||
RemoveLoadStatusSender(WebViewId),
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
|
@ -247,7 +245,8 @@ pub enum WebDriverScriptCommand {
|
|||
GetTitle(IpcSender<String>),
|
||||
/// Deal with the case of input element for Element Send Keys, which does not send keys.
|
||||
WillSendKeys(String, String, bool, IpcSender<Result<bool, ErrorStatus>>),
|
||||
IsDocumentReadyStateComplete(IpcSender<bool>),
|
||||
AddLoadStatusSender(WebViewId, IpcSender<WebDriverLoadStatus>),
|
||||
RemoveLoadStatusSender(WebViewId),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
|
@ -292,8 +291,13 @@ pub struct WebDriverCommandResponse {
|
|||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub enum WebDriverLoadStatus {
|
||||
NavigationStart,
|
||||
// Navigation stops for any reason
|
||||
NavigationStop,
|
||||
// Document ready state is complete
|
||||
Complete,
|
||||
// Load timeout
|
||||
Timeout,
|
||||
Canceled,
|
||||
// Navigation is blocked by a user prompt
|
||||
Blocked,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue