mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-22 11:02:53 +00:00
LibWeb/WebDriver: Use actions queue for undo actions
This reflects part of https://github.com/w3c/webdriver/pull/1853 Also updated to reflect some minor spec text changes.
This commit is contained in:
parent
df702bd4d3
commit
ed83bb75e9
Notes:
github-actions[bot]
2025-01-03 21:15:56 +00:00
Author: https://github.com/AtkinsSJ
Commit: ed83bb75e9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3115
Reviewed-by: https://github.com/trflynn89 ✅
1 changed files with 9 additions and 6 deletions
|
@ -2372,10 +2372,10 @@ Messages::WebDriverClient::PerformActionsResponse WebDriverConnection::perform_a
|
||||||
// 15.8 Release Actions, https://w3c.github.io/webdriver/#release-actions
|
// 15.8 Release Actions, https://w3c.github.io/webdriver/#release-actions
|
||||||
Messages::WebDriverClient::ReleaseActionsResponse WebDriverConnection::release_actions()
|
Messages::WebDriverClient::ReleaseActionsResponse WebDriverConnection::release_actions()
|
||||||
{
|
{
|
||||||
// 1. If the current browsing context is no longer open, return error with error code no such window.
|
// 1. If session's current browsing context is no longer open, return error with error code no such window.
|
||||||
TRY(ensure_current_browsing_context_is_open());
|
TRY(ensure_current_browsing_context_is_open());
|
||||||
|
|
||||||
// 2. Let input state be the result of get the input state with current session and current top-level browsing context.
|
// 2. Let input state be the result of get the input state with session and current top-level browsing context.
|
||||||
auto& input_state = Web::WebDriver::get_input_state(*current_top_level_browsing_context());
|
auto& input_state = Web::WebDriver::get_input_state(*current_top_level_browsing_context());
|
||||||
|
|
||||||
// 3. Let actions options be a new actions options with the is element origin steps set to represents a web element,
|
// 3. Let actions options be a new actions options with the is element origin steps set to represents a web element,
|
||||||
|
@ -2385,17 +2385,20 @@ Messages::WebDriverClient::ReleaseActionsResponse WebDriverConnection::release_a
|
||||||
.get_element_origin = &Web::WebDriver::get_web_element_origin,
|
.get_element_origin = &Web::WebDriver::get_web_element_origin,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 4. Let undo actions be input state’s input cancel list in reverse order.
|
// 4. Wait for an action queue token with input state.
|
||||||
|
Web::WebDriver::wait_for_an_action_queue_token(input_state);
|
||||||
|
|
||||||
|
// 5. Let undo actions be input state’s input cancel list in reverse order.
|
||||||
auto undo_actions = input_state.input_cancel_list;
|
auto undo_actions = input_state.input_cancel_list;
|
||||||
undo_actions.reverse();
|
undo_actions.reverse();
|
||||||
|
|
||||||
// 5. Try to dispatch tick actions with arguments undo actions, 0, current browsing context, and actions options.
|
// 6. Try to dispatch actions with input state, undo actions, current browsing context, and actions options.
|
||||||
TRY(Web::WebDriver::dispatch_tick_actions(input_state, undo_actions, AK::Duration::zero(), current_browsing_context(), actions_options));
|
TRY(Web::WebDriver::dispatch_tick_actions(input_state, undo_actions, AK::Duration::zero(), current_browsing_context(), actions_options));
|
||||||
|
|
||||||
// 6. Reset the input state with current session and current top-level browsing context.
|
// 7. Reset the input state with session and session's current top-level browsing context.
|
||||||
Web::WebDriver::reset_input_state(*current_top_level_browsing_context());
|
Web::WebDriver::reset_input_state(*current_top_level_browsing_context());
|
||||||
|
|
||||||
// 7. Return success with data null.
|
// 8. Return success with data null.
|
||||||
return JsonValue {};
|
return JsonValue {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue