@@ -1346,8 +1346,8 @@ class ActionExecutor final : public JS::Cell {
1346
1346
1347
1347
GC_DEFINE_ALLOCATOR (ActionExecutor);
1348
1348
1349
- // https://w3c.github.io/webdriver/#dfn-dispatch-actions
1350
- GC::Ref<JS::Cell> dispatch_actions (InputState& input_state, Vector<Vector<ActionObject>> actions_by_tick, HTML::BrowsingContext& browsing_context, ActionsOptions actions_options, OnActionsComplete on_complete )
1349
+ // https://w3c.github.io/webdriver/#dfn-wait-for-an-action-queue-token
1350
+ void wait_for_an_action_queue_token (InputState& input_state)
1351
1351
{
1352
1352
// 1. Let token be a new unique identifier.
1353
1353
auto token = MUST (Crypto::generate_random_uuid ());
@@ -1359,19 +1359,25 @@ GC::Ref<JS::Cell> dispatch_actions(InputState& input_state, Vector<Vector<Action
1359
1359
// FIXME: We should probably do this, but our WebDriver currently blocks until a given action is complete anyways,
1360
1360
// so we should never arrive here with an ongoing action (which we verify for now).
1361
1361
VERIFY (input_state.actions_queue .size () == 1 );
1362
+ }
1363
+
1364
+ // https://w3c.github.io/webdriver/#dfn-dispatch-actions
1365
+ GC::Ref<JS::Cell> dispatch_actions (InputState& input_state, Vector<Vector<ActionObject>> actions_by_tick, HTML::BrowsingContext& browsing_context, ActionsOptions actions_options, OnActionsComplete on_complete)
1366
+ {
1367
+ // 1. Wait for an action queue token with input state.
1368
+ wait_for_an_action_queue_token (input_state);
1362
1369
1363
- // 4 . Let actions result be the result of dispatch actions inner with input state, actions by tick, browsing
1370
+ // 2 . Let actions result be the result of dispatch actions inner with input state, actions by tick, browsing
1364
1371
// context, and actions options.
1365
1372
auto action_executor = browsing_context.heap ().allocate <ActionExecutor>(input_state, move (actions_by_tick), browsing_context, move (actions_options), on_complete);
1366
1373
action_executor->process_next_tick ();
1367
1374
1368
- // 5. Dequeue input state's actions queue.
1375
+ // 3. Dequeue input state's actions queue.
1376
+ // Assert: this returns token
1377
+ // NOTE: We can't assert because `token` isn't defined here, it exists in `wait_for_an_action_queue_token()` instead.
1369
1378
auto executed_token = input_state.actions_queue .take_first ();
1370
1379
1371
- // 6. Assert: this returns token
1372
- VERIFY (executed_token == token);
1373
-
1374
- // 7. Return actions result.
1380
+ // 4. Return actions result.
1375
1381
return action_executor;
1376
1382
}
1377
1383
0 commit comments