Skip to content

Commit

Permalink
Merge pull request #5634 from noaione/complete-jxl-support
Browse files Browse the repository at this point in the history
Implement a more complete JXL features
  • Loading branch information
mauro-balades authored Mar 2, 2025
2 parents 85c54ed + 46f6d28 commit 39f4f4f
Show file tree
Hide file tree
Showing 15 changed files with 574 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Cargo-lock.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Cargo.lock b/Cargo.lock
index 0609d96f01ded85dccf2c931d3c553be61432e6a..8ce4374dd31b4ce818c8bb548fbfb2669014b05b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3919,8 +3919,6 @@ dependencies = [
[[package]]
name = "mime_guess"
version = "2.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef"
dependencies = [
"mime",
"unicase",
14 changes: 14 additions & 0 deletions src/Cargo-toml.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/Cargo.toml b/Cargo.toml
index 29942b65f62497b80d63675501ae063c393943a7..a9aa4641421038fbe5b0ecd9b7353611eecefffe 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -198,6 +198,9 @@ rure = { path = "third_party/rust/rure" }
# Patch `plist` to work with `indexmap` 2.*
plist = { path = "third_party/rust/plist" }

+# Patch mime_guess to add missing mime types
+mime_guess = { path = "third_party/rust/mime_guess" }
+
# To-be-published changes.
unicode-bidi = { git = "https://github.com/servo/unicode-bidi", rev = "ca612daf1c08c53abe07327cb3e6ef6e0a760f0c" }
nss-gk-api = { git = "https://github.com/beurdouche/nss-gk-api", rev = "e48a946811ffd64abc78de3ee284957d8d1c0d63" }
12 changes: 12 additions & 0 deletions src/browser/components/BrowserContentHandler-sys-mjs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/browser/components/BrowserContentHandler.sys.mjs b/browser/components/BrowserContentHandler.sys.mjs
index 7aef091c0be1cb0ea0be52268949db17032f96d9..5e9105fa671d1b1979f204fc8d3be22771998ad7 100644
--- a/browser/components/BrowserContentHandler.sys.mjs
+++ b/browser/components/BrowserContentHandler.sys.mjs
@@ -1278,6 +1278,7 @@ function maybeRecordToHandleTelemetry(uri, isLaunch) {
".avif",
".htm",
".html",
+ ".jxl",
".pdf",
".shtml",
".xht",
12 changes: 12 additions & 0 deletions src/browser/installer/windows/msix/AppxManifest-xml-in.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/browser/installer/windows/msix/AppxManifest.xml.in b/browser/installer/windows/msix/AppxManifest.xml.in
index b81a73518a183b7b1d178793886c66f44651058d..89690a4177229b70013bcf35ec1d805fff7e1b26 100644
--- a/browser/installer/windows/msix/AppxManifest.xml.in
+++ b/browser/installer/windows/msix/AppxManifest.xml.in
@@ -61,6 +61,7 @@
<uap:FileType>.avif</uap:FileType>
<uap:FileType>.htm</uap:FileType>
<uap:FileType>.html</uap:FileType>
+ <uap:FileType>.jxl</uap:FileType>
<uap:FileType>.pdf</uap:FileType>
<uap:FileType>.shtml</uap:FileType>
<uap:FileType>.xht</uap:FileType>
46 changes: 46 additions & 0 deletions src/browser/installer/windows/nsis/shared-nsh.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff --git a/browser/installer/windows/nsis/shared.nsh b/browser/installer/windows/nsis/shared.nsh
index b7f8e1453089ab5f1945e1a65f038e17b5273571..5297f5ed70fe3446e55be37df486fb4ad791a446 100644
--- a/browser/installer/windows/nsis/shared.nsh
+++ b/browser/installer/windows/nsis/shared.nsh
@@ -513,6 +513,7 @@ ${RemoveDefaultBrowserAgentShortcut}
${AddAssociationIfNoneExist} ".svg" "FirefoxHTML$5"
${AddAssociationIfNoneExist} ".webp" "FirefoxHTML$5"
${AddAssociationIfNoneExist} ".avif" "FirefoxHTML$5"
+ ${AddAssociationIfNoneExist} ".jxl" "FirefoxHTML$5"

${AddAssociationIfNoneExist} ".pdf" "FirefoxPDF$5"

@@ -609,6 +610,7 @@ ${RemoveDefaultBrowserAgentShortcut}
WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".svg" "FirefoxHTML$2"
WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".webp" "FirefoxHTML$2"
WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".avif" "FirefoxHTML$2"
+ WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".jxl" "FirefoxHTML$2"

WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".pdf" "FirefoxPDF$2"

@@ -681,6 +683,7 @@ ${RemoveDefaultBrowserAgentShortcut}
${WriteApplicationsSupportedType} ${RegKey} ".webm"
${WriteApplicationsSupportedType} ${RegKey} ".webp"
${WriteApplicationsSupportedType} ${RegKey} ".avif"
+ ${WriteApplicationsSupportedType} ${RegKey} ".jxl"
${WriteApplicationsSupportedType} ${RegKey} ".xht"
${WriteApplicationsSupportedType} ${RegKey} ".xhtml"
${WriteApplicationsSupportedType} ${RegKey} ".xml"
@@ -1728,6 +1731,8 @@ Function SetAsDefaultAppUserHKCU
Pop $0
AppAssocReg::SetAppAsDefault "$R9" ".avif" "file"
Pop $0
+ AppAssocReg::SetAppAsDefault "$R9" ".jxl" "file"
+ Pop $0
AppAssocReg::SetAppAsDefault "$R9" ".xht" "file"
Pop $0
AppAssocReg::SetAppAsDefault "$R9" ".xhtml" "file"
@@ -1857,7 +1862,7 @@ FunctionEnd
; uninstalled.

; Do all of that twice, once for the local machine and once for the current user
-
+
; Remove protocol handlers
ClearErrors
ReadRegStr $0 HKLM "Software\Classes\${_PROTOCOL}\DefaultIcon" ""
12 changes: 12 additions & 0 deletions src/browser/installer/windows/nsis/uninstaller-nsi.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/browser/installer/windows/nsis/uninstaller.nsi b/browser/installer/windows/nsis/uninstaller.nsi
index 559c8b46ee06bc42c91da49b5d9e397fe8ff6126..62094a5d98712a41a607ba01ca2adfa1e4f51ccd 100644
--- a/browser/installer/windows/nsis/uninstaller.nsi
+++ b/browser/installer/windows/nsis/uninstaller.nsi
@@ -507,6 +507,7 @@ Section "Uninstall"
${un.RegCleanFileHandler} ".svg" "FirefoxHTML-$AppUserModelID"
${un.RegCleanFileHandler} ".webp" "FirefoxHTML-$AppUserModelID"
${un.RegCleanFileHandler} ".avif" "FirefoxHTML-$AppUserModelID"
+ ${un.RegCleanFileHandler} ".jxl" "FirefoxHTML-$AppUserModelID"

${un.RegCleanFileHandler} ".pdf" "FirefoxPDF-$AppUserModelID"

32 changes: 32 additions & 0 deletions src/image/DecoderFactory-cpp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
diff --git a/image/DecoderFactory.cpp b/image/DecoderFactory.cpp
index f36f03c7f2..d2cdd79f70 100644
--- a/image/DecoderFactory.cpp
+++ b/image/DecoderFactory.cpp
@@ -244,7 +244,12 @@ nsresult DecoderFactory::CreateAnimationDecoder(
}

MOZ_ASSERT(aType == DecoderType::GIF || aType == DecoderType::PNG ||
- aType == DecoderType::WEBP || aType == DecoderType::AVIF,
+ aType == DecoderType::WEBP || aType == DecoderType::AVIF
+#ifdef MOZ_JXL
+ || aType == DecoderType::JXL,
+#else
+ ,
+#endif
"Calling CreateAnimationDecoder for non-animating DecoderType");

// Create an anonymous decoder. Interaction with the SurfaceCache and the
@@ -299,7 +304,12 @@ already_AddRefed<Decoder> DecoderFactory::CloneAnimationDecoder(
// rediscover it is animated).
DecoderType type = aDecoder->GetType();
MOZ_ASSERT(type == DecoderType::GIF || type == DecoderType::PNG ||
- type == DecoderType::WEBP || type == DecoderType::AVIF,
+ type == DecoderType::WEBP || type == DecoderType::AVIF
+#ifdef MOZ_JXL
+ || aType == DecoderType::JXL,
+#else
+ ,
+#endif
"Calling CloneAnimationDecoder for non-animating DecoderType");

RefPtr<Decoder> decoder = GetDecoder(type, nullptr, /* aIsRedecode = */ true);
Loading

0 comments on commit 39f4f4f

Please sign in to comment.