diff --git a/components/webdriver_server/actions.rs b/components/webdriver_server/actions.rs index 774ed41e3cb..6230983718e 100644 --- a/components/webdriver_server/actions.rs +++ b/components/webdriver_server/actions.rs @@ -6,6 +6,7 @@ use std::collections::{HashMap, HashSet}; use std::thread; use std::time::{Duration, Instant}; +use base::id::BrowsingContextId; use constellation_traits::EmbedderToConstellationMessage; use embedder_traits::{MouseButtonAction, WebDriverCommandMsg, WebDriverScriptCommand}; use ipc_channel::ipc; @@ -114,6 +115,7 @@ impl Handler { pub(crate) fn dispatch_actions( &self, actions_by_tick: ActionsByTick, + browsing_context: BrowsingContextId, ) -> Result<(), ErrorStatus> { // Step 1. Wait for an action queue token with input state. let new_token = self.id_generator.next(); @@ -121,7 +123,7 @@ impl Handler { self.current_action_id.set(Some(new_token)); // Step 2. Let actions result be the result of dispatch actions inner. - let res = self.dispatch_actions_inner(actions_by_tick); + let res = self.dispatch_actions_inner(actions_by_tick, browsing_context); // Step 3. Dequeue input state's actions queue. self.current_action_id.set(None); @@ -131,9 +133,17 @@ impl Handler { } /// - fn dispatch_actions_inner(&self, actions_by_tick: ActionsByTick) -> Result<(), ErrorStatus> { + fn dispatch_actions_inner( + &self, + actions_by_tick: ActionsByTick, + browsing_context: BrowsingContextId, + ) -> Result<(), ErrorStatus> { // Step 1. For each item tick actions in actions by tick for tick_actions in actions_by_tick.iter() { + // Step 1.1. If browsing context is no longer open, + // return error with error code no such window. + self.verify_browsing_context_is_open(browsing_context) + .map_err(|e| e.error)?; // Step 1.2. Let tick duration be the result of // computing the tick duration with argument tick actions. let tick_duration = compute_tick_duration(tick_actions); diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index cd479d7fae6..c3fc2a57fba 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -1543,14 +1543,15 @@ impl Handler { &mut self, parameters: ActionsParameters, ) -> WebDriverResult { + let browsing_context = self.session()?.browsing_context_id; // Step 1. If session's current browsing context is no longer open, // return error with error code no such window. - self.verify_browsing_context_is_open(self.session()?.browsing_context_id)?; + self.verify_browsing_context_is_open(browsing_context)?; // Step 5. Let actions by tick be the result of trying to extract an action sequence let actions_by_tick = self.extract_an_action_sequence(parameters); - // Step 6. Dispatch actions - match self.dispatch_actions(actions_by_tick) { + // Step 6. Dispatch actions with current browsing context + match self.dispatch_actions(actions_by_tick, browsing_context) { Ok(_) => Ok(WebDriverResponse::Void), Err(error) => Err(WebDriverError::new(error, "")), } @@ -1782,9 +1783,11 @@ impl Handler { }, }; + // Step 8.16. Dispatch a list of actions with session's current browsing context let actions_by_tick = self.actions_by_tick_from_sequence(vec![action_sequence]); - - if let Err(e) = self.dispatch_actions(actions_by_tick) { + if let Err(e) = + self.dispatch_actions(actions_by_tick, self.session()?.browsing_context_id) + { log::error!("handle_element_click: dispatch_actions failed: {:?}", e); } diff --git a/tests/wpt/meta/webdriver/tests/classic/refresh/refresh.py.ini b/tests/wpt/meta/webdriver/tests/classic/refresh/refresh.py.ini index 08528d08784..3b120a48422 100644 --- a/tests/wpt/meta/webdriver/tests/classic/refresh/refresh.py.ini +++ b/tests/wpt/meta/webdriver/tests/classic/refresh/refresh.py.ini @@ -1,7 +1,4 @@ [refresh.py] - [test_no_top_browsing_context] - expected: FAIL - [test_no_browsing_context] expected: FAIL