Backed out changeset 5244caae8c46 (bug 822846) for Windows build bustage.

This commit is contained in:
Ryan VanderMeulen 2012-12-23 11:45:38 -05:00
parent cba106dc76
commit d0c3b92170
17 changed files with 55 additions and 68 deletions

View File

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/ModuleUtils.h"
#include "nsMimeTypes.h"
#include "RasterImage.h"
@ -62,25 +61,25 @@ static const mozilla::Module::ContractIDEntry kImageContracts[] = {
{ "@mozilla.org/image/loader;1", &kNS_IMGLOADER_CID },
{ "@mozilla.org/image/request;1", &kNS_IMGREQUESTPROXY_CID },
{ "@mozilla.org/image/tools;1", &kNS_IMGTOOLS_CID },
{ "@mozilla.org/image/encoder;2?type=" IMAGE_ICO_MS, &kNS_ICOENCODER_CID },
{ "@mozilla.org/image/encoder;2?type=" IMAGE_JPEG, &kNS_JPEGENCODER_CID },
{ "@mozilla.org/image/encoder;2?type=" IMAGE_PNG, &kNS_PNGENCODER_CID },
{ "@mozilla.org/image/encoder;2?type=" IMAGE_BMP, &kNS_BMPENCODER_CID },
{ "@mozilla.org/image/encoder;2?type=image/vnd.microsoft.icon", &kNS_ICOENCODER_CID },
{ "@mozilla.org/image/encoder;2?type=image/jpeg", &kNS_JPEGENCODER_CID },
{ "@mozilla.org/image/encoder;2?type=image/png", &kNS_PNGENCODER_CID },
{ "@mozilla.org/image/encoder;2?type=image/bmp", &kNS_BMPENCODER_CID },
{ NULL }
};
static const mozilla::Module::CategoryEntry kImageCategories[] = {
{ "Gecko-Content-Viewers", IMAGE_GIF, "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", IMAGE_JPEG, "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", IMAGE_PJPEG, "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", IMAGE_JPG, "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", IMAGE_ICO, "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", IMAGE_ICO_MS, "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", IMAGE_BMP, "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", IMAGE_BMP_MS, "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", IMAGE_ICON, "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", IMAGE_PNG, "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", IMAGE_X_PNG, "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", "image/gif", "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", "image/jpeg", "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", "image/pjpeg", "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", "image/jpg", "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", "image/x-icon", "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", "image/vnd.microsoft.icon", "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", "image/bmp", "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", "image/x-ms-bmp", "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", "image/icon", "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", "image/png", "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", "image/x-png", "@mozilla.org/content/document-loader-factory;1" },
{ "content-sniffing-services", "@mozilla.org/image/loader;1", "@mozilla.org/image/loader;1" },
{ NULL }
};

View File

@ -5,7 +5,6 @@
#include <stdlib.h>
#include "mozilla/dom/ContentChild.h"
#include "nsMimeTypes.h"
#include "nsIURL.h"
#include "nsXULAppAPI.h"
#include "AndroidBridge.h"
@ -103,7 +102,7 @@ moz_icon_to_channel(nsIURI *aURI, const nsACString& aFileExt, uint32_t aIconSize
NS_ENSURE_SUCCESS(rv, rv);
return NS_NewInputStreamChannel(aChannel, aURI, stream,
NS_LITERAL_CSTRING(IMAGE_ICON));
NS_LITERAL_CSTRING("image/icon"));
}
nsresult

View File

@ -25,7 +25,6 @@ extern "C" {
#include <gtk/gtk.h>
#include "nsMimeTypes.h"
#include "nsIMIMEService.h"
#include "nsIStringBundle.h"
@ -126,7 +125,7 @@ moz_gdk_pixbuf_to_channel(GdkPixbuf* aPixbuf, nsIURI *aURI,
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_NewInputStreamChannel(aChannel, aURI, stream,
NS_LITERAL_CSTRING(IMAGE_ICON));
NS_LITERAL_CSTRING("image/icon"));
return rv;
}

View File

@ -345,7 +345,7 @@ NS_IMETHODIMP nsIconChannel::SetLoadFlags(uint32_t aLoadAttributes)
NS_IMETHODIMP nsIconChannel::GetContentType(nsACString &aContentType)
{
aContentType.AssignLiteral(IMAGE_ICON);
aContentType.AssignLiteral("image/icon");
return NS_OK;
}
@ -359,7 +359,7 @@ nsIconChannel::SetContentType(const nsACString &aContentType)
NS_IMETHODIMP nsIconChannel::GetContentCharset(nsACString &aContentCharset)
{
aContentCharset.AssignLiteral(IMAGE_ICON);
aContentCharset.AssignLiteral("image/icon");
return NS_OK;
}

