mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
[WebDriver: Dispatch Action] Check if browsing context still open for each tick action (#37393)
As titled. This is what [spec](https://w3c.github.io/webdriver/#dfn-dispatch-actions-inner) requires. The motivation is that the previous action might have changed the browsing context. Testing: `./mach test-wpt -r --log-raw "D:\servo test log\all.txt" .\tests\wpt\tests\webdriver\tests\classic\ --product servodriver` --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
parent
048d4a2a5a
commit
5f1452f9d3
3 changed files with 20 additions and 10 deletions
|
@ -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 {
|
|||
}
|
||||
|
||||
/// <https://w3c.github.io/webdriver/#dfn-dispatch-actions-inner>
|
||||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue