mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 17:25:36 +00:00
Bug 813433 - Make nsMediaSniffer accept null request arguments; r=bzbarsky
This patch will make the content sniffer useful to sniff the mimetype of in-memory media buffers.
This commit is contained in:
parent
334ae7f032
commit
e55fd9da0a
@ -75,16 +75,15 @@ nsMediaSniffer::GetMIMETypeFromContent(nsIRequest* aRequest,
|
||||
// For media, we want to sniff only if the Content-Type is unknown, or if it
|
||||
// is application/octet-stream.
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
|
||||
if (!channel) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
nsAutoCString contentType;
|
||||
nsresult rv = channel->GetContentType(contentType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!contentType.IsEmpty() &&
|
||||
!contentType.EqualsLiteral(APPLICATION_OCTET_STREAM) &&
|
||||
!contentType.EqualsLiteral(UNKNOWN_CONTENT_TYPE)) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
if (channel) {
|
||||
nsAutoCString contentType;
|
||||
nsresult rv = channel->GetContentType(contentType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!contentType.IsEmpty() &&
|
||||
!contentType.EqualsLiteral(APPLICATION_OCTET_STREAM) &&
|
||||
!contentType.EqualsLiteral(UNKNOWN_CONTENT_TYPE)) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
}
|
||||
|
||||
const uint32_t clampedLength = NS_MIN(aLength, MAX_BYTES_SNIFFED);
|
||||
|
Loading…
Reference in New Issue
Block a user