View File

@ -11,7 +11,6 @@
#include "nsReadableUtils.h"
#include "nsMemory.h"
#include "nsNetUtil.h"
#include "nsMimeTypes.h"
#include "nsIFile.h"
#include "nsIFileURL.h"
#include "nsDirectoryServiceDefs.h"
@ -574,7 +573,7 @@ void ConvertMaskBitMap(uint8_t *inBuf, PBITMAPINFO2 pBMInfo,
NS_IMETHODIMP nsIconChannel::GetContentType(nsACString &aContentType)
{
aContentType.AssignLiteral(IMAGE_ICON);
aContentType.AssignLiteral("image/icon");
return NS_OK;
}

View File

@ -10,7 +10,6 @@
#include <stdlib.h>
#include <unistd.h>
#include "nsMimeTypes.h"
#include "nsIMIMEService.h"
#include "nsIStringBundle.h"
@ -85,7 +84,7 @@ moz_qicon_to_channel(QImage *image, nsIURI *aURI,
NS_ENSURE_SUCCESS(rv, rv);
return NS_NewInputStreamChannel(aChannel, aURI, stream,
NS_LITERAL_CSTRING(IMAGE_ICON));
NS_LITERAL_CSTRING("image/icon"));
}
nsresult

View File

@ -587,7 +587,7 @@ nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, bool nonBlocki
NS_IMETHODIMP nsIconChannel::GetContentType(nsACString &aContentType)
{
aContentType.AssignLiteral(IMAGE_ICO);
aContentType.AssignLiteral("image/x-icon");
return NS_OK;
}

View File

