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

Support automatic user prompt handing in WebDriver BiDi #10189

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
89 changes: 60 additions & 29 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -89581,7 +89581,7 @@ location.href = '#foo';</code></pre>
<hr>

<p>A <dfn>navigation ID</dfn> is a UUID string generated during navigation. It is used to
interface with the <cite>WebDriver BiDi</cite> specification as well as to track the <span>ongoing
interface with the <cite>river BiDi</cite> specification as well as to track the <span>ongoing
Copy link

Choose a reason for hiding this comment

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

Suggested change
interface with the <cite>river BiDi</cite> specification as well as to track the <span>ongoing
interface with the <cite>WebDriver BiDi</cite> specification as well as to track the <span>ongoing

navigation</span>. <ref spec=WEBDRIVERBIDI></p>

<hr>
Expand Down Expand Up @@ -90720,22 +90720,28 @@ location.href = '#foo';</code></pre>
<p>then:</p>

<ol>
<li><p>Set <var>unloadPromptShown</var> to true.</p></li>
<li>
<p>Let <var>userPromptHandler</var> be the result of
Copy link

Choose a reason for hiding this comment

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

The formatting of this whole section is a bit off. Maybe you can fix that?

<span>WebDriver BiDi user prompt opened</span> with <var>document</var>'s
<span>relevant global object</span>, "<code data-x="">beforeunload</code>", and "".</p></li>

<li><p>Invoke <span>WebDriver BiDi user prompt opened</span> with <var>document</var>'s
<span>relevant global object</span>, "<code data-x="">beforeunload</code>", and "".</p></li>
<li><p>If <var>userPromptHandler</var> is "<code data-x="">none</code>":</p>
<ol>
<li>
<p>Ask the user to confirm that they wish to unload the document, and <span>pause</span>
while waiting for the user's response.</p>

<li>
<p>Ask the user to confirm that they wish to unload the document, and <span>pause</span>
while waiting for the user's response.</p>
<p class="note">The message shown to the user is not customizable, but instead determined
by the user agent. In particular, the actual value of the <code
data-x="dom-BeforeUnloadEvent-returnValue">returnValue</code> attribute is ignored.</p>
</li>

<p class="note">The message shown to the user is not customizable, but instead determined
by the user agent. In particular, the actual value of the <code
data-x="dom-BeforeUnloadEvent-returnValue">returnValue</code> attribute is ignored.</p>
<li><p>If the user did not confirm the page navigation, set <var>unloadPromptCanceled</var>
to true.</p></li>
</li>

<li><p>If the user did not confirm the page navigation, set <var>unloadPromptCanceled</var>
to true.</p></li>
<li><p>If <var>userPromptHandler</var> is "<code data-x="">accept</code>", set
<var>unloadPromptCanceled</var> to false.</p></li>

<li><p>Invoke <span>WebDriver BiDi user prompt closed</span> with <var>document</var>'s
<span>relevant global object</span> and true if <var>unloadPromptCanceled</var> is false or
Expand Down Expand Up @@ -102492,13 +102498,17 @@ function sendData(data) {
<li><p>Set <var>message</var> to the result of <span data-x="optionally truncate a simple dialog
string">optionally truncating</span> <var>message</var>.</p></li>

<li><p>Show <var>message</var> to the user, treating U+000A LF as a line break.</p></li>
<li><p>Let <var>userPromptHandler</var> be <span>WebDriver BiDi user prompt opened</span> with
<span>this</span>, "<code data-x="">alert</code>", and <var>message</var>.</p></li>

<li><p>Invoke <span>WebDriver BiDi user prompt opened</span> with <span>this</span>,
"<code data-x="">alert</code>", and <var>message</var>.</p></li>
<li><p>If <var>userPromptHandler</var> is "<code data-x="">none</code>":</p>
<ol>
<li><p>Show <var>message</var> to the user, treating U+000A LF as a line break.</p></li>

<li><p>Optionally, <span>pause</span> while waiting for the user to acknowledge the
message.</p></li>
<li><p>Optionally, <span>pause</span> while waiting for the user to acknowledge the
message.</p></li>
</ol>
</li>

<li><p>Invoke <span>WebDriver BiDi user prompt closed</span> with <span>this</span>
and true.</p></li>
Expand Down Expand Up @@ -102526,16 +102536,27 @@ function sendData(data) {
<li><p>Show <var>message</var> to the user, treating U+000A LF as a line break, and ask the user
to respond with a positive or negative response.</p></li>

<li><p>Invoke <span>WebDriver BiDi user prompt opened</span> with <span>this</span>,
"<code data-x="">confirm</code>", and <var>message</var>.</p></li>
<li><p>Let <var>userPromptHandler</var> be <span>WebDriver BiDi user prompt opened</span> with
<span>this</span>, "<code data-x="">confirm</code>", and <var>message</var>.</p></li>

<li><p>Let <var>accepted</var> be false.</p></li>

<li><p>If <var>userPromptHandler</var> is "<code data-x="">none</code>":</p>

<li><p><span>Pause</span> until the user responds either positively or negatively.</p></li>
<ol>
<li><p><span>Pause</span> until the user responds either positively or negatively.</p></li>

<li><p>If the user responded positively set <var>accepted</var> to true</p></li>
</ol>
</li>

<li><p>If <var>userPromptHandler</var> is "<code data-x="">accept</code>" set <var>accepted</var> to
true.</p></li>

<li><p>Invoke <span>WebDriver BiDi user prompt closed</span> with <span>this</span>,
and true if the user responded positively or false otherwise.</p></li>
and <var>accepted</var>.</p></li>

<li><p>If the user responded positively, return true; otherwise, the user responded negatively:
return false.</p></li>
<li><p>Return <var>accepted</var>.</p></li>
</ol>

<p>The <dfn method for="Window"><code data-x="dom-prompt">prompt(<var>message</var>,
Expand All @@ -102558,18 +102579,28 @@ function sendData(data) {
to either respond with a string value or abort. The response must be defaulted to the value given
by <var>default</var>.</p></li>

<li><p>Invoke <span>WebDriver BiDi user prompt opened</span> with <span>this</span>,
"<code data-x="">prompt</code>" and <var>message</var>.</p></li>
<li><p>Let <var>userPromptHandler</var> be <span>WebDriver BiDi user prompt opened</span> with
<span>this</span>, "<code data-x="">prompt</code>" and <var>message</var>.</p></li>

<li><p>Let <var>result</var> be null.</p></li>

<li><p>If <var>userPromptHandler</var> is "<code data-x="">none</code>":</p>

<ol>
<li><p><span>Pause</span> while waiting for the user's response.</p></li>

<li><p><span>Pause</span> while waiting for the user's response.</p></li>
<li><p>If the user did not abort, set <var>result</var> to the string that the user
responded with.</p></li>
</ol>
</li>

<li><p>Let <var>result</var> be null if the user aborts, or otherwise the string that the user
responded with.</p></li>
<li><p>Otherwise if <var>userPromptHandler</var> is "<code data-x="">accept</code>", set <var>result</var>
to the emtpy string.</p></li>

<li><p>Invoke <span>WebDriver BiDi user prompt closed</span> with <span>this</span>,
false if <var>result</var> is null or true otherwise, and <var>result</var>.</p></li>

<li><p>Return <var>result</var>.</li>
<li><p>Return <var>result</var>.</p></li>
</ol>

<p>To <dfn>optionally truncate a simple dialog string</dfn> <var>s</var>, return either
Expand Down