From 3feec90528a4c51a8ff9667592a5290f406b2d53 Mon Sep 17 00:00:00 2001 From: Euclid Ye Date: Sun, 22 Jun 2025 02:31:19 +0800 Subject: [PATCH] [WebDriver:Release Actions] Fix wrong comments and Improve codestyle (#37585) [Spec](https://w3c.github.io/webdriver/#release-actions) Testing: No behaviour change. Signed-off-by: Euclid Ye --- components/webdriver_server/lib.rs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index 134caddc316..b316ffa566e 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -218,8 +218,6 @@ impl WebDriverSession { } } -/// The `Handler` for the WebDriver server. -/// Currently, only 1 session is supported. struct Handler { /// The threaded receiver on which we can block for a load-status. /// It will receive messages sent on the load_status_sender, @@ -1751,22 +1749,21 @@ impl Handler { self.verify_browsing_context_is_open(session.browsing_context_id)?; // TODO: Step 2. User prompts. No user prompt implemented yet. - // TODO: Step 3. Skip for now because webdriver holds only one session. + + // Skip: Step 3. We don't support "browsing context input state map" yet. + // TODO: Step 4. Actions options are not used yet. - // TODO: Step 5. Skip for now because webdriver holds only one session. + + // Step 5. Not needed because "In a session that is only a HTTP session + // only one command can run at a time, so this will never block." // Step 6. Let undo actions be input cancel list in reverse order. let mut input_cancel_list = session.input_cancel_list.borrow_mut(); let undo_actions: ActionsByTick = input_cancel_list .drain(..) .rev() - .map(|action| { - let mut map = HashMap::new(); - map.insert(action.0, action.1); - map - }) + .map(|(id, action_item)| HashMap::from([(id, action_item)])) .collect(); - // Step 7. Dispatch undo actions with current browsing context. if let Err(err) = self.dispatch_actions(undo_actions, session.browsing_context_id) { return Err(WebDriverError::new(err, "Failed to dispatch undo actions"));