Bug 1508658 [wpt PR 14144] - Fetch: change Response's statusText's default, a=testonly
authorAnne van Kesteren <annevk@annevk.nl>
Sat, 24 Nov 2018 10:28:27 +0000
changeset 504463 823f8312186515b6e7a6860306bb8d1f8e838cc8
parent 504462 f7c412366d16e3a5d93aa2a249c9bf3f97ff841a
child 504464 a48a908f13709ded4a087ec56b3d5196406d9171
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1508658, 14144
milestone65.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 1508658 [wpt PR 14144] - Fetch: change Response's statusText's default, a=testonly Automatic update from web-platform-testsFetch: change Response's statusText's default See https://github.com/whatwg/fetch/pull/836 for context. This also cleans up the code a bit. -- wpt-commits: 99e9e996267ccd5c1344b7d0164c5e5763b3b174 wpt-pr: 14144
testing/web-platform/tests/fetch/api/response/response-init-001.html
--- a/testing/web-platform/tests/fetch/api/response/response-init-001.html
+++ b/testing/web-platform/tests/fetch/api/response/response-init-001.html
@@ -10,25 +10,25 @@
     <script src="/resources/testharnessreport.js"></script>
   </head>
   <body>
     <script>
       var defaultValues = { "type" : "default",
                             "url" : "",
                             "ok" : true,
                             "status" : 200,
-                            "statusText" : "OK",
+                            "statusText" : "",
                             "body" : null
       };
 
       var statusCodes = { "givenValues" : [200, 300, 400, 500, 599],
-                       "expectedValues" : [200, 300, 400, 500, 599]
+                          "expectedValues" : [200, 300, 400, 500, 599]
       };
-      var statusTexts = { "givenValues" : ["OK", "with space", String.fromCharCode(0x80)],
-                       "expectedValues" : ["OK", "with space", String.fromCharCode(0x80)]
+      var statusTexts = { "givenValues" : ["", "OK", "with space", String.fromCharCode(0x80)],
+                          "expectedValues" : ["", "OK", "with space", String.fromCharCode(0x80)]
       };
       var initValuesDict = { "status" : statusCodes,
                              "statusText" : statusTexts
       };
 
       function isOkStatus(status) {
         return 200 <= status &&  299 >= status;
       }
@@ -37,40 +37,41 @@
       for (var attributeName in defaultValues) {
         test(function() {
           var expectedValue = defaultValues[attributeName];
           assert_equals(response[attributeName], expectedValue,
             "Expect default response." + attributeName + " is " + expectedValue);
         }, "Check default value for " + attributeName + " attribute");
       }
 
-      for (var attributeName in initValuesDict)
+      for (var attributeName in initValuesDict) {
         test(function() {
           var valuesToTest = initValuesDict[attributeName];
           for (var valueIdx in valuesToTest["givenValues"]) {
             var givenValue = valuesToTest["givenValues"][valueIdx];
             var expectedValue = valuesToTest["expectedValues"][valueIdx];
             var responseInit = {};
             responseInit[attributeName] = givenValue;
             var response = new Response("", responseInit);
             assert_equals(response[attributeName], expectedValue,
               "Expect response." + attributeName + " is " + expectedValue +
               " when initialized with " + givenValue);
             assert_equals(response.ok, isOkStatus(response.status),
               "Expect response.ok is " + isOkStatus(response.status));
           }
         }, "Check " + attributeName + " init values and associated getter");
+      }
 
-        test(function() {
-          const response1 = new Response("");
-          assert_equals(response1.headers, response1.headers);
+      test(function() {
+        const response1 = new Response("");
+        assert_equals(response1.headers, response1.headers);
 
-          const response2 = new Response("", {"headers": {"X-Foo": "bar"}});
-          assert_equals(response2.headers, response2.headers);
-          const headers = response2.headers;
-          response2.headers.set("X-Foo", "quux");
-          assert_equals(headers, response2.headers);
-          headers.set("X-Other-Header", "baz");
-          assert_equals(headers, response2.headers);
-        }, "Test that Response.headers has the [SameObject] extended attribute");
+        const response2 = new Response("", {"headers": {"X-Foo": "bar"}});
+        assert_equals(response2.headers, response2.headers);
+        const headers = response2.headers;
+        response2.headers.set("X-Foo", "quux");
+        assert_equals(headers, response2.headers);
+        headers.set("X-Other-Header", "baz");
+        assert_equals(headers, response2.headers);
+      }, "Test that Response.headers has the [SameObject] extended attribute");
     </script>
   </body>
 </html>