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

Fix collection serialization and support collection types found in the wild #1340

Merged
merged 4 commits into from
Nov 5, 2018
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
90 changes: 63 additions & 27 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -214,23 +214,24 @@ <h3>Dependencies</h3>
<dt>ECMAScript
<dd><p>The following terms are defined in the ECMAScript Language Specification: [[!ECMA-262]]
<ul>
<!-- Iterable --> <li><dfn><a href=https://tc39.github.io/ecma262/#sec-iterable-interface>Iterable</a></dfn>
<!-- Completion --> <li><dfn><a href="https://tc39.github.io/ecma262/#sec-completion-record-specification-type">Completion</a></dfn>
<!-- CreateResolvingFunctions --> <li><dfn><a href=https://tc39.github.io/ecma262/#sec-createresolvingfunctions>CreateResolvingFunctions</a></dfn>
<!-- Directive prologue --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-14.1>Directive prologue</a></dfn>
<!-- Early error --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-16>Early error</a></dfn>
<!-- Function --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-4.3.24>Function</a></dfn>
<!-- FunctionCreate --> <li><dfn><a href=https://tc39.github.io/ecma262/#sec-functioncreate>FunctionCreate</a></dfn>
<!-- FunctionBody --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-13>FunctionBody</a></dfn>
<!-- FunctionCreate --> <li><dfn><a href=https://tc39.github.io/ecma262/#sec-functioncreate>FunctionCreate</a></dfn>
<!-- Get --> <li><dfn><a href=https://tc39.github.io/ecma262/#sec-get-o-p>Get</a></dfn>
<!-- Global environment --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-10.2.3>Global environment</a></dfn>
<!-- IsCallable --> <li><dfn><a href=https://tc39.github.io/ecma262/#sec-iscallable>IsCallable</a></dfn>
<!-- Own property --> <li><dfn data-lt="own properties"><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-4.3.30>Own property</a></dfn>
<!-- parseFloat --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.2.3>parseFloat</a></dfn>
<!-- Promise --> <li><dfn><a href=https://tc39.github.io/ecma262/#sec-promise-constructor>Promise</a></dfn>
<!-- PromiseResolve --> <li><dfn><a href=https://tc39.github.io/ecma262/#sec-promise-resolve>PromiseResolve</a></dfn>
<!-- realm --> <li><dfn><a href="https://tc39.github.io/ecma262/#sec-code-realms">realm</a></dfn>
<!-- Type --> <li><dfn data-lt="ecmascript type" data-lt-noDefault><a href=https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values>Type</a></dfn>
<!-- Use strict directive --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-14.1>Use strict directive</a></dfn>
<!-- parseFloat --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.2.3>parseFloat</a></dfn>
<!-- realm --> <li><dfn><a href="https://tc39.github.io/ecma262/#sec-code-realms">realm</a></dfn>
</ul>

<dd>This specification also presumes that you are able to call
Expand Down Expand Up @@ -280,6 +281,12 @@ <h3>Dependencies</h3>
<!-- Status message --> <li><dfn><a href=https://fetch.spec.whatwg.org/#concept-response-status-message>Status message</a></dfn>
</ul>

<dt>File
<dd><p>The following interfaces are defined in the W3C File API specification: [[!FILEAPI]]
<ul>
<!-- FileList --> <li><dfn><a href=https://w3c.github.io/FileAPI/#dfn-filelist><code>FileList</code></a></dfn>
</ul>

<dt>Fullscreen
<dd><p>The following terms are defined in the WHATWG Fullscreen specification: [[!FULLSCREEN]]
<ul>
Expand Down Expand Up @@ -331,6 +338,9 @@ <h3>Dependencies</h3>
<!-- Focusing steps --> <li><dfn><a href="https://html.spec.whatwg.org/#focusing-steps">Focusing steps</a></dfn>
<!-- Fousable area --><li><dfn><a href=https://html.spec.whatwg.org/#focusable-area>Focusable area</a></dfn>
<!-- GetOwnProperty of a Window object --> <li><dfn data-lt="window.[[\getOwnProperty]]"><a href=https://html.spec.whatwg.org/#windowproxy-getownproperty><code>[[\GetOwnProperty]]</code> of a <code>Window</code> object</a></dfn>
<!-- HTMLAllCollection --> <li><dfn><a href=https://html.spec.whatwg.org/#htmlallcollection><code>HTMLAllCollection</code></a></dfn>
<!-- HTMLFormControlCollection --> <li><dfn><a href=https://html.spec.whatwg.org/#htmlformcontrolscollection><code>HTMLFormControlsCollection</code></a></dfn>
<!-- HTMLOptionsCollection --> <li><dfn><a href=https://html.spec.whatwg.org/#htmloptionscollection><code>HTMLOptionsCollection</code></a></dfn>
<!-- Hidden --> <li><dfn><a href="https://html.spec.whatwg.org/#hidden-state-%28type=hidden%29">Hidden</a></dfn> state
<!-- Image Button --> <li><dfn><a href="https://html.spec.whatwg.org/#image-button-state-%28type=image%29">Image Button</a></dfn> state
<!-- In parallel --> <li><dfn><a href="https://html.spec.whatwg.org/#in-parallel">In parallel</a></dfn>
Expand Down Expand Up @@ -6324,10 +6334,27 @@ <h3><dfn>Get Page Source</dfn></h3>
<section>
<h3>Executing Script</h3>

