checking in fix for bug 145147 r=bienvenu sr=mscott a=roc,scc,shaver,jaimejr,etc

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_0_BRANCH@122142 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pavlov%netscape.com
2002-05-24 22:53:03 +00:00
parent 63f6028c4e
commit 1c4cdfade6
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));
}