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

git-svn-id: svn://10.0.0.236/trunk@122136 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pavlov%netscape.com
2002-05-24 20:54:44 +00:00
parent 30586985bd
commit 0b2049aeb6
3 changed files with 10 additions and 2 deletions

View File

@@ -541,6 +541,12 @@ NS_IMETHODIMP imgLoader::SupportImageWithMimeType(const char* aMimeType, PRBool
}
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;
/* Is it a GIF? */

View File

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

View File

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