зеркало из https://github.com/mozilla/pjs.git
checking in fix for topcrash bug 145147. r=bienvenu sr=mscott
This commit is contained in:
Родитель
edc30522e0
Коммит
03597ef959
|
@ -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));
|
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче