Skip to content

Commit

Permalink
Use actions queue when dispatching undo actions from "Release Actions"
Browse files Browse the repository at this point in the history
  • Loading branch information
whimboo committed Oct 30, 2024
1 parent db06684 commit 0c2858c
Showing 1 changed file with 38 additions and 10 deletions.
48 changes: 38 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10314,6 +10314,35 @@ <h3><dfn>Release Actions</dfn></h3>
as if the state was released by an explicit series of actions.
It also clears all the internal state of the virtual devices.

<p>The algorithm to <a>get undo actions</a> takes an input state and returns its <a>input cancel list</a> in reverse order.

<p>To <dfn>get undo actions</dfn> given <var>input
state</var>:

<ol class=algorithm>
<li><p>Let <var>token</var> be a new unique identifier.

<li><p>Enqueue <var>token</var> in <var>input state</var>&apos;s <a>actions
queue</a>.

<li><p>Wait for <var>token</var> to be the first item
in <var>input state</var>&apos;s <a>actions queue</a>.

<aside class=note>
<p>This ensures that only one set of actions can be run at a time,
and therefore different actions commands using the same underlying
state don&apos;t race. In a session that is only a HTTP session only one
command can run at a time, so this will never block. But other
session types can allow running multiple commands in parallel, in
which case this is necessary to ensure sequential access.
</aside>

<li><p>Let <var>undo actions</var> be <var>input
state</var>&apos;s <a>input cancel list</a> in reverse order.

<li><p>Return <var>undo actions</var>.
</ol>

<p>The <a>remote end steps</a>, given <var>session</var>, <var>URL
variables</var> and <var>parameters</var> are:

Expand All @@ -10323,25 +10352,24 @@ <h3><dfn>Release Actions</dfn></h3>
code</a> <a>no such window</a>.

<li><p>Let <var>input state</var> be the result of <a>get the
input state</a> with <a>session</a> and <a>current
top-level browsing context</a>.
input state</a> with <a>session</a> and <a>current
top-level browsing context</a>.

<li><p>Let <var>actions options</var> be a new <a>actions options</a>
with the <a>is element origin</a> steps set to <a>represents a web
element</a>, and the <a>get element origin</a> steps set
to <a>get a WebElement origin</a>.

<li><p>Let <var>undo actions</var> be <var>input
state</var>&apos;s <a>input cancel list</a> in reverse order.
<li><p>Let <var>undo actions</var> be the result of <a>get undo actions</a>.

<li><p><a>Try</a> to <a>dispatch tick actions</a> with arguments
<var>undo
actions</var>, <code>0</code>,<var>session</var>&apos;s <a>current
browsing context</a>, and <a>actions options</a>.
<li><p><a>Dispatch actions</a> with <var>input state</var>,
<var>undo actions</var>, <a>current browsing context</a>,
and <var>actions options</var>. If this results in an <a>error</a>
return that error.

<li><p><a>Reset the input state</a> with <var>session</var>
and <var>session</var>&apos;s <a>current top-level browsing
context</a>.
and <var>session</var>&apos;s <a>current top-level browsing
context</a>.

<li><p>Return <a>success</a> with data <a><code>null</code></a>.
</ol>
Expand Down

0 comments on commit 0c2858c

Please sign in to comment.