diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 732ed3ebbfb9..a2686e6bbfe2 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -452,7 +452,7 @@ pref("browser.download.alwaysOpenInSystemViewerContextMenuItem", true); // Open downloaded file types internally for the given types. // This is a comma-separated list, the empty string ("") means no types are // viewable internally. -pref("browser.download.viewableInternally.enabledTypes", "xml,svg,webp,avif"); +pref("browser.download.viewableInternally.enabledTypes", "xml,svg,webp,avif,jxl"); // This controls whether the button is automatically shown/hidden depending diff --git a/browser/components/downloads/DownloadsViewableInternally.jsm b/browser/components/downloads/DownloadsViewableInternally.jsm index 0860f3e56e22..c675c99858f0 100644 --- a/browser/components/downloads/DownloadsViewableInternally.jsm +++ b/browser/components/downloads/DownloadsViewableInternally.jsm @@ -161,6 +161,20 @@ let DownloadsViewableInternally = { }, // available getter is set by initAvailable() }, + { + extension: "jxl", + mimeTypes: ["image/jxl"], + initAvailable() { + XPCOMUtils.defineLazyPreferenceGetter( + this, + "available", + "image.jxl.enabled", + false, + () => DownloadsViewableInternally._updateHandler(this) + ); + }, + // available getter is set by initAvailable() + }, { extension: "pdf", mimeTypes: ["application/pdf"], diff --git a/dom/tests/browser/browser_persist_image_accept.js b/dom/tests/browser/browser_persist_image_accept.js index fc9b8c8e6d22..f3de9e379d58 100644 --- a/dom/tests/browser/browser_persist_image_accept.js +++ b/dom/tests/browser/browser_persist_image_accept.js @@ -50,6 +50,7 @@ function expectedImageAcceptHeader() { return ( (Services.prefs.getBoolPref("image.avif.enabled") ? "image/avif," : "") + + (Services.prefs.getBoolPref("image.jxl.enabled") ? "image/jxl," : "") + (Services.prefs.getBoolPref("image.webp.enabled") ? "image/webp," : "") + "*/*" ); diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index 402c43d9e11f..26f7bed0ad94 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -188,6 +188,10 @@ static nsCString ImageAcceptHeader() { mimeTypes.Append("image/avif,"); } + if (mozilla::StaticPrefs::image_jxl_enabled()) { + mimeTypes.Append("image/jxl,"); + } + if (mozilla::StaticPrefs::image_webp_enabled()) { mimeTypes.Append("image/webp,"); } @@ -355,6 +359,7 @@ static const char* gCallbackPrefs[] = { DOM_SECURITY_PREFIX, "image.http.accept", "image.avif.enabled", + "image.jxl.enabled", "image.webp.enabled", nullptr, }; @@ -1831,6 +1836,7 @@ void nsHttpHandler::PrefsChanged(const char* pref) { const bool imageAcceptPrefChanged = PREF_CHANGED("image.http.accept") || PREF_CHANGED("image.avif.enabled") || + PREF_CHANGED("image.jxl.enabled") || PREF_CHANGED("image.webp.enabled"); if (imageAcceptPrefChanged) {