зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1712147 - Add more missing MOZ_JXL checks r=tnikkel
This removes the check from static prefs, mainly since it's hard to check MOZ_JXL in JS side. It can be a bit confusing but generally shouldn't be harmful. Differential Revision: https://phabricator.services.mozilla.com/D115704
This commit is contained in:
Родитель
f1987ffe07
Коммит
abd3d9776e
|
@ -58,10 +58,8 @@ nsresult mozilla::image::EnsureModuleInitialized() {
|
||||||
|
|
||||||
static ImageEnablementCookie kAVIFCookie = {
|
static ImageEnablementCookie kAVIFCookie = {
|
||||||
mozilla::StaticPrefs::image_avif_enabled, "image/avif"_ns};
|
mozilla::StaticPrefs::image_avif_enabled, "image/avif"_ns};
|
||||||
#ifdef MOZ_JXL
|
|
||||||
static ImageEnablementCookie kJXLCookie = {
|
static ImageEnablementCookie kJXLCookie = {
|
||||||
mozilla::StaticPrefs::image_jxl_enabled, "image/jxl"_ns};
|
mozilla::StaticPrefs::image_jxl_enabled, "image/jxl"_ns};
|
||||||
#endif
|
|
||||||
static ImageEnablementCookie kWebPCookie = {
|
static ImageEnablementCookie kWebPCookie = {
|
||||||
mozilla::StaticPrefs::image_webp_enabled, "image/webp"_ns};
|
mozilla::StaticPrefs::image_webp_enabled, "image/webp"_ns};
|
||||||
Preferences::RegisterCallbackAndCall(UpdateContentViewerRegistration,
|
Preferences::RegisterCallbackAndCall(UpdateContentViewerRegistration,
|
||||||
|
|
|
@ -135,7 +135,9 @@ static int RunDecodeToSurfaceFuzzingJXL(nsCOMPtr<nsIInputStream> inputStream) {
|
||||||
|
|
||||||
int FuzzingInitImage(int* argc, char*** argv) {
|
int FuzzingInitImage(int* argc, char*** argv) {
|
||||||
Preferences::SetBool("image.avif.enabled", true);
|
Preferences::SetBool("image.avif.enabled", true);
|
||||||
|
#ifdef MOZ_JXL
|
||||||
Preferences::SetBool("image.jxl.enabled", true);
|
Preferences::SetBool("image.jxl.enabled", true);
|
||||||
|
#endif
|
||||||
|
|
||||||
nsCOMPtr<imgITools> imgTools =
|
nsCOMPtr<imgITools> imgTools =
|
||||||
do_CreateInstance("@mozilla.org/image/tools;1");
|
do_CreateInstance("@mozilla.org/image/tools;1");
|
||||||
|
@ -168,5 +170,7 @@ MOZ_FUZZING_INTERFACE_STREAM(FuzzingInitImage, RunDecodeToSurfaceFuzzingWebP,
|
||||||
MOZ_FUZZING_INTERFACE_STREAM(FuzzingInitImage, RunDecodeToSurfaceFuzzingAVIF,
|
MOZ_FUZZING_INTERFACE_STREAM(FuzzingInitImage, RunDecodeToSurfaceFuzzingAVIF,
|
||||||
ImageAVIF);
|
ImageAVIF);
|
||||||
|
|
||||||
|
#ifdef MOZ_JXL
|
||||||
MOZ_FUZZING_INTERFACE_STREAM(FuzzingInitImage, RunDecodeToSurfaceFuzzingJXL,
|
MOZ_FUZZING_INTERFACE_STREAM(FuzzingInitImage, RunDecodeToSurfaceFuzzingJXL,
|
||||||
ImageJXL);
|
ImageJXL);
|
||||||
|
#endif
|
||||||
|
|
|
@ -47,9 +47,11 @@ AutoInitializeImageLib::AutoInitializeImageLib() {
|
||||||
rv = Preferences::SetBool("image.avif.enabled", true);
|
rv = Preferences::SetBool("image.avif.enabled", true);
|
||||||
EXPECT_TRUE(rv == NS_OK);
|
EXPECT_TRUE(rv == NS_OK);
|
||||||
|
|
||||||
|
#ifdef MOZ_JXL
|
||||||
// Ensure JXL is enabled to run decoder tests.
|
// Ensure JXL is enabled to run decoder tests.
|
||||||
rv = Preferences::SetBool("image.jxl.enabled", true);
|
rv = Preferences::SetBool("image.jxl.enabled", true);
|
||||||
EXPECT_TRUE(rv == NS_OK);
|
EXPECT_TRUE(rv == NS_OK);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Ensure that ImageLib services are initialized.
|
// Ensure that ImageLib services are initialized.
|
||||||
nsCOMPtr<imgITools> imgTools =
|
nsCOMPtr<imgITools> imgTools =
|
||||||
|
@ -442,10 +444,6 @@ ImageTestCase GreenAVIFTestCase() {
|
||||||
.WithSurfaceFlags(SurfaceFlags::TO_SRGB_COLORSPACE);
|
.WithSurfaceFlags(SurfaceFlags::TO_SRGB_COLORSPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageTestCase GreenJXLTestCase() {
|
|
||||||
return ImageTestCase("green.jxl", "image/jxl", IntSize(100, 100));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Forcing sRGB is required until nsAVIFDecoder supports ICC profiles
|
// Forcing sRGB is required until nsAVIFDecoder supports ICC profiles
|
||||||
// See bug 1634741
|
// See bug 1634741
|
||||||
ImageTestCase Transparent10bit420AVIFTestCase() {
|
ImageTestCase Transparent10bit420AVIFTestCase() {
|
||||||
|
@ -824,11 +822,6 @@ ImageTestCase LargeAVIFTestCase() {
|
||||||
TEST_CASE_IGNORE_OUTPUT);
|
TEST_CASE_IGNORE_OUTPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageTestCase LargeJXLTestCase() {
|
|
||||||
return ImageTestCase("large.jxl", "image/jxl", IntSize(1200, 660),
|
|
||||||
TEST_CASE_IGNORE_OUTPUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageTestCase GreenWebPIccSrgbTestCase() {
|
ImageTestCase GreenWebPIccSrgbTestCase() {
|
||||||
return ImageTestCase("green.icc_srgb.webp", "image/webp", IntSize(100, 100));
|
return ImageTestCase("green.icc_srgb.webp", "image/webp", IntSize(100, 100));
|
||||||
}
|
}
|
||||||
|
@ -925,11 +918,6 @@ ImageTestCase TransparentWebPTestCase() {
|
||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageTestCase TransparentJXLTestCase() {
|
|
||||||
return ImageTestCase("transparent.jxl", "image/jxl", IntSize(1200, 1200),
|
|
||||||
TEST_CASE_IS_TRANSPARENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageTestCase TransparentNoAlphaHeaderWebPTestCase() {
|
ImageTestCase TransparentNoAlphaHeaderWebPTestCase() {
|
||||||
ImageTestCase test("transparent-no-alpha-header.webp", "image/webp",
|
ImageTestCase test("transparent-no-alpha-header.webp", "image/webp",
|
||||||
IntSize(100, 100), TEST_CASE_IS_FUZZY);
|
IntSize(100, 100), TEST_CASE_IS_FUZZY);
|
||||||
|
@ -1019,11 +1007,6 @@ ImageTestCase DownscaledAVIFTestCase() {
|
||||||
IntSize(20, 20));
|
IntSize(20, 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageTestCase DownscaledJXLTestCase() {
|
|
||||||
return ImageTestCase("downscaled.jxl", "image/jxl", IntSize(100, 100),
|
|
||||||
IntSize(20, 20));
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageTestCase DownscaledTransparentICOWithANDMaskTestCase() {
|
ImageTestCase DownscaledTransparentICOWithANDMaskTestCase() {
|
||||||
// This test case is an ICO with AND mask transparency. We want to ensure that
|
// This test case is an ICO with AND mask transparency. We want to ensure that
|
||||||
// we can downscale it without crashing or triggering ASAN failures, but its
|
// we can downscale it without crashing or triggering ASAN failures, but its
|
||||||
|
@ -1106,6 +1089,27 @@ ImageTestCase PerfRgbGIFTestCase() {
|
||||||
return ImageTestCase("perf_srgb.gif", "image/gif", IntSize(1000, 1000));
|
return ImageTestCase("perf_srgb.gif", "image/gif", IntSize(1000, 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_JXL
|
||||||
|
ImageTestCase GreenJXLTestCase() {
|
||||||
|
return ImageTestCase("green.jxl", "image/jxl", IntSize(100, 100));
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageTestCase DownscaledJXLTestCase() {
|
||||||
|
return ImageTestCase("downscaled.jxl", "image/jxl", IntSize(100, 100),
|
||||||
|
IntSize(20, 20));
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageTestCase LargeJXLTestCase() {
|
||||||
|
return ImageTestCase("large.jxl", "image/jxl", IntSize(1200, 660),
|
||||||
|
TEST_CASE_IGNORE_OUTPUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageTestCase TransparentJXLTestCase() {
|
||||||
|
return ImageTestCase("transparent.jxl", "image/jxl", IntSize(1200, 1200),
|
||||||
|
TEST_CASE_IS_TRANSPARENT);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ImageTestCase ExifResolutionTestCase() {
|
ImageTestCase ExifResolutionTestCase() {
|
||||||
return ImageTestCase("exif_resolution.jpg", "image/jpeg", IntSize(100, 50));
|
return ImageTestCase("exif_resolution.jpg", "image/jpeg", IntSize(100, 50));
|
||||||
}
|
}
|
||||||
|
|
|
@ -476,7 +476,6 @@ ImageTestCase GreenICOTestCase();
|
||||||
ImageTestCase GreenIconTestCase();
|
ImageTestCase GreenIconTestCase();
|
||||||
ImageTestCase GreenWebPTestCase();
|
ImageTestCase GreenWebPTestCase();
|
||||||
ImageTestCase GreenAVIFTestCase();
|
ImageTestCase GreenAVIFTestCase();
|
||||||
ImageTestCase GreenJXLTestCase();
|
|
||||||
|
|
||||||
ImageTestCase Transparent10bit420AVIFTestCase();
|
ImageTestCase Transparent10bit420AVIFTestCase();
|
||||||
ImageTestCase Transparent10bit422AVIFTestCase();
|
ImageTestCase Transparent10bit422AVIFTestCase();
|
||||||
|
@ -516,7 +515,6 @@ ImageTestCase Gray12bitFullRangeGrayscaleAVIFTestCase();
|
||||||
ImageTestCase StackCheckAVIFTestCase();
|
ImageTestCase StackCheckAVIFTestCase();
|
||||||
|
|
||||||
ImageTestCase LargeWebPTestCase();
|
ImageTestCase LargeWebPTestCase();
|
||||||
ImageTestCase LargeJXLTestCase();
|
|
||||||
ImageTestCase GreenWebPIccSrgbTestCase();
|
ImageTestCase GreenWebPIccSrgbTestCase();
|
||||||
|
|
||||||
ImageTestCase GreenFirstFrameAnimatedGIFTestCase();
|
ImageTestCase GreenFirstFrameAnimatedGIFTestCase();
|
||||||
|
@ -536,7 +534,6 @@ ImageTestCase CorruptICOWithBadBppTestCase();
|
||||||
ImageTestCase TransparentPNGTestCase();
|
ImageTestCase TransparentPNGTestCase();
|
||||||
ImageTestCase TransparentGIFTestCase();
|
ImageTestCase TransparentGIFTestCase();
|
||||||
ImageTestCase TransparentWebPTestCase();
|
ImageTestCase TransparentWebPTestCase();
|
||||||
ImageTestCase TransparentJXLTestCase();
|
|
||||||
ImageTestCase TransparentNoAlphaHeaderWebPTestCase();
|
ImageTestCase TransparentNoAlphaHeaderWebPTestCase();
|
||||||
ImageTestCase FirstFramePaddingGIFTestCase();
|
ImageTestCase FirstFramePaddingGIFTestCase();
|
||||||
ImageTestCase TransparentIfWithinICOBMPTestCase(TestCaseFlags aFlags);
|
ImageTestCase TransparentIfWithinICOBMPTestCase(TestCaseFlags aFlags);
|
||||||
|
@ -554,7 +551,6 @@ ImageTestCase DownscaledBMPTestCase();
|
||||||
ImageTestCase DownscaledICOTestCase();
|
ImageTestCase DownscaledICOTestCase();
|
||||||
ImageTestCase DownscaledIconTestCase();
|
ImageTestCase DownscaledIconTestCase();
|
||||||
ImageTestCase DownscaledWebPTestCase();
|
ImageTestCase DownscaledWebPTestCase();
|
||||||
ImageTestCase DownscaledJXLTestCase();
|
|
||||||
ImageTestCase DownscaledTransparentICOWithANDMaskTestCase();
|
ImageTestCase DownscaledTransparentICOWithANDMaskTestCase();
|
||||||
|
|
||||||
ImageTestCase TruncatedSmallGIFTestCase();
|
ImageTestCase TruncatedSmallGIFTestCase();
|
||||||
|
@ -582,6 +578,13 @@ ImageTestCase LargeAVIFTestCase();
|
||||||
ImageTestCase MultiLayerAVIFTestCase();
|
ImageTestCase MultiLayerAVIFTestCase();
|
||||||
ImageTestCase TransparentAVIFTestCase();
|
ImageTestCase TransparentAVIFTestCase();
|
||||||
|
|
||||||
|
#ifdef MOZ_JXL
|
||||||
|
ImageTestCase GreenJXLTestCase();
|
||||||
|
ImageTestCase DownscaledJXLTestCase();
|
||||||
|
ImageTestCase LargeJXLTestCase();
|
||||||
|
ImageTestCase TransparentJXLTestCase();
|
||||||
|
#endif
|
||||||
|
|
||||||
ImageTestCase ExifResolutionTestCase();
|
ImageTestCase ExifResolutionTestCase();
|
||||||
|
|
||||||
RefPtr<Image> TestCaseToDecodedImage(const ImageTestCase&);
|
RefPtr<Image> TestCaseToDecodedImage(const ImageTestCase&);
|
||||||
|
|
|
@ -680,7 +680,9 @@ IMAGE_GTEST_DECODER_BASE_F(BMP)
|
||||||
IMAGE_GTEST_DECODER_BASE_F(ICO)
|
IMAGE_GTEST_DECODER_BASE_F(ICO)
|
||||||
IMAGE_GTEST_DECODER_BASE_F(Icon)
|
IMAGE_GTEST_DECODER_BASE_F(Icon)
|
||||||
IMAGE_GTEST_DECODER_BASE_F(WebP)
|
IMAGE_GTEST_DECODER_BASE_F(WebP)
|
||||||
|
#ifdef MOZ_JXL
|
||||||
IMAGE_GTEST_DECODER_BASE_F(JXL)
|
IMAGE_GTEST_DECODER_BASE_F(JXL)
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST_F(ImageDecoders, ICOWithANDMaskDownscaleDuringDecode) {
|
TEST_F(ImageDecoders, ICOWithANDMaskDownscaleDuringDecode) {
|
||||||
CheckDownscaleDuringDecode(DownscaledTransparentICOWithANDMaskTestCase());
|
CheckDownscaleDuringDecode(DownscaledTransparentICOWithANDMaskTestCase());
|
||||||
|
@ -865,9 +867,11 @@ TEST_F(ImageDecoders, AVIFDownscaleDuringDecode) {
|
||||||
CheckDownscaleDuringDecode(DownscaledAVIFTestCase());
|
CheckDownscaleDuringDecode(DownscaledAVIFTestCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_JXL
|
||||||
TEST_F(ImageDecoders, JXLLargeMultiChunk) {
|
TEST_F(ImageDecoders, JXLLargeMultiChunk) {
|
||||||
CheckDecoderMultiChunk(LargeJXLTestCase(), /* aChunkSize */ 64);
|
CheckDecoderMultiChunk(LargeJXLTestCase(), /* aChunkSize */ 64);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST_F(ImageDecoders, AnimatedGIFSingleChunk) {
|
TEST_F(ImageDecoders, AnimatedGIFSingleChunk) {
|
||||||
CheckDecoderSingleChunk(GreenFirstFrameAnimatedGIFTestCase());
|
CheckDecoderSingleChunk(GreenFirstFrameAnimatedGIFTestCase());
|
||||||
|
|
|
@ -87,6 +87,7 @@ TEST_F(ImageLoader, DetectAVIFCompatibleBrand) {
|
||||||
CheckMimeType(buffer, sizeof(buffer), IMAGE_AVIF);
|
CheckMimeType(buffer, sizeof(buffer), IMAGE_AVIF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_JXL
|
||||||
TEST_F(ImageLoader, DetectJXLCodestream) {
|
TEST_F(ImageLoader, DetectJXLCodestream) {
|
||||||
const char buffer[] = "\xff\x0a";
|
const char buffer[] = "\xff\x0a";
|
||||||
CheckMimeType(buffer, sizeof(buffer), IMAGE_JXL);
|
CheckMimeType(buffer, sizeof(buffer), IMAGE_JXL);
|
||||||
|
@ -99,6 +100,7 @@ TEST_F(ImageLoader, DetectJXLContainer) {
|
||||||
"\x0d\x0a\x87\x0a";
|
"\x0d\x0a\x87\x0a";
|
||||||
CheckMimeType(buffer, sizeof(buffer), IMAGE_JXL);
|
CheckMimeType(buffer, sizeof(buffer), IMAGE_JXL);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST_F(ImageLoader, DetectNonImageMP4) {
|
TEST_F(ImageLoader, DetectNonImageMP4) {
|
||||||
const char buffer[] =
|
const char buffer[] =
|
||||||
|
|
|
@ -153,10 +153,13 @@ TEST_F(ImageDecoderMetadata, BMP) { CheckMetadata(GreenBMPTestCase()); }
|
||||||
TEST_F(ImageDecoderMetadata, ICO) { CheckMetadata(GreenICOTestCase()); }
|
TEST_F(ImageDecoderMetadata, ICO) { CheckMetadata(GreenICOTestCase()); }
|
||||||
TEST_F(ImageDecoderMetadata, Icon) { CheckMetadata(GreenIconTestCase()); }
|
TEST_F(ImageDecoderMetadata, Icon) { CheckMetadata(GreenIconTestCase()); }
|
||||||
TEST_F(ImageDecoderMetadata, WebP) { CheckMetadata(GreenWebPTestCase()); }
|
TEST_F(ImageDecoderMetadata, WebP) { CheckMetadata(GreenWebPTestCase()); }
|
||||||
|
|
||||||
|
#ifdef MOZ_JXL
|
||||||
TEST_F(ImageDecoderMetadata, JXL) { CheckMetadata(GreenJXLTestCase()); }
|
TEST_F(ImageDecoderMetadata, JXL) { CheckMetadata(GreenJXLTestCase()); }
|
||||||
TEST_F(ImageDecoderMetadata, TransparentJXL) {
|
TEST_F(ImageDecoderMetadata, TransparentJXL) {
|
||||||
CheckMetadata(TransparentJXLTestCase());
|
CheckMetadata(TransparentJXLTestCase());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST_F(ImageDecoderMetadata, AnimatedGIF) {
|
TEST_F(ImageDecoderMetadata, AnimatedGIF) {
|
||||||
CheckMetadata(GreenFirstFrameAnimatedGIFTestCase());
|
CheckMetadata(GreenFirstFrameAnimatedGIFTestCase());
|
||||||
|
|
|
@ -29,7 +29,7 @@ skip-if(Android&&webrender) include ico/reftest.list
|
||||||
include jpeg/reftest.list
|
include jpeg/reftest.list
|
||||||
|
|
||||||
# JXL tests
|
# JXL tests
|
||||||
skip-if(Android) include jxl/reftest.list
|
skip-if(Android||!jxl) include jxl/reftest.list
|
||||||
|
|
||||||
# GIF tests
|
# GIF tests
|
||||||
include gif/reftest.list
|
include gif/reftest.list
|
||||||
|
|
|
@ -528,7 +528,7 @@ function BuildConditionSandbox(aURL) {
|
||||||
// that isn't available to drawSnapshot (like any sort of
|
// that isn't available to drawSnapshot (like any sort of
|
||||||
// compositor feature such as async scrolling).
|
// compositor feature such as async scrolling).
|
||||||
sandbox.unsupportedWithDrawSnapshot = g.useDrawSnapshot;
|
sandbox.unsupportedWithDrawSnapshot = g.useDrawSnapshot;
|
||||||
|
|
||||||
sandbox.retainedDisplayList =
|
sandbox.retainedDisplayList =
|
||||||
prefs.getBoolPref("layout.display-list.retain") && !sandbox.useDrawSnapshot;
|
prefs.getBoolPref("layout.display-list.retain") && !sandbox.useDrawSnapshot;
|
||||||
|
|
||||||
|
@ -569,6 +569,12 @@ function BuildConditionSandbox(aURL) {
|
||||||
sandbox.webrtc = false;
|
sandbox.webrtc = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MOZ_JXL
|
||||||
|
sandbox.jxl = true;
|
||||||
|
#else
|
||||||
|
sandbox.jxl = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
let retainedDisplayListsEnabled = prefs.getBoolPref("layout.display-list.retain", false);
|
let retainedDisplayListsEnabled = prefs.getBoolPref("layout.display-list.retain", false);
|
||||||
sandbox.retainedDisplayLists = retainedDisplayListsEnabled && !g.compareRetainedDisplayLists && !sandbox.useDrawSnapshot;
|
sandbox.retainedDisplayLists = retainedDisplayListsEnabled && !g.compareRetainedDisplayLists && !sandbox.useDrawSnapshot;
|
||||||
sandbox.compareRetainedDisplayLists = g.compareRetainedDisplayLists;
|
sandbox.compareRetainedDisplayLists = g.compareRetainedDisplayLists;
|
||||||
|
|
|
@ -5513,13 +5513,11 @@
|
||||||
value: true
|
value: true
|
||||||
mirror: always
|
mirror: always
|
||||||
|
|
||||||
#ifdef MOZ_JXL
|
|
||||||
# Whether we attempt to decode JXL images or not.
|
# Whether we attempt to decode JXL images or not.
|
||||||
- name: image.jxl.enabled
|
- name: image.jxl.enabled
|
||||||
type: RelaxedAtomicBool
|
type: RelaxedAtomicBool
|
||||||
value: false
|
value: false
|
||||||
mirror: always
|
mirror: always
|
||||||
#endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Prefs starting with "intl."
|
# Prefs starting with "intl."
|
||||||
|
|
Загрузка…
Ссылка в новой задаче