From 9f7858b1e35b58755a3b5773778025d8370ca170 Mon Sep 17 00:00:00 2001 From: goodusername123 <61405538+goodusername123@users.noreply.github.com> Date: Thu, 9 Nov 2023 09:30:58 -0600 Subject: [PATCH 1/3] Extend JPEG XL detection/recognition (Part 1/2) First-party changes to Gecko. --- toolkit/components/downloads/DownloadList.sys.mjs | 1 + widget/gtk/nsAppShell.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/toolkit/components/downloads/DownloadList.sys.mjs b/toolkit/components/downloads/DownloadList.sys.mjs index 695b611dc87f0..0e7b2983b5bd8 100644 --- a/toolkit/components/downloads/DownloadList.sys.mjs +++ b/toolkit/components/downloads/DownloadList.sys.mjs @@ -50,6 +50,7 @@ const FILE_EXTENSIONS = [ "jpg", "jpeg", "json", + "jxl", "m4a", "mdb", "mid", diff --git a/widget/gtk/nsAppShell.cpp b/widget/gtk/nsAppShell.cpp index bea837605fe01..3a0adf523f552 100644 --- a/widget/gtk/nsAppShell.cpp +++ b/widget/gtk/nsAppShell.cpp @@ -369,7 +369,8 @@ nsresult nsAppShell::Init() { gchar* name = gdk_pixbuf_format_get_name(format); if (strcmp(name, "jpeg") && strcmp(name, "png") && strcmp(name, "gif") && strcmp(name, "bmp") && strcmp(name, "ico") && strcmp(name, "xpm") && - strcmp(name, "svg") && strcmp(name, "webp") && strcmp(name, "avif")) { + strcmp(name, "svg") && strcmp(name, "webp") && strcmp(name, "avif") && + strcmp(name, "jxl")) { gdk_pixbuf_format_set_disabled(format, TRUE); } g_free(name); From 1d9aea9a3a5464aec0618969f848899911b17969 Mon Sep 17 00:00:00 2001 From: goodusername123 <61405538+goodusername123@users.noreply.github.com> Date: Thu, 9 Nov 2023 09:32:37 -0600 Subject: [PATCH 2/3] Extend JPEG XL detection/recognition (Part 2/2) Third-party changes to Gecko. --- third_party/rust/mime_guess/src/mime_types.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/third_party/rust/mime_guess/src/mime_types.rs b/third_party/rust/mime_guess/src/mime_types.rs index 13c91b7bee77a..d5256c108959b 100644 --- a/third_party/rust/mime_guess/src/mime_types.rs +++ b/third_party/rust/mime_guess/src/mime_types.rs @@ -567,6 +567,7 @@ pub static MIME_TYPES: &[(&str, &[&str])] = &[ ("jsonml", &["application/jsonml+json"]), ("jsx", &["text/jscript"]), ("jsxbin", &["text/plain"]), + ("jxl", &["image/jxl"]), ("kar", &["audio/midi"]), ("karbon", &["application/vnd.kde.karbon"]), ("kfo", &["application/vnd.kde.kformula"]), From 5bf097bce11bf41ecc96948a90c718544d3cd117 Mon Sep 17 00:00:00 2001 From: goodusername123 <61405538+goodusername123@users.noreply.github.com> Date: Wed, 15 Nov 2023 16:52:08 -0600 Subject: [PATCH 3/3] Extend JPEG XL detection/recognition even more (plus AVIF a tiny bit). - registers JXL file association under Windows (also fixes WebP not being removed when uninstalling). - adds JXL and AVIF as recognized image types in file picker dialog. - adds JXL and AVIF to WebExtension downloads.download API. - adds JXL to some inactive part of code for completeness sake. --- browser/components/BrowserContentHandler.sys.mjs | 1 + browser/installer/windows/msix/AppxManifest.xml.in | 1 + browser/installer/windows/nsis/shared.nsh | 1 + browser/installer/windows/nsis/uninstaller.nsi | 2 ++ toolkit/components/extensions/parent/ext-downloads.js | 2 ++ toolkit/content/filepicker.properties | 2 +- 6 files changed, 8 insertions(+), 1 deletion(-) diff --git a/browser/components/BrowserContentHandler.sys.mjs b/browser/components/BrowserContentHandler.sys.mjs index cbb08449bb7cf..e67ff242494d4 100644 --- a/browser/components/BrowserContentHandler.sys.mjs +++ b/browser/components/BrowserContentHandler.sys.mjs @@ -1018,6 +1018,7 @@ function maybeRecordToHandleTelemetry(uri, isLaunch) { ".xhtml", ".svg", ".webp", + ".jxl", ]); if (registeredExtensions.has(extension)) { Services.telemetry.keyedScalarAdd(scalar, extension, 1); diff --git a/browser/installer/windows/msix/AppxManifest.xml.in b/browser/installer/windows/msix/AppxManifest.xml.in index 9fc8e2902d4aa..a3b38e504b7c4 100644 --- a/browser/installer/windows/msix/AppxManifest.xml.in +++ b/browser/installer/windows/msix/AppxManifest.xml.in @@ -66,6 +66,7 @@ .xhtml .svg .webp + .jxl Assets\Document44x44.png diff --git a/browser/installer/windows/nsis/shared.nsh b/browser/installer/windows/nsis/shared.nsh index 2058b4944caf3..f803348dc7a10 100755 --- a/browser/installer/windows/nsis/shared.nsh +++ b/browser/installer/windows/nsis/shared.nsh @@ -544,6 +544,7 @@ ${RemoveDefaultBrowserAgentShortcut} ${AddAssociationIfNoneExist} ".svg" "WaterfoxHTML$5" ${AddAssociationIfNoneExist} ".webp" "WaterfoxHTML$5" ${AddAssociationIfNoneExist} ".avif" "WaterfoxHTML$5" + ${AddAssociationIfNoneExist} ".jxl" "WaterfoxHTML$5" ${AddAssociationIfNoneExist} ".pdf" "WaterfoxPDF$5" diff --git a/browser/installer/windows/nsis/uninstaller.nsi b/browser/installer/windows/nsis/uninstaller.nsi index 9e9fb53bec614..bc109b450ed1f 100755 --- a/browser/installer/windows/nsis/uninstaller.nsi +++ b/browser/installer/windows/nsis/uninstaller.nsi @@ -497,7 +497,9 @@ Section "Uninstall" ${un.RegCleanFileHandler} ".ogv" "WaterfoxHTML-$AppUserModelID" ${un.RegCleanFileHandler} ".webm" "WaterfoxHTML-$AppUserModelID" ${un.RegCleanFileHandler} ".svg" "WaterfoxHTML-$AppUserModelID" + ${un.RegCleanFileHandler} ".webp" "WaterfoxHTML-$AppUserModelID" ${un.RegCleanFileHandler} ".avif" "WaterfoxHTML-$AppUserModelID" + ${un.RegCleanFileHandler} ".jxl" "WaterfoxHTML-$AppUserModelID" ${un.RegCleanFileHandler} ".pdf" "WaterfoxPDF-$AppUserModelID" diff --git a/toolkit/components/extensions/parent/ext-downloads.js b/toolkit/components/extensions/parent/ext-downloads.js index 10c99534c4e0d..1b35efcc8f364 100644 --- a/toolkit/components/extensions/parent/ext-downloads.js +++ b/toolkit/components/extensions/parent/ext-downloads.js @@ -103,6 +103,8 @@ const FILTER_IMAGES_EXTENSIONS = [ "psd", "raw", "webp", + "avif", + "jxl", ]; const FILTER_XML_EXTENSIONS = ["xml"]; diff --git a/toolkit/content/filepicker.properties b/toolkit/content/filepicker.properties index 27b8f4a8fc66d..7555a8b6e5023 100644 --- a/toolkit/content/filepicker.properties +++ b/toolkit/content/filepicker.properties @@ -5,7 +5,7 @@ allFilter=* htmlFilter=*.html; *.htm; *.shtml; *.xhtml textFilter=*.txt; *.text -imageFilter=*.jpe; *.jpg; *.jpeg; *.gif; *.png; *.bmp; *.ico; *.svg; *.svgz; *.tif; *.tiff; *.ai; *.drw; *.pct; *.psp; *.xcf; *.psd; *.raw; *.webp +imageFilter=*.jpe; *.jpg; *.jpeg; *.gif; *.png; *.bmp; *.ico; *.svg; *.svgz; *.tif; *.tiff; *.ai; *.drw; *.pct; *.psp; *.xcf; *.psd; *.raw; *.webp; *.avif; *.jxl xmlFilter=*.xml xulFilter=*.xul audioFilter=*.aac; *.aif; *.flac; *.iff; *.m4a; *.m4b; *.mid; *.midi; *.mp3; *.mpa; *.mpc; *.oga; *.ogg; *.opus; *.ra; *.ram; *.snd; *.wav; *.wma