Bug 730925 - XHR.getAllResponseHeaders should use CRLF, not LF per spec, r=jst, r=jonas, f=ms2ger

This commit is contained in:
Mark Capella 2012-07-26 11:55:23 -04:00
parent fd23bc31f2
commit 30621de994
2 changed files with 3 additions and 3 deletions

View File

@ -1457,7 +1457,7 @@ nsXMLHttpRequest::GetAllResponseHeaders(nsString& aResponseHeaders)
aResponseHeaders.AppendLiteral(";charset=");
AppendASCIItoUTF16(value, aResponseHeaders);
}
aResponseHeaders.Append('\n');
aResponseHeaders.AppendLiteral("\r\n");
}
}
@ -3981,7 +3981,7 @@ nsHeaderVisitor::VisitHeader(const nsACString &header, const nsACString &value)
mHeaders.Append(header);
mHeaders.Append(": ");
mHeaders.Append(value);
mHeaders.Append('\n');
mHeaders.Append("\r\n");
}
return NS_OK;
}

View File

@ -48,7 +48,7 @@ for (i = 0; i < passFiles.length; ++i) {
is(xhr.status, passFiles[i][2], "wrong status");
is(xhr.getResponseHeader("Content-Type"), passFiles[i][3], "wrong content type");
var headers = xhr.getAllResponseHeaders();
ok(/(?:^|\n)Content-Type:\s*([^\n]*)\n/i.test(headers) &&
ok(/(?:^|\n)Content-Type:\s*([^\r\n]*)\r\n/i.test(headers) &&
RegExp.$1 === passFiles[i][3], "wrong response headers");
if (xhr.responseXML) {
is((new XMLSerializer()).serializeToString(xhr.responseXML.documentElement),