Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use actions queue when dispatching undo actions from "Release Actions" #1853

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 36 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10314,6 +10314,33 @@ <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>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>

Comment on lines +10321 to +10337
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jgraham this is a bit of duplication but I hope it's fine. Otherwise we might have to create a new algorithm, that is just waiting for the token to be first in the queue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think factoring this out into a new algorithm would be better.

<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 +10350,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
Loading