Bug 1453612 - Response.redirect() should have empty string statusText. r=baku
authorDiego Pino Garcia <dpino@igalia.com>
Sun, 14 Oct 2018 16:36:00 +0300
changeset 500100 eed147a8bd4197ebc04eb58bebe29356e65395b0
parent 500099 de6e7a30d05060719717227a50b527fefc672ac4
child 500101 1a9ecfe4c2d4aae717bdb8cdbef9391a1e1c1ba6
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1453612
milestone64.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 1453612 - Response.redirect() should have empty string statusText. r=baku
dom/fetch/Response.cpp
dom/tests/mochitest/fetch/test_response.js
testing/web-platform/meta/fetch/api/response/response-static-redirect.html.ini
--- a/dom/fetch/Response.cpp
+++ b/dom/fetch/Response.cpp
@@ -135,16 +135,17 @@ Response::Redirect(const GlobalObject& a
   if (aStatus != 301 && aStatus != 302 && aStatus != 303 && aStatus != 307 && aStatus != 308) {
     aRv.ThrowRangeError<MSG_INVALID_REDIRECT_STATUSCODE_ERROR>();
     return nullptr;
   }
 
   Optional<Nullable<fetch::ResponseBodyInit>> body;
   ResponseInit init;
   init.mStatus = aStatus;
+  init.mStatusText.AssignASCII("");
   RefPtr<Response> r = Response::Constructor(aGlobal, body, init, aRv);
   if (NS_WARN_IF(aRv.Failed())) {
     return nullptr;
   }
 
   r->GetInternalHeaders()->Set(NS_LITERAL_CSTRING("Location"),
                                NS_ConvertUTF16toUTF8(parsedURL), aRv);
   if (NS_WARN_IF(aRv.Failed())) {
--- a/dom/tests/mochitest/fetch/test_response.js
+++ b/dom/tests/mochitest/fetch/test_response.js
@@ -100,16 +100,17 @@ function testError() {
   } catch(e) {
     ok(true, "Error response should have immutable headers");
   }
 }
 
 function testRedirect() {
   var res = Response.redirect("./redirect.response");
   is(res.status, 302, "Default redirect has status code 302");
+  is(res.statusText, "", "Default redirect has status text empty");
   var h = res.headers.get("location");
   ok(h === (new URL("./redirect.response", self.location.href)).href, "Location header should be correct absolute URL");
   try {
     res.headers.set("someheader", "not allowed");
     ok(false, "Redirects should have immutable headers");
   } catch(e) {
     ok(true, "Redirects should have immutable headers");
   }
--- a/testing/web-platform/meta/fetch/api/response/response-static-redirect.html.ini
+++ b/testing/web-platform/meta/fetch/api/response/response-static-redirect.html.ini
@@ -1,22 +1,3 @@
 [response-static-redirect.html]
   [Check error returned when giving invalid url to redirect()]
     expected: FAIL
-
-  [Check default redirect response]
-    expected: FAIL
-
-  [Check response returned by static method redirect(), status = 301]
-    expected: FAIL
-
-  [Check response returned by static method redirect(), status = 302]
-    expected: FAIL
-
-  [Check response returned by static method redirect(), status = 303]
-    expected: FAIL
-
-  [Check response returned by static method redirect(), status = 307]
-    expected: FAIL
-
-  [Check response returned by static method redirect(), status = 308]
-    expected: FAIL
-