checking in fix for topcrash bug 145147. r=bienvenu sr=mscott

This commit is contained in:
pavlov%netscape.com 2002-05-24 20:54:44 +00:00
Родитель edc30522e0
Коммит 03597ef959
3 изменённых файлов: 10 добавлений и 2 удалений

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

@ -541,6 +541,12 @@ NS_IMETHODIMP imgLoader::SupportImageWithMimeType(const char* aMimeType, PRBool
} }
NS_IMETHODIMP imgLoader::SupportImageWithContents(const char* aContents, PRUint32 aLength, char** aContentType) NS_IMETHODIMP imgLoader::SupportImageWithContents(const char* aContents, PRUint32 aLength, char** aContentType)
{
return GetMimeTypeFromContent(aContents, aLength, aContentType);
}
/* static */
nsresult imgLoader::GetMimeTypeFromContent(const char* aContents, PRUint32 aLength, char** aContentType)
{ {
*aContentType = nsnull; *aContentType = nsnull;
/* Is it a GIF? */ /* Is it a GIF? */

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

@ -50,6 +50,8 @@ public:
imgLoader(); imgLoader();
virtual ~imgLoader(); virtual ~imgLoader();
static nsresult GetMimeTypeFromContent(const char* aContents, PRUint32 aLength, char** aContentType);
private: private:
nsresult CreateNewProxyForRequest(imgRequest *aRequest, nsILoadGroup *aLoadGroup, nsresult CreateNewProxyForRequest(imgRequest *aRequest, nsILoadGroup *aLoadGroup,
imgIDecoderObserver *aObserver, nsISupports *cx, imgIDecoderObserver *aObserver, nsISupports *cx,

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

@ -23,6 +23,7 @@
#include "imgRequest.h" #include "imgRequest.h"
#include "imgLoader.h"
#include "imgCache.h" #include "imgCache.h"
#include "imgRequestProxy.h" #include "imgRequestProxy.h"
@ -783,6 +784,5 @@ static NS_METHOD sniff_mimetype_callback(nsIInputStream* in,
void void
imgRequest::SniffMimeType(const char *buf, PRUint32 len) imgRequest::SniffMimeType(const char *buf, PRUint32 len)
{ {
nsCOMPtr<imgILoader> loader(do_GetService("@mozilla.org/image/loader;1")); imgLoader::GetMimeTypeFromContent(buf, len, getter_Copies(mContentType));
loader->SupportImageWithContents(buf, len, getter_Copies(mContentType));
} }