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

Open
wants to merge 1 commit into
base: main
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
100 changes: 67 additions & 33 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -100056,24 +100056,32 @@ location.href = '#foo';</code></pre>
<ol>
<li><p>Set <var>unloadPromptShown</var> to true.</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>Let <var>userPromptHandler</var> be the result of <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>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>If <var>userPromptHandler</var> is "<code data-x="">dismiss</code>", set
<var>unloadPromptCanceled</var> to true.

<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>
<li><p>If <var>userPromptHandler</var> is "<code data-x="">none</code>":</p>

<li><p>If the user did not confirm the page navigation, set <var>unloadPromptCanceled</var> to
true.</p></li>
<ul>
<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>

<li><p>If the user did not confirm the page navigation, set <var>unloadPromptCanceled</var> to
true.</p></li>
</ul>

<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
false otherwise.</p></li>
<span>relevant global object</span>, "<code data-x="">beforeunload</code>", and true
if <var>unloadPromptCanceled</var> is false or false otherwise.</p></li>
</ol>
</li>

Expand Down Expand Up @@ -114034,16 +114042,20 @@ 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>
<li><p>Invoke <span>WebDriver BiDi user prompt closed</span> with <span>this</span>,
"<code data-x="">alert</code>", and true.</p></li>
</ol>

<p class="note">This method is defined using two overloads, instead of using an
Expand All @@ -114068,16 +114080,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><span>Pause</span> until the user responds either positively or negatively.</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>

<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>
"<code data-x="">confirm</code>", 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 @@ -114100,18 +114123,29 @@ 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>", <var>message</var>, and <var>default</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><span>Pause</span> while waiting for the user's response.</p></li>
<li><p>Let <var>result</var> be null.</p></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>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>If the user did not abort, set <var>result</var> to the string that the user
responded with.</p></li>
</ol>
</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>
"<code data-x="">prompt</code>", 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