Backed out changeset 6c865ed1f998 (bug 1641389) for perma failures on test_animation_operators.html. CLOSED TREE

This commit is contained in:
Razvan Maries 2020-05-28 05:43:40 +03:00
parent 7aa4fa01c1
commit b65c634b01
6 changed files with 21 additions and 5 deletions

View File

@ -7,7 +7,6 @@
#include "nsMimeTypes.h"
#include "mozilla/RefPtr.h"
#include "mozilla/StaticPrefs_image.h"
#include "AnimationSurfaceProvider.h"
#include "Decoder.h"
@ -77,7 +76,8 @@ DecoderType DecoderFactory::GetDecoderType(const char* aMimeType) {
type = DecoderType::ICON;
// WebP
} else if (!strcmp(aMimeType, IMAGE_WEBP)) {
} else if (!strcmp(aMimeType, IMAGE_WEBP) &&
StaticPrefs::image_webp_enabled()) {
type = DecoderType::WEBP;
// AVIF

View File

@ -58,8 +58,13 @@ nsresult mozilla::image::EnsureModuleInitialized() {
static ImageEnablementCookie kAVIFCookie = {
mozilla::StaticPrefs::image_avif_enabled,
NS_LITERAL_CSTRING("image/avif")};
static ImageEnablementCookie kWebPCookie = {
mozilla::StaticPrefs::image_webp_enabled,
NS_LITERAL_CSTRING("image/webp")};
Preferences::RegisterCallbackAndCall(UpdateContentViewerRegistration,
"image.avif.enabled", &kAVIFCookie);
Preferences::RegisterCallbackAndCall(UpdateContentViewerRegistration,
"image.webp.enabled", &kWebPCookie);
mozilla::image::ShutdownTracker::Initialize();
mozilla::image::ImageFactory::Initialize();

View File

@ -36,8 +36,12 @@ AutoInitializeImageLib::AutoInitializeImageLib() {
EXPECT_TRUE(NS_IsMainThread());
sImageLibInitialized = true;
// Ensure WebP is enabled to run decoder tests.
nsresult rv = Preferences::SetBool("image.webp.enabled", true);
EXPECT_TRUE(rv == NS_OK);
// Ensure AVIF is enabled to run decoder tests.
nsresult rv = Preferences::SetBool("image.avif.enabled", true);
rv = Preferences::SetBool("image.avif.enabled", true);
EXPECT_TRUE(rv == NS_OK);
// Ensure that ImageLib services are initialized.

View File

@ -159,7 +159,7 @@ function runTests()
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("untriaged");
runTests();
SpecialPowers.pushPrefEnv({"set": [["image.webp.enabled", true]]}, runTests);
</script>
</pre>

View File

@ -37,7 +37,8 @@ var gNumDiscards = 0;
window.onload = function() {
// Enable discarding for the test.
SpecialPowers.pushPrefEnv({
'set':[['image.mem.discardable',true]]
'set':[['image.mem.discardable',true],
['image.webp.enabled',true]]
}, runTest);
}

View File

@ -4589,6 +4589,12 @@
value: -1
mirror: once
# Whether we attempt to decode WebP images or not.
- name: image.webp.enabled
type: RelaxedAtomicBool
value: true
mirror: always
# Whether we attempt to decode AVIF images or not.
- name: image.avif.enabled
type: RelaxedAtomicBool