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

Update user prompt handler configuration #1819

Merged
merged 3 commits into from
Jul 2, 2024
Merged
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
38 changes: 23 additions & 15 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2304,8 +2304,7 @@ <h3>Global State</h3>
<li><p>Let <var>serialized user prompt handler</var>
be <a>serialize the user prompt handler</a>.

<li><p>If <var>serialized user prompt handler</var> is not null, set
a property on <var>capabilities</var> with the name
<li><p>Set a property on <var>capabilities</var> with the name
"<code>unhandledPromptBehavior</code>", and the value <var>serialized
user prompt handler</var>.

Expand Down Expand Up @@ -10481,8 +10480,11 @@ <h3>User Prompt Handler</h3>
<p class="note">This is to avoid [[WebDriver-BiDi]] monkey-patching
the current spec.

<li><p>Let <var>is string value</var> be false.

<li><p>If <var>value</var> is a <a>string</a> set <var>value</var> to
the <a data-cite=infra>map</a> «["<code>default</code>" → <var>value</var>]».
the <a data-cite=infra>map</a> «["<code>fallbackDefault</code>"
→ <var>value</var>]» and set <var>is string value</var> to true.

<li><p>If <var>value</var> is not a <a data-cite=infra>map</a> return
<a>error</a> with <a>error code</a> <a>invalid argument</a>.
Expand All @@ -10492,9 +10494,9 @@ <h3>User Prompt Handler</h3>
<li><p>For each <var>prompt type</var> → <var>handler</var> in <var>value</var>:

<ol>
<li><p>If <a>valid prompt types</a> does
not [=map/contain=] <var>prompt type</var> return <a>error</a>
with <a>error code</a> <a>invalid argument</a>.
<li><p>If <var>is string value</var> is false and <a>valid prompt
types</a> does not [=map/contain=] <var>prompt type</var>
return <a>error</a> with <a>error code</a> <a>invalid argument</a>.

<li><p>If <a>known prompt handlers</a> does not contain an entry
with <a>handler key</a> <var>handler</var> return <a>error</a>
Expand Down Expand Up @@ -10545,11 +10547,7 @@ <h3>User Prompt Handler</h3>
<li><p>If the <var>requested prompt handler</var>&apos;s [=prompt
handler configuration/handler=] is not equal to the <a>user
prompt handler</a>&apos;s [=prompt handler
configuration/handler=], or the <var>requested prompt
handler</var>&apos;s [=prompt handler configuration/notify=]
is not equal to the <a>user prompt
handler</a>&apos;s [=prompt handler configuration/handler=],
return false.
configuration/handler=], return false.

</ol>
</li>
Expand All @@ -10558,6 +10556,12 @@ <h3>User Prompt Handler</h3>
<li>Return true</li>
</ol>

<p class="note">This does not check the <var>requested prompt
handler</var>&apos;s [=prompt handler configuration/notify=] matches
the [=prompt handler configuration/handler=], because the [=prompt
handler configuration/notify=] component only affects the [=HTTP
session=], if any.

<p>To <dfn>update the user prompt handler</dfn> given <var>requested prompt handler</var>:

<ol class=algorithm>
Expand All @@ -10578,13 +10582,14 @@ <h3>User Prompt Handler</h3>
<p>To <dfn>serialize the user prompt handler</dfn>:

<ol class=algorithm>
<li><p>If the <a>user prompt handler</a> is null, return null.
<li><p>If the <a>user prompt handler</a> is null, return
"<code>dismiss and notify</code>".

<li><p>If the <a>user prompt handler</a> has [=map/size=] 1,
and <a>user prompt handler</a> [=list/contains=]
"<code>default</code>", return the result of <a>serialize a prompt
"<code>fallbackDefault</code>", return the result of <a>serialize a prompt
handler configuration</a> with <a>user prompt
handler</a>["<code>default</code>"].
handler</a>["<code>fallbackDefault</code>"].

<li><p>Let <var>serialized</var> be an empty <a data-cite=infra>map</a>.

Expand Down Expand Up @@ -10621,12 +10626,15 @@ <h3>User Prompt Handler</h3>
<li><p>If <var>handlers</var> contains <var>type</var>
return <var>handlers</var>[<var>type</var>].

<li><p>If <var>handlers</var> contains "<code>default</code>"
return <var>handlers</var>["<code>default</code>"].

<li><p>If <var>type</var> is "<code>beforeUnload</code>", return a
<a>prompt handler configuration</a> with [=prompt
handler configuration/handler=] "<code>accept</code>"
and [=prompt handler configuration/notify=] false.

<li><p>If <var>handlers</var> contains "<code>default</code>"
<li><p>If <var>handlers</var> contains "<code>fallbackDefault</code>"
return <var>handlers</var>["<code>default</code>"].

<li><p>Return a <a>prompt handler
Expand Down
Loading