Skip to content

Commit

Permalink
Bug 1641389 - Remove image.webp.enabled pref, always on by default. r…
Browse files Browse the repository at this point in the history
…=tnikkel

Differential Revision: https://phabricator.services.mozilla.com/D77182
  • Loading branch information
aosmond committed May 28, 2020
1 parent 6685919 commit 994485e
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 21 deletions.
4 changes: 2 additions & 2 deletions image/DecoderFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "nsMimeTypes.h"
#include "mozilla/RefPtr.h"
#include "mozilla/StaticPrefs_image.h"

#include "AnimationSurfaceProvider.h"
#include "Decoder.h"
Expand Down Expand Up @@ -76,8 +77,7 @@ DecoderType DecoderFactory::GetDecoderType(const char* aMimeType) {
type = DecoderType::ICON;

// WebP
} else if (!strcmp(aMimeType, IMAGE_WEBP) &&
StaticPrefs::image_webp_enabled()) {
} else if (!strcmp(aMimeType, IMAGE_WEBP)) {
type = DecoderType::WEBP;

// AVIF
Expand Down
5 changes: 0 additions & 5 deletions image/build/nsImageModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,8 @@ 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();
Expand Down
6 changes: 1 addition & 5 deletions image/test/gtest/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,8 @@ 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.
rv = Preferences::SetBool("image.avif.enabled", true);
nsresult rv = Preferences::SetBool("image.avif.enabled", true);
EXPECT_TRUE(rv == NS_OK);

// Ensure that ImageLib services are initialized.
Expand Down
2 changes: 1 addition & 1 deletion image/test/mochitest/test_animation_operators.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("untriaged");

SpecialPowers.pushPrefEnv({"set": [["image.webp.enabled", true]]}, runTests);
runTests();

</script>
</pre>
Expand Down
3 changes: 1 addition & 2 deletions image/test/mochitest/test_discardAnimatedImage.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
window.onload = function() {
// Enable discarding for the test.
SpecialPowers.pushPrefEnv({
'set':[['image.mem.discardable',true],
['image.webp.enabled',true]]
'set':[['image.mem.discardable',true]]
}, runTest);
}

Expand Down
6 changes: 0 additions & 6 deletions modules/libpref/init/StaticPrefList.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4589,12 +4589,6 @@
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
Expand Down

0 comments on commit 994485e

Please sign in to comment.