diff options
Diffstat (limited to 'image/imgLoader.cpp')
-rw-r--r-- | image/imgLoader.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/image/imgLoader.cpp b/image/imgLoader.cpp index 3545c5be2..5e5ee7829 100644 --- a/image/imgLoader.cpp +++ b/image/imgLoader.cpp @@ -2558,6 +2558,11 @@ imgLoader::GetMimeTypeFromContent(const char* aContents, !memcmp(aContents, "\000\000\002\000", 4))) { aContentType.AssignLiteral(IMAGE_ICO); + // WebPs always begin with RIFF, a 32-bit length, and WEBP. + } else if (aLength >= 12 && !memcmp(aContents, "RIFF", 4) && + !memcmp(aContents + 8, "WEBP", 4)) { + aContentType.AssignLiteral(IMAGE_WEBP); + } else { /* none of the above? I give up */ return NS_ERROR_NOT_AVAILABLE; |