Permalink
Browse files

Move _charset_ handling to construct the form data set

This makes the algorithms match Chrome, Firefox, and Safari.

Change to the URL Standard: whatwg/url#382.

Tests: web-platform-tests/wpt#10623.

Fixes #3560.
  • Loading branch information...
tkent-google authored and annevk committed Apr 27, 2018
1 parent 3072f1d commit 8c212e549607a41b6d40d953b47d9f3e749533f3
Showing with 27 additions and 30 deletions.
  1. +27 −30 source
View
57 source
@@ -55852,12 +55852,12 @@ fur
<!-- unlock -->
<li><p>Let <var>form data set</var> be the result of <span>constructing the form data
set</span> for <var>form</var> in the context of <var>submitter</var>.</p></li>
<li><p>Let <var>encoding</var> be the result of <span>picking an encoding for the
form</span>.</p>
<li><p>Let <var>form data set</var> be the result of <span>constructing the form data
set</span> with <var>form</var>, <var>submitter</var>, and <var>encoding</var>.</p></li>
<li><p>Let <var>action</var> be the <var>submitter</var> element's <span
data-x="concept-fs-action">action</span>.</p></li>
@@ -56050,7 +56050,7 @@ fur
<dd>
<p>Let <var>body</var> be the result of running the <span><code data-x="">text/plain</code>
encoding algorithm</span> with <var>form data set</var> and <var>encoding</var>.</p>
encoding algorithm</span> with <var>form data set</var>.</p>
<p>Set <var>body</var> to the result of <span data-x="encode">encoding</span>
<var>body</var> using <var>encoding</var>.</p>
@@ -56100,9 +56100,8 @@ fur
<dt><code data-x="attr-fs-enctype-text">text/plain</code></dt>
<dd>
<p>Let <var>body</var> be the result of running the <span><code
data-x="">text/plain</code> encoding algorithm</span> with <var>form data set</var> and
<var>encoding</var>.</p>
<p>Let <var>body</var> be the result of running the <span><code data-x="">text/plain</code>
encoding algorithm</span> with <var>form data set</var>.</p>
<p>Set <var>body</var> to the result of concatenating the result of <span data-x="UTF-8
percent encode">UTF-8 percent encoding</span> each code point in <var>body</var>, using the
@@ -56168,9 +56167,9 @@ fur
<h5 id="constructing-form-data-set">Constructing the form data set</h5>
<p>The algorithm to <dfn data-x="constructing the form data set" data-export=""
data-lt="constructing the form data set">construct the form data set</dfn> for a form
<var>form</var> optionally in the context of a submitter <var>submitter</var> is as follows. If
not specified otherwise, <var>submitter</var> is null.</p>
data-lt="constructing the form data set">construct the form data set</dfn> given a form
<var>form</var>, an optional submitter <var>submitter</var>, and an optional <var>encoding</var>,
is as follows. If not specified otherwise, <var>submitter</var> is null.</p>
<ol>
@@ -56311,6 +56310,22 @@ fur
name, the returned form submission value as the value, and the string "<code
data-x="">object</code>" as the type.</p></li>
<li>
<p>Otherwise, if the <var>field</var> element is an <code>input</code> element whose <code
data-x="attr-input-type">type</code> attribute is in the <span
data-x="attr-input-type-hidden">Hidden</span> state and <var>name</var> is "<code
data-x="attr-fe-name-charset">_charset_</code>":</p>
<ol>
<li><p>Let <var>charset</var> be the <span data-x="encoding name">name</span> of
<var>encoding</var> if <var>encoding</var> is given, and "<code data-x="">UTF-8</code>"
otherwise.</p></li>
<li><p>Append an entry to the <var>form data set</var> with <var>name</var> as the name,
<var>charset</var> as the value, and <var>type</var> as the type.</p></li>
</ol>
</li>
<li><p>Otherwise, append an entry to the <var>form data set</var> with <var>name</var> as the name, the <span data-x="concept-fe-value">value</span> of the <var>field</var> element as the value, and <var>type</var> as the type.</p></li>
<li>
@@ -56436,18 +56451,12 @@ fur
<li><p>Let <var>result</var> be the empty string.</p></li>
<li><p>Let <var>charset</var> be the <span data-x="encoding name">name</span> of
<var>encoding</var>.</p></li>
<li>
<p>For each entry in the <var>form data set</var>:</p>
<ol>
<li><p>If the entry's name is "<code data-x="attr-fe-name-charset">_charset_</code>" and its
type is "<code data-x="">hidden</code>", replace its value with <var>charset</var>.</p></li>
<!-- the step that replaces a file with its name is missing in
this version of the algorithm -->
@@ -56505,24 +56514,15 @@ fur
<div w-nodev>
<p>The <dfn><code data-x="">text/plain</code> encoding algorithm</dfn>, given a <var>form data
set</var> and <var>encoding</var>, is as follows:</p>
set</var>, is as follows:</p>
<ol>
<li><p>Let <var>result</var> be the empty string.</p></li>
<li><p>Let <var>charset</var> be the <span data-x="encoding name">name</span> of
<var>encoding</var>.</p></li>
<li>
<p>For each entry in the <var>form data set</var>:</p>
<ol>
<li><p>If the entry's name is "<code data-x="attr-fe-name-charset">_charset_</code>" and its
type is "<code data-x="">hidden</code>", replace its value with <var>charset</var>.</p></li>
<li><p>If the entry's type is "<code data-x="">file</code>", replace its value with the file's
name only.</p></li>
@@ -56533,13 +56533,10 @@ fur
<li><p>Append the entry's value to <var>result</var>.</p></li>
<li><p>Append a U+000D CARRIAGE RETURN (CR) U+000A LINE FEED (LF) character pair to <var>result</var>.</p></li>
</ol>
</li>
<li><p>Return <var>result</var>.</p></li>
</ol>
</div>
@@ -121443,7 +121440,7 @@ INSERT INTERFACES HERE
Takayoshi Kochi,
Takeshi Yoshino,
<span data-x="" lang="tr">Tantek &Ccedil;elik</span>,
&#30000;&#26449;&#20581;&#20154; (TAMURA Kent),
田村健人 (Kent TAMURA),
Taylor Hunt,
Ted Mielczarek,
Terrence Wood,

0 comments on commit 8c212e5

Please sign in to comment.