mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 924319 - do not include Content-Length for data URIs in XMLHttpRequest.getAllResponseHeaders. r=jst
--HG-- extra : rebase_source : e4b966f7cfd054394cf8672e00b8b63feea9ce84
This commit is contained in:
parent
30e61f3146
commit
c694d1761b
@ -1182,11 +1182,18 @@ XMLHttpRequestMainThread::GetAllResponseHeaders(nsACString& aResponseHeaders,
|
||||
aResponseHeaders.AppendLiteral("\r\n");
|
||||
}
|
||||
|
||||
int64_t length;
|
||||
if (NS_SUCCEEDED(mChannel->GetContentLength(&length))) {
|
||||
aResponseHeaders.AppendLiteral("Content-Length: ");
|
||||
aResponseHeaders.AppendInt(length);
|
||||
aResponseHeaders.AppendLiteral("\r\n");
|
||||
// Don't provide Content-Length for data URIs
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
bool isDataURI;
|
||||
if (NS_FAILED(mChannel->GetURI(getter_AddRefs(uri))) ||
|
||||
NS_FAILED(uri->SchemeIs("data", &isDataURI)) ||
|
||||
!isDataURI) {
|
||||
int64_t length;
|
||||
if (NS_SUCCEEDED(mChannel->GetContentLength(&length))) {
|
||||
aResponseHeaders.AppendLiteral("Content-Length: ");
|
||||
aResponseHeaders.AppendInt(length);
|
||||
aResponseHeaders.AppendLiteral("\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,5 @@
|
||||
[data-uri.htm]
|
||||
type: testharness
|
||||
[XHR method GET with charset text/plain]
|
||||
expected: FAIL
|
||||
|
||||
[XHR method GET with charset text/plain (base64)]
|
||||
expected: FAIL
|
||||
|
||||
[XHR method GET with charset text/html]
|
||||
expected: FAIL
|
||||
|
||||
[XHR method GET with charset text/html;charset=UTF-8]
|
||||
expected: FAIL
|
||||
|
||||
[XHR method GET with charset image/png]
|
||||
expected: FAIL
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user