Backed out changeset f525479fabd6 (bug 1454325) for xpcshell/test_Http.js failures CLOSED TREE

This commit is contained in:
Bogdan Tara
2019-03-19 05:13:45 +02:00
parent 8d175fb55b
commit c79e8ffbb4
3 changed files with 30 additions and 13 deletions

View File

@@ -2776,19 +2776,16 @@ nsresult XMLHttpRequestMainThread::SendInternal(const BodyExtractorBase* aBody,
uploadContentType = defaultContentType;
} else if (aBodyIsDocumentOrString &&
StaticPrefs::dom_xhr_standard_content_type_normalization()) {
UniquePtr<CMimeType> contentTypeRecord =
CMimeType::Parse(uploadContentType);
nsAutoCString charset;
if (contentTypeRecord &&
contentTypeRecord->GetParameterValue(kLiteralString_charset,
charset) &&
!charset.EqualsIgnoreCase("utf-8")) {
contentTypeRecord->SetParameterValue(kLiteralString_charset,
kLiteralString_UTF_8);
contentTypeRecord->Serialize(uploadContentType);
UniquePtr<CMimeType> parsed = CMimeType::Parse(uploadContentType);
if (parsed && parsed->HasParameter(kLiteralString_charset)) {
parsed->SetParameterValue(kLiteralString_charset,
kLiteralString_UTF_8);
parsed->Serialize(uploadContentType);
}
} else if (!charset.IsEmpty()) {
// We don't want to set a charset for streams.
}
// We don't want to set a charset for streams.
if (!charset.IsEmpty()) {
// Replace all case-insensitive matches of the charset in the
// content-type with the correct case.
RequestHeaders::CharsetIterator iter(uploadContentType);