Bug 1362318 - Part2: Fallback override MIME type to application/octet-stream, r=baku

Set override MIME type to 'application/octet-stream', if type is not a parsable
MIME type.
This commit is contained in:
Shawn Huang 2017-05-11 18:59:10 +08:00
Родитель c5dd1dadc2
Коммит 0deb22583d
2 изменённых файлов: 7 добавлений и 3 удалений

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

@ -1972,6 +1972,13 @@ XMLHttpRequestMainThread::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
channel->SetContentType(NS_ConvertUTF16toUTF8(mOverrideMimeType));
}
// Fallback to 'application/octet-stream'
nsAutoCString type;
channel->GetContentType(type);
if (type.Equals(UNKNOWN_CONTENT_TYPE)) {
channel->SetContentType(NS_LITERAL_CSTRING(APPLICATION_OCTET_STREAM));
}
DetectCharset();
// Set up arraybuffer

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

@ -1,8 +1,5 @@
[overridemimetype-blob.html]
type: testharness
[Bogus MIME type should end up as application/octet-stream]
expected: FAIL
[Bogus MIME type should end up as application/octet-stream, 2]
expected: FAIL