зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1454325 - update XHR upload content-type handling to match the spec. r=baku
update XHR upload content-type handling to match the spec Differential Revision: https://phabricator.services.mozilla.com/D23251 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
408d872fcd
Коммит
0403ee7cdc
|
@ -2776,16 +2776,19 @@ nsresult XMLHttpRequestMainThread::SendInternal(const BodyExtractorBase* aBody,
|
||||||
uploadContentType = defaultContentType;
|
uploadContentType = defaultContentType;
|
||||||
} else if (aBodyIsDocumentOrString &&
|
} else if (aBodyIsDocumentOrString &&
|
||||||
StaticPrefs::dom_xhr_standard_content_type_normalization()) {
|
StaticPrefs::dom_xhr_standard_content_type_normalization()) {
|
||||||
UniquePtr<CMimeType> parsed = CMimeType::Parse(uploadContentType);
|
UniquePtr<CMimeType> contentTypeRecord =
|
||||||
if (parsed && parsed->HasParameter(kLiteralString_charset)) {
|
CMimeType::Parse(uploadContentType);
|
||||||
parsed->SetParameterValue(kLiteralString_charset,
|
nsAutoCString charset;
|
||||||
|
if (contentTypeRecord &&
|
||||||
|
contentTypeRecord->GetParameterValue(kLiteralString_charset,
|
||||||
|
charset) &&
|
||||||
|
!charset.EqualsIgnoreCase("utf-8")) {
|
||||||
|
contentTypeRecord->SetParameterValue(kLiteralString_charset,
|
||||||
kLiteralString_UTF_8);
|
kLiteralString_UTF_8);
|
||||||
parsed->Serialize(uploadContentType);
|
contentTypeRecord->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
|
// Replace all case-insensitive matches of the charset in the
|
||||||
// content-type with the correct case.
|
// content-type with the correct case.
|
||||||
RequestHeaders::CharsetIterator iter(uploadContentType);
|
RequestHeaders::CharsetIterator iter(uploadContentType);
|
||||||
|
|
|
@ -483,11 +483,10 @@ VARCACHE_PREF(
|
||||||
)
|
)
|
||||||
|
|
||||||
// Enable content type normalization of XHR uploads via MIME Sniffing standard
|
// Enable content type normalization of XHR uploads via MIME Sniffing standard
|
||||||
// Disabled for now in bz1499136
|
|
||||||
VARCACHE_PREF(
|
VARCACHE_PREF(
|
||||||
"dom.xhr.standard_content_type_normalization",
|
"dom.xhr.standard_content_type_normalization",
|
||||||
dom_xhr_standard_content_type_normalization,
|
dom_xhr_standard_content_type_normalization,
|
||||||
RelaxedAtomicBool, false
|
RelaxedAtomicBool, true
|
||||||
)
|
)
|
||||||
|
|
||||||
// Block multiple external protocol URLs in iframes per single event.
|
// Block multiple external protocol URLs in iframes per single event.
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
[send-content-type-charset.htm]
|
|
||||||
[charset with space that is UTF-8 does not change]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[charset in double quotes with backslashes that is UTF-8 does not change]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[If charset= param is UTF-8 (case-insensitive), it should not be changed (bogus charset)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[If charset= param is UTF-8 (case-insensitive), it should not be changed]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[charset in double quotes that is UTF-8 does not change]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[charset with trailing space that is UTF-8 does not change]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче