@@ -495,6 +495,7 @@ methods, when invoked, must run these steps:
495
495
<a>network error</a> .
496
496
<li><p> Set <a>received bytes</a> to the empty byte sequence.
497
497
<li><p> Set <a>response object</a> to null.
498
+ <li><p> Set <a>override MIME type</a> to null.
498
499
</ul>
499
500
500
501
<li>
@@ -1299,19 +1300,32 @@ transfer-encoding: chunked</code></pre>
1299
1300
<li><p> Return <var> mimeType</var> .
1300
1301
</ol>
1301
1302
1302
- <p> The <dfn id=override-mime-type>override MIME type</dfn> is initially null and can get a value if
1303
- {{overrideMimeType()}} is invoked. <dfn id=final-mime-type>Final MIME type</dfn> is the
1303
+ <p> The <dfn id=override-mime-type>override MIME type</dfn> is initially null and can get a value
1304
+ when {{overrideMimeType()}} is invoked. The <dfn id=final-mime-type>final MIME type</dfn> is the
1304
1305
<a>override MIME type</a> unless that is null in which case it is the <a>response MIME type</a> .
1305
1306
1306
- <p> The <dfn id=response-charset>response charset</dfn> is the value of
1307
- the <code> charset</code> parameter of the `<code> Content-Type</code> ` header
1308
- or null if there was no `<code> charset</code> ` parameter or the header could
1309
- not be parsed or was omitted. The
1310
- <dfn id=override-charset>override charset</dfn> is initially null and
1311
- can get a value if <a><code>overrideMimeType()</code></a> is invoked.
1312
- <dfn id=final-charset>Final charset</dfn> is the
1313
- <a>override charset</a> unless
1314
- that is null in which case it is the <a>response charset</a> .
1307
+ <p> The <dfn id=final-charset>final charset</dfn> is the return value of these steps:
1308
+
1309
+ <ol>
1310
+ <li><p> Let <var> label</var> be null.
1311
+
1312
+ <li><p> If <a>response MIME type</a> 's <a for="MIME type">parameters</a> ["<code>charset</code>"]
1313
+ <a for=map>exists</a> , then set <var> label</var> to it.
1314
+
1315
+ <li><p> If <a>override MIME type</a> 's <a for="MIME type">parameters</a> ["<code>charset</code>"]
1316
+ <a for=map>exists</a> , then set <var> label</var> to it.
1317
+
1318
+ <li><p> If <var> label</var> is null, then return null.
1319
+
1320
+ <li><p> Let <var> encoding</var> be the result of <a>getting an encoding</a> from <var> label</var> .
1321
+
1322
+ <li><p> If <var> encoding</var> is failure, then return null.
1323
+
1324
+ <li><p> Return <var> encoding</var> .
1325
+ </ol>
1326
+
1327
+ <p class=note> The above steps intentionally do not use the <a>final MIME type</a> as it would yield
1328
+ the wrong result.
1315
1329
1316
1330
<hr>
1317
1331
@@ -1336,7 +1350,7 @@ or null). Unless stated otherwise it is null.
1336
1350
1337
1351
<ol>
1338
1352
<li><p> Set <a>response object</a> to a new {{Blob}} object representing <a>received bytes</a> with
1339
- {{Blob/type}} <a>final MIME type</a> .
1353
+ {{Blob/type}} set to the <a>final MIME type</a> .
1340
1354
1341
1355
<li><p> Return <a>response object</a> .
1342
1356
</ol>
@@ -1348,11 +1362,11 @@ or null). Unless stated otherwise it is null.
1348
1362
<li><p> If <a>response</a> 's
1349
1363
<a for=response>body</a> is null, then return null.
1350
1364
1351
- <li><p> If <a>final MIME type</a> is not an <a>HTML MIME type</a> or an <a>XML MIME type</a> , then
1352
- return null.
1365
+ <li><p> If the <a>final MIME type</a> is not an <a>HTML MIME type</a> or an <a>XML MIME type</a> ,
1366
+ then return null.
1353
1367
1354
1368
<li>
1355
- <p> If {{XMLHttpRequest/responseType}} is the empty string and <a>final MIME type</a> is an
1369
+ <p> If {{XMLHttpRequest/responseType}} is the empty string and the <a>final MIME type</a> is an
1356
1370
<a>HTML MIME type</a> , then return null.
1357
1371
1358
1372
<p class=note> This is restricted to
@@ -1361,7 +1375,7 @@ or null). Unless stated otherwise it is null.
1361
1375
content.
1362
1376
1363
1377
<li>
1364
- <p> If <a>final MIME type</a> is an <a>HTML MIME type</a> , then run these substeps :
1378
+ <p> If the <a>final MIME type</a> is an <a>HTML MIME type</a> , then:
1365
1379
1366
1380
<ol>
1367
1381
<li><p> Let <var> charset</var> be the <a>final charset</a> .
@@ -1406,7 +1420,7 @@ or null). Unless stated otherwise it is null.
1406
1420
<a for=Document>encoding</a> to
1407
1421
<var> charset</var> .
1408
1422
1409
- <li><p> Set <var> document</var> 's <a>content type</a> to <a>final MIME type</a> .
1423
+ <li><p> Set <var> document</var> 's <a>content type</a> to the <a>final MIME type</a> .
1410
1424
1411
1425
<li><p> Set <var> document</var> 's
1412
1426
<a for=Document>URL</a> to
@@ -1445,7 +1459,7 @@ or null). Unless stated otherwise it is null.
1445
1459
<li><p> Let <var> charset</var> be the <a>final charset</a> .
1446
1460
1447
1461
<li>
1448
- <p> If {{XMLHttpRequest/responseType}} is the empty string, <var> charset</var> is null, and
1462
+ <p> If {{XMLHttpRequest/responseType}} is the empty string, <var> charset</var> is null, and the
1449
1463
<a>final MIME type</a> is an <a>XML MIME type</a> , then use the rules set forth in the XML
1450
1464
specifications to determine the encoding. Let <var> charset</var> be the determined encoding.
1451
1465
[[!XML]] [[!XMLNS]]
@@ -1474,28 +1488,25 @@ resources using <a>utf-8</a>.
1474
1488
<dl class=domintro>
1475
1489
<dt><code><var> client</var> . <a method for=XMLHttpRequest>overrideMimeType(<var>mime</var>)</a> </code>
1476
1490
<dd>
1477
- <p> Acts as if the `<code> Content-Type</code> ` header for <a>response</a> is <var> mime</var> .
1491
+ <p> Acts as if the `<code> Content-Type</code> ` header value for <a>response</a> is <var> mime</var> .
1492
+ (It does not actually change the header though.)
1478
1493
1479
1494
<p> Throws an "{{InvalidStateError!!exception}} " {{DOMException}} if <a>state</a> is <i> loading</i>
1480
1495
or <i> done</i> .
1481
1496
</dl>
1482
1497
1483
- <p> The
1484
- <dfn method for=XMLHttpRequest><code>overrideMimeType(<var>mime</var>)</code></dfn>
1485
- method must run these steps:
1498
+ <p> The <dfn method for=XMLHttpRequest><code>overrideMimeType(<var>mime</var>)</code></dfn> method,
1499
+ when invoked, must run these steps:
1486
1500
1487
1501
<ol>
1488
1502
<li><p> If <a>state</a> is <i> loading</i> or <i> done</i> , then <a>throw</a> an
1489
1503
"{{InvalidStateError!!exception}} " {{DOMException}} .
1490
1504
1491
- <li><p> Set <a>override MIME type</a> to `<code> application/octet-stream</code> `.
1492
-
1493
- <li><p> If <var> mime</var> is a <a>parsable MIME type</a> , then set <a>override MIME type</a> to its
1494
- <a>MIME type portion</a> .
1495
- <!-- XXX Ignore string to byte sequence conversion issues until some point in the future -->
1505
+ <li><p> Set <a>override MIME type</a> to the result of <a lt="parse a MIME type">parsing</a>
1506
+ <var> mime</var> .
1496
1507
1497
- <li><p> If <a>override MIME type</a> has a ` <code> charset </code> ` parameter, then set
1498
- <a>override charset</a> to its value .
1508
+ <li><p> If <a>override MIME type</a> is failure, then set <a>override MIME type</a> to
1509
+ <code> application/octet-stream </code> .
1499
1510
</ol>
1500
1511
1501
1512
0 commit comments