Bug 1453612 - Response.redirect() should have empty string statusText. r=baku

This commit is contained in:
Diego Pino Garcia 2018-10-14 16:36:00 +03:00
Родитель eca2cd1106
Коммит 8feb556198
3 изменённых файлов: 2 добавлений и 19 удалений

Просмотреть файл

@ -140,6 +140,7 @@ Response::Redirect(const GlobalObject& aGlobal, const nsAString& aUrl,
Optional<Nullable<fetch::ResponseBodyInit>> body; Optional<Nullable<fetch::ResponseBodyInit>> body;
ResponseInit init; ResponseInit init;
init.mStatus = aStatus; init.mStatus = aStatus;
init.mStatusText.AssignASCII("");
RefPtr<Response> r = Response::Constructor(aGlobal, body, init, aRv); RefPtr<Response> r = Response::Constructor(aGlobal, body, init, aRv);
if (NS_WARN_IF(aRv.Failed())) { if (NS_WARN_IF(aRv.Failed())) {
return nullptr; return nullptr;

Просмотреть файл

@ -105,6 +105,7 @@ function testError() {
function testRedirect() { function testRedirect() {
var res = Response.redirect("./redirect.response"); var res = Response.redirect("./redirect.response");
is(res.status, 302, "Default redirect has status code 302"); 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"); var h = res.headers.get("location");
ok(h === (new URL("./redirect.response", self.location.href)).href, "Location header should be correct absolute URL"); ok(h === (new URL("./redirect.response", self.location.href)).href, "Location header should be correct absolute URL");
try { try {

Просмотреть файл

@ -1,22 +1,3 @@
[response-static-redirect.html] [response-static-redirect.html]
[Check error returned when giving invalid url to redirect()] [Check error returned when giving invalid url to redirect()]
expected: FAIL 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