@ -3,8 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsMimeTypes.h"
#include "Image.h"
namespace mozilla {
@ -51,39 +49,39 @@ Image::GetDecoderType(const char *aMimeType)
eDecoderType rv = eDecoderType_unknown;
// PNG
if (!strcmp(aMimeType, IMAGE_PNG))
if (!strcmp(aMimeType, "image/png"))
rv = eDecoderType_png;
else if (!strcmp(aMimeType, IMAGE_X_PNG))
else if (!strcmp(aMimeType, "image/x-png"))
rv = eDecoderType_png;
// GIF
else if (!strcmp(aMimeType, IMAGE_GIF))
else if (!strcmp(aMimeType, "image/gif"))
rv = eDecoderType_gif;
// JPEG
else if (!strcmp(aMimeType, IMAGE_JPEG))
else if (!strcmp(aMimeType, "image/jpeg"))
rv = eDecoderType_jpeg;
else if (!strcmp(aMimeType, IMAGE_PJPEG))
else if (!strcmp(aMimeType, "image/pjpeg"))
rv = eDecoderType_jpeg;
else if (!strcmp(aMimeType, IMAGE_JPG))
else if (!strcmp(aMimeType, "image/jpg"))
rv = eDecoderType_jpeg;
// BMP
else if (!strcmp(aMimeType, IMAGE_BMP))
else if (!strcmp(aMimeType, "image/bmp"))
rv = eDecoderType_bmp;
else if (!strcmp(aMimeType, IMAGE_BMP_MS))
else if (!strcmp(aMimeType, "image/x-ms-bmp"))
rv = eDecoderType_bmp;
// ICO
else if (!strcmp(aMimeType, IMAGE_ICO))
else if (!strcmp(aMimeType, "image/x-icon"))
rv = eDecoderType_ico;
else if (!strcmp(aMimeType, IMAGE_ICO_MS))
else if (!strcmp(aMimeType, "image/vnd.microsoft.icon"))
rv = eDecoderType_ico;
// Icon
else if (!strcmp(aMimeType, IMAGE_ICON))
else if (!strcmp(aMimeType, "image/icon"))
rv = eDecoderType_icon;
return rv;

View File

@ -9,7 +9,6 @@
#include "nsIHttpChannel.h"
#include "nsSimpleURI.h"
#include "nsMimeTypes.h"
#include "RasterImage.h"
#include "VectorImage.h"
@ -19,6 +18,8 @@
namespace mozilla {
namespace image {
const char* SVG_MIMETYPE = "image/svg+xml";
// Global preferences related to image containers.
static bool gInitializedPrefCaches = false;
static bool gDecodeOnDraw = false;
@ -88,7 +89,7 @@ ImageFactory::CreateImage(nsIRequest* aRequest,
uint32_t imageFlags = ComputeImageFlags(aURI, aIsMultiPart);
// Select the type of image to create based on MIME type.
if (aMimeType.EqualsLiteral(IMAGE_SVG_XML)) {
if (aMimeType.Equals(SVG_MIMETYPE)) {
return CreateVectorImage(aRequest, aStatusTracker, aMimeType,
aURI, imageFlags, aInnerWindowId);
} else {

View File

@ -15,6 +15,8 @@
namespace mozilla {
namespace image {
extern const char* SVG_MIMETYPE;
struct ImageFactory
{
/**

View File

@ -342,7 +342,7 @@ SVGDocumentWrapper::SetupViewer(nsIRequest* aRequest,
do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
NS_ENSURE_TRUE(catMan, NS_ERROR_NOT_AVAILABLE);
nsXPIDLCString contractId;
nsresult rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", IMAGE_SVG_XML,
nsresult rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", SVG_MIMETYPE,
getter_Copies(contractId));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocumentLoaderFactory> docLoaderFactory =
@ -353,7 +353,7 @@ SVGDocumentWrapper::SetupViewer(nsIRequest* aRequest,
nsCOMPtr<nsIStreamListener> listener;
rv = docLoaderFactory->CreateInstance("external-resource", chan,
newLoadGroup,
IMAGE_SVG_XML, nullptr, nullptr,
SVG_MIMETYPE, nullptr, nullptr,
getter_AddRefs(listener),
getter_AddRefs(viewer));
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -15,7 +15,6 @@
#include "nsIObserver.h"
#include "nsIContentViewer.h"
#include "nsWeakReference.h"
#include "nsMimeTypes.h"
class nsIAtom;
class nsIPresShell;
@ -25,6 +24,7 @@ class nsIFrame;
struct nsIntSize;
class nsSVGSVGElement;
#define SVG_MIMETYPE "image/svg+xml"
#define OBSERVER_SVC_CID "@mozilla.org/observer-service;1"

View File

@ -14,7 +14,6 @@
#include "nsIObserverService.h"
#include "nsIPresShell.h"
#include "nsIStreamListener.h"
#include "nsMimeTypes.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsSVGUtils.h" // for nsSVGUtils::ConvertToSurfaceSize
@ -205,7 +204,7 @@ VectorImage::Init(imgDecoderObserver* aObserver,
if (aObserver) {
mObserver = aObserver->asWeakPtr();
}
NS_ABORT_IF_FALSE(!strcmp(aMimeType, IMAGE_SVG_XML), "Unexpected mimetype");
NS_ABORT_IF_FALSE(!strcmp(aMimeType, SVG_MIMETYPE), "Unexpected mimetype");
mIsInitialized = true;

View File

@ -25,7 +25,6 @@
#include "nsContentUtils.h"
#include "nsCrossSiteListenerProxy.h"
#include "nsNetUtil.h"
#include "nsMimeTypes.h"
#include "nsStreamUtils.h"
#include "nsIHttpChannel.h"
#include "nsICachingChannel.h"
@ -958,7 +957,7 @@ void imgLoader::ReadAcceptHeaderPref()
if (accept)
mAcceptHeader = accept;
else
mAcceptHeader = IMAGE_PNG "," IMAGE_WILDCARD ";q=0.8," ANY_WILDCARD ";q=0.5";
mAcceptHeader = "image/png,image/*;q=0.8,*/*;q=0.5";
}
/* void clearCache (in boolean chrome); */
@ -1992,7 +1991,7 @@ nsresult imgLoader::GetMimeTypeFromContent(const char* aContents, uint32_t aLeng
if (aLength >= 6 && (!nsCRT::strncmp(aContents, "GIF87a", 6) ||
!nsCRT::strncmp(aContents, "GIF89a", 6)))
{
aContentType.AssignLiteral(IMAGE_GIF);
aContentType.AssignLiteral("image/gif");
}
/* or a PNG? */
@ -2005,7 +2004,7 @@ nsresult imgLoader::GetMimeTypeFromContent(const char* aContents, uint32_t aLeng
(unsigned char)aContents[6]==0x1A &&
(unsigned char)aContents[7]==0x0A))
{
aContentType.AssignLiteral(IMAGE_PNG);
aContentType.AssignLiteral("image/png");
}
/* maybe a JPEG (JFIF)? */
@ -2020,7 +2019,7 @@ nsresult imgLoader::GetMimeTypeFromContent(const char* aContents, uint32_t aLeng
((unsigned char)aContents[1])==0xD8 &&
((unsigned char)aContents[2])==0xFF)
{
aContentType.AssignLiteral(IMAGE_JPEG);
aContentType.AssignLiteral("image/jpeg");
}
/* or how about ART? */
@ -2032,18 +2031,18 @@ nsresult imgLoader::GetMimeTypeFromContent(const char* aContents, uint32_t aLeng
((unsigned char) aContents[1])==0x47 &&
((unsigned char) aContents[4])==0x00 )
{
aContentType.AssignLiteral(IMAGE_ART);
aContentType.AssignLiteral("image/x-jg");
}
else if (aLength >= 2 && !nsCRT::strncmp(aContents, "BM", 2)) {
aContentType.AssignLiteral(IMAGE_BMP);
aContentType.AssignLiteral("image/bmp");
}
// ICOs always begin with a 2-byte 0 followed by a 2-byte 1.
// CURs begin with 2-byte 0 followed by 2-byte 2.
else if (aLength >= 4 && (!memcmp(aContents, "\000\000\001\000", 4) ||
!memcmp(aContents, "\000\000\002\000", 4))) {
aContentType.AssignLiteral(IMAGE_ICO);
aContentType.AssignLiteral("image/x-icon");
}
else {

View File

@ -31,7 +31,6 @@
#include "nsIHttpChannel.h"
#include "nsIApplicationCache.h"
#include "nsIApplicationCacheChannel.h"
#include "nsMimeTypes.h"
#include "nsIComponentManager.h"
#include "nsIInterfaceRequestorUtils.h"
@ -727,7 +726,7 @@ imgRequest::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctxt,
// type and decoder.
// We always reinitialize for SVGs, because they have no way of
// reinitializing themselves.
if (mContentType != newType || newType.EqualsLiteral(IMAGE_SVG_XML)) {
if (mContentType != newType || newType.Equals(SVG_MIMETYPE)) {
mContentType = newType;
// If we've resniffed our MIME type and it changed, we need to create a

View File

@ -16,7 +16,6 @@
instead, to help catch typos, and make central management of them easier.
*/
#define ANY_WILDCARD "*/*"
#define AUDIO_WILDCARD "audio/*"
#define IMAGE_WILDCARD "image/*"
@ -82,11 +81,9 @@
#define BINARY_OCTET_STREAM "binary/octet-stream"
#define IMAGE_GIF "image/gif"
#define IMAGE_JPEG "image/jpeg"
#define IMAGE_JPG "image/jpg"
#define IMAGE_PJPEG "image/pjpeg"
#define IMAGE_JPG "image/jpeg"
#define IMAGE_PJPG "image/pjpeg"
#define IMAGE_PNG "image/png"
#define IMAGE_X_PNG "image/x-png"
#define IMAGE_PPM "image/x-portable-pixmap"
#define IMAGE_XBM "image/x-xbitmap"
#define IMAGE_XBM2 "image/x-xbm"
@ -94,10 +91,7 @@
#define IMAGE_ART "image/x-jg"
#define IMAGE_TIFF "image/tiff"
#define IMAGE_BMP "image/bmp"
#define IMAGE_BMP_MS "image/x-ms-bmp"
#define IMAGE_ICO "image/x-icon"
#define IMAGE_ICO_MS "image/vnd.microsoft.icon"
#define IMAGE_ICON "image/icon"
#define IMAGE_MNG "video/x-mng"
#define IMAGE_JNG "image/x-jng"
#define IMAGE_SVG_XML "image/svg+xml"

View File

@ -381,8 +381,8 @@ static nsDefaultMimeTypeEntry defaultMimeEntries [] =
{ IMAGE_PNG, "png" },
// -- end extensions used during startup
{ TEXT_CSS, "css" },
{ IMAGE_JPEG, "jpeg" },
{ IMAGE_JPEG, "jpg" },
{ IMAGE_JPG, "jpeg" },
{ IMAGE_JPG, "jpg" },
{ TEXT_HTML, "html" },
{ TEXT_HTML, "htm" },
{ APPLICATION_XPINSTALL, "xpi" },
@ -460,7 +460,7 @@ static nsExtraMimeTypeEntry extraMimeEntries [] =
{ IMAGE_BMP, "bmp", "BMP Image" },
{ IMAGE_GIF, "gif", "GIF Image" },
{ IMAGE_ICO, "ico,cur", "ICO Image" },
{ IMAGE_JPEG, "jpeg,jpg,jfif,pjpeg,pjp", "JPEG Image" },
{ IMAGE_JPG, "jpeg,jpg,jfif,pjpeg,pjp", "JPEG Image" },
{ IMAGE_PNG, "png", "PNG Image" },
{ IMAGE_TIFF, "tiff,tif", "TIFF Image" },
{ IMAGE_XBM, "xbm", "XBM Image" },