@@ -3747,7 +3747,8 @@ defined here as the model defined in HTTP is not compatible with web content. [[
3747
3747
<div algorithm>
3748
3748
<p> To
3749
3749
<dfn export for="header list" lt="extract a MIME type|extracting a MIME type" id=concept-header-extract-mime-type>extract a MIME type</dfn>
3750
- from a <a for=/>header list</a> <var> headers</var> , run these steps:
3750
+ from a <a for=/>header list</a> <var> headers</var> , run these steps. They return failure or a
3751
+ <a for=/>MIME type</a> .
3751
3752
3752
3753
<ol>
3753
3754
<li><p> Let <var> charset</var> be null.
@@ -4773,7 +4774,7 @@ steps:
4773
4774
<a for="header list">extracting a MIME type</a> from <var> response</var> 's
4774
4775
<a for=response>header list</a> .
4775
4776
4776
- <li><p> If <var> mimeType</var> is non-null , then set <var> bodyInfo</var> 's
4777
+ <li><p> If <var> mimeType</var> is not failure , then set <var> bodyInfo</var> 's
4777
4778
<a for="response body info">content type</a> to the result of
4778
4779
<a>minimizing a supported MIME type</a> given <var> mimeType</var> .
4779
4780
</ol>
@@ -7138,10 +7139,6 @@ HTML, will likely not be exposed here. Rather, an HTML parser API might accept a
7138
7139
due course.
7139
7140
<!-- https://lists.w3.org/Archives/Public/public-whatwg-archive/2014Jun/thread.html#msg72 -->
7140
7141
7141
- <p> Objects including the {{Body}} interface mixin need to define an associated
7142
- <dfn id=concept-body-mime-type for=Body>MIME type</dfn> algorithm which takes no arguments and
7143
- returns failure or a <a for=/>MIME type</a> .
7144
-
7145
7142
<p> Objects including the {{Body}} interface mixin have an associated
7146
7143
<dfn id=concept-body-body for=Body>body</dfn> (null or a <a for=/>body</a> ).
7147
7144
@@ -7177,6 +7174,28 @@ returns failure or a <a for=/>MIME type</a>.
7177
7174
7178
7175
<hr>
7179
7176
7177
+ <div algorithm>
7178
+ <p> To <dfn id=concept-body-mime-type for=Body>get the MIME type</dfn> , given a {{Request}} or
7179
+ {{Response}} object <var> requestOrResponse</var> :
7180
+
7181
+ <ol>
7182
+ <li><p> Let <var> headers</var> be null.
7183
+
7184
+ <li><p> If <var> requestOrResponse</var> is a {{Request}} object, then set <var> headers</var> to
7185
+ <var> requestOrResponse</var> 's <a for=Request>request</a>' s <a for=request>header list</a> .
7186
+
7187
+ <li><p> Otherwise, set <var> headers</var> to <var> requestOrResponse</var> 's
7188
+ <a for=Response>response</a> 's <a for=response>header list</a> .
7189
+
7190
+ <li><p> Let <var> mimeType</var> be the result of <a for="header list">extracting a MIME type</a>
7191
+ from <var> headers</var> .
7192
+
7193
+ <li><p> If <var> mimeType</var> is failure, then return null.
7194
+
7195
+ <li><p> Return <var> mimeType</var> .
7196
+ </ol>
7197
+ </div>
7198
+
7180
7199
<div algorithm>
7181
7200
<p> The <dfn attribute for=Body><code>body</code></dfn> getter steps are to return null if
7182
7201
<a>this</a> 's <a for=Body>body</a> is null; otherwise <a>this</a>' s <a for=Body>body</a> 's
@@ -7233,69 +7252,76 @@ of running <a for=Body>consume body</a> with <a>this</a> and the following step
7233
7252
<p> The <dfn method for=Body><code>blob()</code></dfn> method steps are to return the result
7234
7253
of running <a for=Body>consume body</a> with <a>this</a> and the following step given a
7235
7254
<a for=/>byte sequence</a> <var> bytes</var> : return a {{Blob}} whose contents are <var> bytes</var>
7236
- and whose {{Blob/type}} attribute is <a>this</a> 's <a for=Body>MIME type</a> .
7255
+ and whose {{Blob/type}} attribute is the result of <a for=Body>get the MIME type</a> with
7256
+ <a>this</a> .
7257
+ <!-- This is wrong. It should really set an underlying concept to this. -->
7237
7258
</div>
7238
7259
7239
7260
<div algorithm>
7240
7261
<p> The <dfn method for=Body><code>formData()</code></dfn> method steps are to return the result of
7241
7262
running <a for=Body>consume body</a> with <a>this</a> and the following step given a
7242
- <a for=/>byte sequence</a> <var> bytes</var> : switch on <a>this</a> 's <a for=Body>MIME type</a>' s
7243
- <a for="MIME type">essence</a> and run the corresponding steps:
7263
+ <a for=/>byte sequence</a> <var> bytes</var> :
7244
7264
7245
- <dl class=switch>
7246
- <dt> "<code> multipart/form-data</code> ",
7247
- <dd>
7248
- <ol>
7249
- <li>
7250
- <p> Parse <var> bytes</var> , using the value of the `<code> boundary</code> ` parameter from
7251
- <a>this</a> 's <a for=Body>MIME type</a> , per the rules set forth in
7252
- <cite> Returning Values from Forms: multipart/form-data</cite> . [[!RFC7578]] </p>
7253
-
7254
- <p> Each part whose `<code> Content-Disposition</code> ` header contains a `<code> filename</code> `
7255
- parameter must be parsed into an <a for="entry list">entry</a> whose value is a {{File}} object
7256
- whose contents are the contents of the part. The {{File/name}} attribute of the {{File}} object
7257
- must have the value of the `<code> filename</code> ` parameter of the part. The {{Blob/type}}
7258
- attribute of the {{File}} object must have the value of the `<code> Content-Type</code> ` header
7259
- of the part if the part has such header, and `<code> text/plain</code> ` (the default defined by
7260
- [[!RFC7578]] section 4.4) otherwise.</p>
7261
-
7262
- <p> Each part whose `<code> Content-Disposition</code> ` header does not contain a
7263
- `<code> filename</code> ` parameter must be parsed into an <a for="entry list">entry</a> whose
7264
- value is the <a lt="UTF-8 decode without BOM">UTF-8 decoded without BOM</a> content of the part.
7265
- <span class=note> This is done regardless of the presence or the value of a
7266
- `<code> Content-Type</code> ` header and regardless of the presence or the value of a
7267
- `<code> charset</code> ` parameter.</span></p>
7268
-
7269
- <p class=note> A part whose `<code> Content-Disposition</code> ` header contains a
7270
- `<code> name</code> ` parameter whose value is `<code> _charset_</code> ` is parsed like any other
7271
- part. It does not change the encoding.</p>
7272
- </li>
7273
-
7274
- <li><p> If that fails for some reason, then <a>throw</a> a {{TypeError}} .
7275
-
7276
- <li><p> Return a new {{FormData}} object, appending each <a for="entry list">entry</a> , resulting
7277
- from the parsing operation, to its <a for=FormData>entry list</a> .
7278
- </ol>
7265
+ <ol>
7266
+ <li><p> Let <var> mimeType</var> be the result of <a for=Body>get the MIME type</a> with <a>this</a> .
7279
7267
7280
- <p class=XXX> The above is a rough approximation of what is needed for
7281
- ` <code> multipart/form-data </code> `, a more detailed parsing specification is to be
7282
- written. Volunteers welcome.
7268
+ <li>
7269
+ <p> If <var> mimeType </var> is non-null, then switch on <var> mimeType </var> 's
7270
+ <a for="MIME type">essence</a> and run the corresponding steps:
7283
7271
7284
- <dt> "<code> application/x-www-form-urlencoded</code> ",
7285
- <dd>
7286
- <ol>
7287
- <li><p> Let <var> entries</var> be the result of <a lt="urlencoded parser">parsing</a>
7288
- <var> bytes</var> .
7272
+ <dl class=switch>
7273
+ <dt> "<code> multipart/form-data</code> "
7274
+ <dd>
7275
+ <ol>
7276
+ <li>
7277
+ <p> Parse <var> bytes</var> , using the value of the `<code> boundary</code> ` parameter from
7278
+ <var> mimeType</var> , per the rules set forth in
7279
+ <cite> Returning Values from Forms: multipart/form-data</cite> . [[!RFC7578]]
7280
+
7281
+ <p> Each part whose `<code> Content-Disposition</code> ` header contains a
7282
+ `<code> filename</code> ` parameter must be parsed into an <a for="entry list">entry</a> whose
7283
+ value is a {{File}} object whose contents are the contents of the part. The {{File/name}}
7284
+ attribute of the {{File}} object must have the value of the `<code> filename</code> ` parameter
7285
+ of the part. The {{Blob/type}} attribute of the {{File}} object must have the value of the
7286
+ `<code> Content-Type</code> ` header of the part if the part has such header, and
7287
+ `<code> text/plain</code> ` (the default defined by [[!RFC7578]] section 4.4) otherwise.
7288
+
7289
+ <p> Each part whose `<code> Content-Disposition</code> ` header does not contain a
7290
+ `<code> filename</code> ` parameter must be parsed into an <a for="entry list">entry</a> whose
7291
+ value is the <a lt="UTF-8 decode without BOM">UTF-8 decoded without BOM</a> content of the
7292
+ part. <span class=note> This is done regardless of the presence or the value of a
7293
+ `<code> Content-Type</code> ` header and regardless of the presence or the value of a
7294
+ `<code> charset</code> ` parameter.</span>
7295
+
7296
+ <p class=note> A part whose `<code> Content-Disposition</code> ` header contains a
7297
+ `<code> name</code> ` parameter whose value is `<code> _charset_</code> ` is parsed like any other
7298
+ part. It does not change the encoding.
7299
+
7300
+ <li><p> If that fails for some reason, then <a>throw</a> a {{TypeError}} .
7301
+
7302
+ <li><p> Return a new {{FormData}} object, appending each <a for="entry list">entry</a> ,
7303
+ resulting from the parsing operation, to its <a for=FormData>entry list</a> .
7304
+ </ol>
7289
7305
7290
- <li><p> If <var> entries</var> is failure, then <a>throw</a> a {{TypeError}} .
7306
+ <p class=XXX> The above is a rough approximation of what is needed for
7307
+ `<code> multipart/form-data</code> `, a more detailed parsing specification is to be written.
7308
+ Volunteers welcome.
7291
7309
7292
- <li><p> Return a new {{FormData}} object whose <a for=FormData>entry list</a> is
7293
- <var> entries</var> .
7294
- </ol>
7310
+ <dt> "<code> application/x-www-form-urlencoded</code> "
7311
+ <dd>
7312
+ <ol>
7313
+ <li><p> Let <var> entries</var> be the result of <a lt="urlencoded parser">parsing</a>
7314
+ <var> bytes</var> .
7295
7315
7296
- <dt> Otherwise
7297
- <dd><p> <a>Throw</a> a {{TypeError}} .
7298
- </dl>
7316
+ <li><p> If <var> entries</var> is failure, then <a>throw</a> a {{TypeError}} .
7317
+
7318
+ <li><p> Return a new {{FormData}} object whose <a for=FormData>entry list</a> is
7319
+ <var> entries</var> .
7320
+ </ol>
7321
+ </dl>
7322
+
7323
+ <li><p> <a>Throw</a> a {{TypeError}} .
7324
+ </ol>
7299
7325
</div>
7300
7326
7301
7327
<div algorithm>
@@ -7387,10 +7413,6 @@ omitted from <a enum><code>RequestMode</code></a> as it cannot be used nor obser
7387
7413
<p> A {{Request}} object has an associated <dfn for=Request>signal</dfn> (null or an {{AbortSignal}}
7388
7414
object), initially null.
7389
7415
7390
- <p> A {{Request}} object's <a for=Body>MIME type</a> is to return the result of
7391
- <a for="header list">extracting a MIME type</a> from its <a for=Request>request</a> 's
7392
- <a for=request>header list</a> .
7393
-
7394
7416
<p> A {{Request}} object's <a for=Body>body</a> is its
7395
7417
<a for=Request>request</a> 's
7396
7418
<a for=request>body</a> .
@@ -8078,10 +8100,6 @@ enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredire
8078
8100
<p> A {{Response}} object also has an associated <dfn for=Response export>headers</dfn> (null or a
8079
8101
{{Headers}} object), initially null.
8080
8102
8081
- <p> A {{Response}} object's <a for=Body>MIME type</a> is to return the result of
8082
- <a for="header list">extracting a MIME type</a> from its <a for=Response>response</a> 's
8083
- <a for=response>header list</a> .
8084
-
8085
8103
<p> A {{Response}} object's <a for=Body>body</a> is its
8086
8104
<a for=Response>response</a> 's <a for=response>body</a> .
8087
8105
@@ -8978,6 +8996,7 @@ Brad Porter,
8978
8996
Bryan Smith,
8979
8997
Caitlin Potter,
8980
8998
Cameron McCormack,
8999
+ 白丞祐 (Cheng-You Bai)<!-- CYBAI; GitHub -->,
8981
9000
Chirag S Kumar<!-- fictionistique; GitHub -->,
8982
9001
Chris Needham,
8983
9002
Chris Rebert,
0 commit comments