Bug 1452941 [wpt PR 8422] - Adjust XMLHttpRequest Content-Type handling, a=testonly
authorAnne van Kesteren <annevk@annevk.nl>
Wed, 25 Apr 2018 18:46:43 +0000
changeset 415792 be93580d93e3b6e94946124f06c188bc8daac745
parent 415791 b0741467f091642d4789857bdb27570e1591f931
child 415793 c21c88194b9120b704a3ef6670abfd6ab0bcb7cf
push id33910
push usershindli@mozilla.com
push dateThu, 26 Apr 2018 21:39:52 +0000
treeherdermozilla-central@63a0e2f626fe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1452941
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1452941 [wpt PR 8422] - Adjust XMLHttpRequest Content-Type handling, a=testonly Automatic update from web-platform-testsAdjust XMLHttpRequest Content-Type handling See https://github.com/whatwg/xhr/pull/176 and https://github.com/whatwg/mimesniff/pull/36. -- wpt-commits: 84e7972a0518fb57f39740143d4b63e79b14e9f4 wpt-pr: 8422
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/xhr/send-content-type-charset.htm
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -503304,21 +503304,21 @@
    "1cde22de011c102163c14a44ac686e97e075b934",
    "testharness"
   ],
   "css/css-fonts/variations/font-opentype-collections.html": [
    "6ef4e5f8931764e1609a7e2c0ccde63092d7c4fc",
    "testharness"
   ],
   "css/css-fonts/variations/font-parse-numeric-stretch-style-weight.html": [
-   "1e116cfb42e4e52fd714ec07c5bce6b9d5dceeda",
+   "ea344025ce1b4da7d1a98e4900de1a290411ba3c",
    "testharness"
   ],
   "css/css-fonts/variations/font-shorthand.html": [
-   "7e193d5e25424699652e64b419e1d1384370e3a4",
+   "15ad8424f678761d0e48b1924fb0baa7a718cbca",
    "testharness"
   ],
   "css/css-fonts/variations/font-stretch.html": [
    "b6d7409267cba17569ddd1caa654f3ab515e85eb",
    "testharness"
   ],
   "css/css-fonts/variations/font-style-interpolation.html": [
    "97f4993c16ac98cf7322b033b75f795d2e1839e0",
@@ -577300,17 +577300,17 @@
    "59bd8e2c3c1bf8fded9a5523b5bd3b59761eacef",
    "support"
   ],
   "interfaces/cssom-view.idl": [
    "3f575def818098d376ddf069673692530fcf8896",
    "support"
   ],
   "interfaces/cssom.idl": [
-   "65a8a0ef05cce0b09bf685dedab3540a7593f5a4",
+   "3a1097a8c4cb4f63da97e126fbb302a5fec73968",
    "support"
   ],
   "interfaces/dedicated-workers.idl": [
    "993f3d3b4fa58585c444a76d2a5fc9f388e65999",
    "support"
   ],
   "interfaces/dom.idl": [
    "a5360a145bb075bdde49f875615f118198b9cf01",
@@ -606272,21 +606272,21 @@
    "f3e48d8ddd42f1eecb36af2a8e1cfade6d0a02d4",
    "testharness"
   ],
   "web-animations/animation-model/animation-types/interpolation-per-property.html": [
    "2bcb2919b3034042d8a61d7af5de099a42386451",
    "testharness"
   ],
   "web-animations/animation-model/animation-types/property-list.js": [
-   "d43568b85e47f0284d1084134e043cb04e67d948",
+   "5493ea79d860016c252fb67d6c7d7f17258deb1d",
    "support"
   ],
   "web-animations/animation-model/animation-types/property-types.js": [
-   "d5ccae3dd857f15eab45de2e70b332aaa126a575",
+   "9f6d5f18913c02044cc06c300b924f387025c258",
    "support"
   ],
   "web-animations/animation-model/animation-types/visibility.html": [
    "da3370704ca9e83a1171a64320a240e3145fab2c",
    "testharness"
   ],
   "web-animations/animation-model/combining-effects/applying-the-composited-result.html": [
    "5262331e6a2f957dd70e9a9888825250de65fd5b",
@@ -606372,17 +606372,17 @@
    "bd4a18205791b2b0271a6266dba3ebc8482c835b",
    "testharness"
   ],
   "web-animations/interfaces/Animation/startTime.html": [
    "01f669542434f03d37e9f148a4f3135fe3122d46",
    "testharness"
   ],
   "web-animations/interfaces/AnimationEffect/getComputedTiming.html": [
-   "e0d4ba4c0f1a5da4d126c501eca733e00adbef1a",
+   "fc183c88c463e08880cc0ed381474ee69d6e5056",
    "testharness"
   ],
   "web-animations/interfaces/AnimationEffect/updateTiming.html": [
    "5daa5580c2d34e992f3560bf5b85419498b6c5ee",
    "testharness"
   ],
   "web-animations/interfaces/AnimationPlaybackEvent/constructor.html": [
    "5aff03b7fa469e5ec0dc02a389eca963ae24b470",
@@ -615308,17 +615308,17 @@
    "3296d088846322713fb0a1d2160ad1c2ccddfb45",
    "testharness"
   ],
   "xhr/send-conditional.htm": [
    "f807d15cf8c787653f3362e3bfbb804c010f04e3",
    "testharness"
   ],
   "xhr/send-content-type-charset.htm": [
-   "e143738f086c6c96de54539e799ee194de436246",
+   "a1ce069d23a54ea7b60c3eaa1ff943651e7d9302",
    "testharness"
   ],
   "xhr/send-content-type-string.htm": [
    "1f90fd9a583794013b505524c9d6d1bad3e4db9c",
    "testharness"
   ],
   "xhr/send-data-arraybuffer.htm": [
    "43a7647ba4c567aaea98efa41d538d5beda682ff",
--- a/testing/web-platform/tests/xhr/send-content-type-charset.htm
+++ b/testing/web-platform/tests/xhr/send-content-type-charset.htm
@@ -10,74 +10,104 @@
   <body>
     <div id="log"></div>
     <script>
       function request(input, output, title) {
         title = title || document.title + ' - ' + input;
         test(function() {
         var client = new XMLHttpRequest()
         client.open("POST", "resources/content.py", false)
-        if(input)
+        if(input !== null)
           client.setRequestHeader("Content-Type", input)
         client.send("TEST")
         assert_equals(client.responseText, "TEST")
         assert_equals(client.getResponseHeader("x-request-content-type"), output)
         }, title)
       }
 
       request(
         "text; charset=ascii",
         "text; charset=ascii",
         "header with invalid MIME type is not changed"
       )
       request(
+        "",
+        "",
+        "header with invalid MIME type (empty string) is not changed"
+      )
+      request(
         "charset=ascii",
         "charset=ascii",
         "known charset but bogus header - missing MIME type"
       )
       request(
         "charset=bogus",
         "charset=bogus",
         "bogus charset and bogus header - missing MIME type"
       )
       request(
         "text/plain;charset=utf-8",
-        "text/plain;charset=utf-8",
+        "text/plain;charset=UTF-8",
         "Correct text/plain MIME with charset"
       )
       request(
         "text/x-pink-unicorn",
         "text/x-pink-unicorn",
         "If no charset= param is given, implementation should not add one - unknown MIME"
       )
       request(
         "text/plain",
         "text/plain",
         "If no charset= param is given, implementation should not add one - known MIME"
       )
       request(
+        "text/plain;  hi=bye",
+        "text/plain;  hi=bye",
+        "If no charset= param is given, implementation should not add one - known MIME, unknown param, two spaces"
+      )
+      request(
         "text/x-thepiano;charset= waddup",
         "text/x-thepiano;charset=UTF-8",
         "charset given but wrong, fix it (unknown MIME, bogus charset)"
       )
       request(
         "text/plain;charset=utf-8;charset=waddup",
-        "text/plain;charset=utf-8;charset=UTF-8",
+        "text/plain;charset=UTF-8",
         "charset given but wrong, fix it (known MIME, bogus charset)"
       )
       request(
         "text/plain;charset=shift-jis",
         "text/plain;charset=UTF-8",
         "charset given but wrong, fix it (known MIME, actual charset)"
       )
       request(
         "text/x-pink-unicorn; charset=windows-1252; charset=bogus; notrelated; charset=ascii",
-        "text/x-pink-unicorn; charset=UTF-8; charset=UTF-8; notrelated; charset=UTF-8",
-        "If multiple charset parameters are given, all should be rewritten"
+        "text/x-pink-unicorn;charset=UTF-8",
+        "Multiple charset parameters deduplicate, bogus parameter dropped"
       )
       request(
         null,
         "text/plain;charset=UTF-8",
         "No content type set, give MIME and charset"
       )
+      request(
+        "text/plain;charset= utf-8",
+        "text/plain;charset=UTF-8",
+        "charset with space")
+      request(
+        "text/plain;charset=\"utf-8\"",
+        "text/plain;charset=UTF-8",
+        "charset in double quotes")
+      request(
+        "text/plain;charset=\" utf-8\"",
+        "text/plain;charset=UTF-8",
+        "charset in double quotes with space")
+      request(
+        "text/plain;charset=\"u\\t\\f-8\"",
+        "text/plain;charset=UTF-8",
+        "charset in double quotes with backslashes")
+      request(
+        "YO/yo;charset=x;yo=YO; X=y",
+        "yo/yo;charset=UTF-8;yo=YO;x=y",
+        "unknown parameters need to be preserved")
     </script>
   </body>
 </html>