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

Add autofill endpoints and processing model #1797

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
102 changes: 102 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,18 @@ <h3>Endpoints</h3>
<td>/session/{<var>session id</var>}/print</td>
<td><a>Print Page</a></td>
</tr>

<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/autofill/save</td>
<td><a>Save autofill values</a></td>
</tr>

<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/autofill/trigger</td>
<td><a>Trigger autofill</a></td>
</tr>
</table>
</section> <!-- /Endpoints -->

Expand Down Expand Up @@ -10782,6 +10794,96 @@ <h3><dfn>Print Page</dfn></h3>
</section> <!-- /Print Page -->
</section> <!-- /Print -->

<section>
<h2>Autofill</h2>

<p>This chapter describes testing methods for the browser's autofill
functionality to enable web developers to automatically test their HTML
content for expected autofill behavior, against multiple browser
implementations.</p>

<p>These methods would allow saving of test autofill data and then
triggering the autofill functionality on particular form field.</p>

<dfn>Autofill configuration</dfn> is a record containing a "fields" property,
an <a>ordered map</a> whose [=map/keys=] are <a
data-cite="HTML#autofill-field-name">autofill field names</a>
and <a>values</a> are the field values.

A <a>browsing context</a> has a <dfn>autofill store for testing</dfn>, an
<a>ordered map</a>.

<section>
<h3><dfn>Save autofill values</dfn></h3>

<table class="simple jsoncommand">
<tr>
<th>HTTP Method
<th>URI Template
</tr>
<tr>
<td>POST
<td>/session/{<var>session id</var>}/autofill/save
</tr>
</table>

<p>The <a>remote end steps</a> are:

<ol>
<li><p>If the <a>current top-level browsing context</a> is <a>no longer open</a>,
return <a>error</a> with <a>error code</a> <a>no such window</a>.
<li><p>Let <var>store</var> be the <a>current top-level browsing context</a>'s
<a>autofill store for testing</a>.
<li><p>Let <var>configuration</var> be the result of <a>trying</a> to
<a>JSON deserialize</a> the request’s <var>body</var> as an <a>autofill configuration</a>.
<li><p>Let <var>fields</var> be the "fields" property of <var>configuration</var>.
<li><p>[=map/For each=] <var>key</var>=><var>value</var> of <var>fields</var>, <a>set</a>
<var>store</var>[<var>key</var>] to <var>value</var>.

<aside class=example>
<p>To save autofill data in <a>current top-level browsing context</a>
of the <a>session</a> with ID <i>1</i> to a <code>name</code> of "Jane Doe" and a
<code>country</code> of "US", the <a>local end</a> would POST to
<i>/session/1/autofill/save/</i> with the body:

<pre><code>
{
"fields": {
"name": "Jane Doe",
"country": "US"
}
}
</code></pre>
</aside>
</section> <!-- /Save autofill values -->

<h3><dfn>Trigger autofill</dfn></h3>
<table class="simple jsoncommand">
<tr>
<th>HTTP Method
<th>URI Template
</tr>
<tr>
<td>POST
<td>/session/{<var>session id</var>}/autofill/trigger
</tr>
</table>

<p>The <a>remote end steps</a> are:

<ol>
<li><p>If the <a>current top-level browsing context</a> is <a>no longer open</a>,
return <a>error</a> with <a>error code</a> <a>no such window</a>.
<li><p>Let <var>element</var> be the result of <a>trying</a> to
Copy link

Choose a reason for hiding this comment

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

@yoavweiss element should be derived from a specified elementId, right?

Copy link
Author

Choose a reason for hiding this comment

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

Not necessarily. IIUC (and it's highly likely I don't), Web elements can be represented using their node ID.

yoavweiss marked this conversation as resolved.
Show resolved Hide resolved
<a>deserialize a web element</a> given request body.
<li><p>The <a>user agent</a> should <a data-cite="HTML#concept-fe-autofill">autofill</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if the page doesn't have a form in it. Currently this looks like it should attempt to do the right thing but the user is never given any feedback.

Copy link
Author

Choose a reason for hiding this comment

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

I can add a check to enforce the existence of a form owner (and throw if there isn't one?)

Copy link
Author

Choose a reason for hiding this comment

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

Ended up returning an error. Please make sure I did that correctly :)

<var>element<var> and <var>element</var>'s <a data-cite="HTML#form-owner">form owner</a>,
while taking into account the contents of the <a>current top-level browsing context</a>'s
<a>autofill store for testing</a>.

</section> <!-- /Trigger autofill -->

</section> <!-- /Autofill -->

<section class=appendix>
<h2>Privacy</h2>
Expand Down
Loading