diff --git a/image/DecoderFactory.cpp b/image/DecoderFactory.cpp
index 5b4d8c80809..fbb448a73e8 100644
--- a/image/DecoderFactory.cpp
+++ b/image/DecoderFactory.cpp
@@ -34,6 +34,8 @@ DecoderFactory::GetDecoderType(const char* aMimeType)
type = DecoderType::PNG;
} else if (!strcmp(aMimeType, IMAGE_X_PNG)) {
type = DecoderType::PNG;
+ } else if (!strcmp(aMimeType, IMAGE_APNG)) {
+ type = DecoderType::PNG;
// GIF
} else if (!strcmp(aMimeType, IMAGE_GIF)) {
diff --git a/image/build/nsImageModule.cpp b/image/build/nsImageModule.cpp
index 6bc4c04a6b4..f786005ddca 100644
--- a/image/build/nsImageModule.cpp
+++ b/image/build/nsImageModule.cpp
@@ -77,6 +77,7 @@ static const mozilla::Module::CategoryEntry kImageCategories[] = {
{ "Gecko-Content-Viewers", IMAGE_BMP_MS, "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", IMAGE_ICON_MS, "@mozilla.org/content/document-loader-factory;1" },
{ "Gecko-Content-Viewers", IMAGE_PNG, "@mozilla.org/content/document-loader-factory;1" },
+ { "Gecko-Content-Viewers", IMAGE_APNG, "@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" },
{ nullptr }
diff --git a/layout/reftests/apng-mime/animated.apng b/layout/reftests/apng-mime/animated.apng
new file mode 100644
index 00000000000..a310055bb89
Binary files /dev/null and b/layout/reftests/apng-mime/animated.apng differ
diff --git a/layout/reftests/apng-mime/expected.html b/layout/reftests/apng-mime/expected.html
new file mode 100644
index 00000000000..d069957fdf6
--- /dev/null
+++ b/layout/reftests/apng-mime/expected.html
@@ -0,0 +1,3 @@
+
+
apng expected
+
diff --git a/layout/reftests/apng-mime/reftest.list b/layout/reftests/apng-mime/reftest.list
new file mode 100644
index 00000000000..fef0f4a7364
--- /dev/null
+++ b/layout/reftests/apng-mime/reftest.list
@@ -0,0 +1 @@
+== test.html expected.html
diff --git a/layout/reftests/apng-mime/static.png b/layout/reftests/apng-mime/static.png
new file mode 100644
index 00000000000..6f76d443872
Binary files /dev/null and b/layout/reftests/apng-mime/static.png differ
diff --git a/layout/reftests/apng-mime/test.html b/layout/reftests/apng-mime/test.html
new file mode 100644
index 00000000000..35c1dc09d58
--- /dev/null
+++ b/layout/reftests/apng-mime/test.html
@@ -0,0 +1,6 @@
+
+apng test
+
diff --git a/layout/reftests/reftest.list b/layout/reftests/reftest.list
index eca7e0c590c..9b38f585d31 100644
--- a/layout/reftests/reftest.list
+++ b/layout/reftests/reftest.list
@@ -19,6 +19,9 @@ include w3c-css/received/reftest.list
include abs-pos/reftest.list
include position-relative/reftest.list
+# apng-mime
+include apng-mime/reftest.list
+
include async-scrolling/reftest.list
# backgrounds/
diff --git a/netwerk/mime/nsMimeTypes.h b/netwerk/mime/nsMimeTypes.h
index 13d99b3cc56..c4c3a5245ef 100644
--- a/netwerk/mime/nsMimeTypes.h
+++ b/netwerk/mime/nsMimeTypes.h
@@ -94,6 +94,7 @@
#define IMAGE_JPG "image/jpg"
#define IMAGE_PJPEG "image/pjpeg"
#define IMAGE_PNG "image/png"
+#define IMAGE_APNG "video/vnd.mozilla.apng"
#define IMAGE_X_PNG "image/x-png"
#define IMAGE_PPM "image/x-portable-pixmap"
#define IMAGE_XBM "image/x-xbitmap"
diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp
index c7bfb9f50b0..52fdd1cce95 100644
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -576,6 +576,7 @@ static nsExtraMimeTypeEntry extraMimeEntries [] =
{ IMAGE_ICO, "ico,cur", "ICO Image" },
{ IMAGE_JPEG, "jpeg,jpg,jfif,pjpeg,pjp", "JPEG Image" },
{ IMAGE_PNG, "png", "PNG Image" },
+ { IMAGE_APNG, "apng", "APNG Image" },
{ IMAGE_TIFF, "tiff,tif", "TIFF Image" },
{ IMAGE_XBM, "xbm", "XBM Image" },
{ IMAGE_SVG_XML, "svg", "Scalable Vector Graphics" },