<p>When required to <dfn>JSON deserialize</dfn>
with argument <var>value</var>
and optional argument <var>seen</var>,
a <a>remote end</a> must run the following steps:
<p>
A <dfn>collection</dfn> is an <a>Object</a>
that implements the <a>Iterable</a> interface,
and whose:

<ul>
<li><a>initial value</a> of the <code>toString</code> <a>own property</a> is <code>Arguments</code>
<li>type is <a>Array</a>
<li>type is <a><code>FileList</code></a>
<li>type is <a><code>HTMLAllCollection</code></a>
<li>type is <a><code>HTMLCollection</code></a>
<li>type is <a><code>HTMLFormControlsCollection</code></a>
<li>type is <a><code>HTMLOptionsCollection</code></a>
<li>type is <a><code>NodeList</code></a>
</ul>

<p>
When required to <dfn>JSON deserialize</dfn>
with argument <var>value</var>
and optional argument <var>seen</var>,
a <a>remote end</a> must run the following steps:

<ol>
<li><p>If <var>seen</var> is not provided,
Expand Down Expand Up @@ -6376,13 +6403,31 @@ <h3>Executing Script</h3>
<dt>type <a>String</a>
<dd><p><a>Success</a> with data <var>value</var>.

<p>Otherwise, return <a>success</a>
with the <a data-lt="JSON serialization of an element">serialization to JSON</a>
of the <a>web element</a> <var>value</var>.

<dt>a <a>collection</a>
<dd>
<ol>
<li><p>Let <var>result list</var> be an empty list.

<li><p>For each <var>item</var> of <var>value</var>,
add the result of <a>trying</a> to <a>clone an object</a>
with arguments <var>item</var> and <var>seen</var>
and the <a>internal JSON clone algorithm</a> as the <var>clone algorithm</var>
to <var>result list</var>.

<li><p>Return <a>success</a> with <var>result list</var>.
</ol>

<dt>instance of <a>element</a>
<dd><p>If the <var>element</var> <a>is stale</a>,
return <a>error</a> with <a>error code</a> <a>stale element reference</a>.

<p>Otherwise, return <a>success</a>
with the <a data-lt="JSON serialization of an element">serialization to JSON</a>
of the <a>web element</a> <var>value</var>.
<p>Otherwise return <a>success</a>
with the <a data-lt="JSON serialization of an element">JSON serialization</a>
of <var>value</var>.

<dt>a <a><code>WindowProxy</code></a> object
<dd><p>If the associated <a>browsing context</a>
Expand All @@ -6391,13 +6436,15 @@ <h3>Executing Script</h3>
return <a>error</a> with <a>error code</a> <a>stale element reference</a>.

<p>Otherwise return <a>success</a>
with the <a>JSON serialization of the <code>WindowProxy</code> object</a>
with the <a data-lt="JSON serialization of the WindowProxy object">JSON serialization</a>
of <var>value</var>.

<dt>instance of <a>NodeList</a>
<dt>instance of <a>HTMLCollection</a>
<dt>instance of <a>Array</a>
<dt>instance of <a>Object</a>
<dt>has an <a>own property</a> named "<code>toJSON</code>" that is
a <a>Function</a>
<dd>Return <a>success</a> with the value returned by
<a>Call</a>(<code>toJSON</code>).

<dt>Otherwise</dt>
<dd>
<ol>
<li><p>If <var>value</var> is in <var>seen</var>,
Expand All @@ -6414,15 +6461,6 @@ <h3>Executing Script</h3>

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

<dt>has an <a>own property</a> named "<code>toJSON</code>" that is
a <a>Function</a>
<dd>Return <a>success</a> with the value returned by
<a>Call</a>(<code>toJSON</code>).

<dt>Otherwise</dt>
<dd><p><a>Error</a> with <a>error code</a> <a>javascript error</a>.
</dl>

<p>To <dfn>clone an object</dfn>,
Expand All @@ -6435,9 +6473,7 @@ <h3>Executing Script</h3>
matching on <var>value</var>:

<dl class=switch>
<dt>instance of <a>NodeList</a>
<dt>instance of <a>HTMLCollection</a>
<dt>instance of <a>Array</a>
<dt>a <a>collection</a>
<dd><p>A new <a>Array</a>
which <code>length</code> property is equal
to the result of <a>getting the property</a> <code>length</code>
Expand Down