1
0
mirror of https://github.com/roytam1/UXP.git synced 2026-05-26 13:58:49 +00:00
Commit Graph

94 Commits

Author SHA1 Message Date
Moonchild 335ddc41b9 Issue #3030 - Improve image cache entry handling.
This:
- increases max image cache entry size and adjusts related parameters.
- makes the cache entry timeout configurable for advanced tweaking.
- adds a mechanism to keep commonly-used, small image sizes in cache
  longer.
2026-05-15 09:19:17 +08:00
Moonchild 85e32b8238 [image] Don't do unnecessary work if the image is being destroyed. 2026-04-27 11:09:07 +08:00
Moonchild abd19068fb [image] Hold a strong ref on mInnerImage when requesting a refresh. 2026-04-27 10:57:46 +08:00
Moonchild 1a73ec0124 [image] Hold a strong ref on error. 2026-04-27 09:57:40 +08:00
mittorn 1078e45dd3 Issue #2932 - Ensure that imgRequestProxy::CancelAndForgetObserver removes itself from the cache validator
https://hg-edge.mozilla.org/releases/mozilla-beta/rev/af82d0c33427
2026-02-07 21:38:25 +08:00
Moonchild c5cc980506 Issue #2928 - Improve imgLoader cache queue handling.
- Convert the imgCacheQueue to nsTArray from Vector
- Avoid marking the queue dirty when element operations are performed
that don't upset the sort order. This should improve performance as well.
2026-02-07 21:37:51 +08:00
Moonchild 21f4ab5e02 Issue #2928 - Avoid searching the image cache queue for an entry after we just popped it off the queue. 2026-02-07 21:37:33 +08:00
Moonchild 15e076130d Issue #2928 - Always refresh dirty queue. 2026-02-07 21:37:17 +08:00
Moonchild 17338528b7 Issue #2928 - Re-order imgLoader::RemoveFromCache
Remove from tracker first before removing from cache, and if the cache
queue is dirty, refresh it (causes a re-heap) before manipulating further.
2026-02-07 21:37:04 +08:00
trav90 fc78eec911 Issue #1636 - Part 1 - Decouple Gio from GConf and always build it with GTK
Also removes the ancient and unused --enable-gnomeui option.
2026-01-13 23:40:35 +08:00
Moonchild 4667b7f4b0 [image] Use the TriggeringPrincipal if we have one, not the SystemPrincipal 2025-12-17 22:45:33 +08:00
Moonchild 73c9c1dd73 Revert "Issue #2258 - Part 2: Move XCTO:nosniff check into sniffers."
This reverts commit 51e1650d42b2c033d5d55750b4ea497053524c93.
2025-09-26 23:15:12 +08:00
Moonchild 2d4d48db72 Revert "Issue #2258 - Part 3: Allow sniffing with XCTO:nosniff + empty MIME type."
This reverts commit a56f978f70e2d96ba501d6a944be33460afc481a.
2025-09-26 23:14:52 +08:00
Moonchild 707c3e3fa8 Issue #2258 - Part 3: Allow sniffing with XCTO:nosniff + empty MIME type.
This moves the checking code back to NS_SniffContent and specifically
checks requests for either:
- Empty `Content-type` header, OR
- A known JSON MIME type

If present, sniffing is allowed despite `nosniff` because in the first
case this is webmaster error (conflicting `nosniff` without MIME type
would always fail, so sniff it), and in the second case we need this
carveout or our json viewer will break.
2025-08-18 09:47:36 +08:00
Moonchild cca20ae131 Issue #2258 - Part 2: Move XCTO:nosniff check into sniffers.
This fixes a regression for the JSON viewer from part 1 as it relies on
sniffing to prettify (and should carve out the exception even if `nosniff`
headers are sent).
No real functional changes otherwise. Just catering to a corner case.
2025-08-18 09:47:21 +08:00
Moonchild 166b25a42c Issue #2736 - Part 3: Use TriggeringPrincipal for image loads.
The imgLoader code consistently uses the term `loadingPrincipal` for
the principal that is called the `triggeringPrincipal` everywhere else.
This aligns the naming to avoid confusion in later changes.
2025-05-14 14:22:56 +08:00
Moonchild 9ad680cfc4 Issue #2736 - Part 1: Provide more consistent principals to CSP.
We're currently fairly vague and inconsistent about the values we provide to
content policy implementations for requestOrigin and requestPrincipal. In some
cases they're the triggering principal, sometimes the loading principal,
sometimes the channel principal.

Our existing content policy implementations which require or expect a
loading principal currently retrieve it from the context node.
Since no current callers require the principal to be the loading
principal, and some already expect it to be the triggering principal
(which there's currently no other way to retrieve), a choice was made
to pass the triggering principal whenever possible, but use the loading
principal to determine the origin URL.
2025-05-14 14:21:46 +08:00
Moonchild ef5f052d97 Issue #2657 - Remove -moz-samplesize resize-decoding for low-vram mobiles
Resolves #2657
2024-11-21 21:08:24 +08:00
FranklinDM 656ee639c5 Issue #2112 - Part 1: Remove Stylo tests 2024-04-02 22:29:48 +08:00
FranklinDM 06d2df29b4 Issue #1382 - Fix invalid assert for decoder type if JXL is not built on debug builds 2023-06-24 12:22:21 +08:00
Job Bautista 42543c12f0 Issue #2057 - Use gfxPackedPixel + WritePixels instead of WriteBuffer.
This means we no longer need the workarounds intended for #2033 and #2040!
2023-06-24 12:21:32 +08:00
lexx9999 8f09162893 Issue #2041 follow-up - fix macro condition 2023-06-24 12:21:20 +08:00
Job Bautista 54e073511a Issue #2041 Follow-up - Remove opacity check from original patch.
Per Issue #2033 we don't support expanding RGB to RGBA yet, so this opacity
 check will always return RGBX, which makes images with transparent backgrounds
 show up with a black background instead. Feel free to readd once we backport
 Mozilla bug 1551088.
2023-06-24 12:20:48 +08:00
Job Bautista 0bd6f00356 Issue #2048 - Add progressive decoding for JPEG-XL.
Based on Mozilla phab D122159, intended for bug 1709815.
Also moved the temporary RGBA and premultiplication fixes to a macro, since
 progressive decoding also needs these fixes.
2023-06-24 12:20:36 +08:00
Job Bautista 042b8f37ae Issue #2041 - Add animation support for JPEG-XL.
Based on Mozilla phab D122158, intended for bug 1709818.
2023-06-24 12:20:23 +08:00
Moonchild 9b4c0ef4e9 Issue #2040 - Pre-multiply the alpha values in our JXL decode buffer.
Using selective calculation (only if not opaque) and fast integer
math here should optimize well in compilers.
2023-06-24 12:20:09 +08:00
Moonchild 77ca4ae9db Issue #2033 - Temporary fix of R<->B channel swap.
We have a BGR/RGB channel ordering mismatch here. to at least
provide proper display, a quick&dirty byte swap on the output
buffer will fix this for now, but we should look into seeing where
the surface mismatch is caused.
std::swap() should optimize pretty well in any of the used
compilers, but if necessary, a full buffer ASM routine can be
slotted in (although on current hardware I doubt this will be
even noticeable as it is)
2023-06-24 12:19:25 +08:00
Job Bautista 134c5e94e8 Issue #1769 - Part 2 Follow-up: Do not use namespace parent::child {} for defining nested namespaces.
It doesn't build for MSVC on Windows. Also other decoders are using the old
 way for defining nested namespaces, so better be consistent here.
2023-06-24 12:17:19 +08:00
Job Bautista 2df558509f Issue #1769 - Part 3: Cleanup nsJXLDecoder.
The mp4parse Rust component has been removed in Issue #58. It doesn't seem
 like the decoder uses any mp4parse function, so seems like it's safe to
 remove it.
Removed const DecoderType named GetType() because we don't have it in our
 Decoder.h.
I've decided to abandon the OS_RGBA backporting effort and instead went for
 using OS_RGBA's value which is R8G8B8A8. Turns out that there is much more
 going on in Mozilla's version of CreateSurfacePipe than I've expected, like
 the aInFormat and aOutFormat thing which I really don't want to delve into
 right now. Looking at the code it looks like all JPEG-XL images are expected
 to have an alpha channel anyway, so I think my workaround should be safe.
I also removed the dependency in OrientedIntSize and used Size() from gfx/2d/
 Point.h like our PNG and GIF decoders currently do. Migrating our decoders
 to OrientedInt types should be done in another PR instead.
Also also changed the coding style to be closer to UXP's.
Also also also, I made a mistake in Part 1's commit message; the commit used
for libjxl is 192ddd90fdf0c69cd1db1c8d7850db036dd87f4b.
2023-06-24 12:16:41 +08:00
Job Bautista 51ea0e4f3a Issue #1769 - Part 2: Implement JPEG-XL decoder and about:config and MIME plumbing.
Backported from Mozilla bug 1707590 whereever possible.
2023-06-24 12:16:27 +08:00
Moonchild cc6ef1f3b1 No issue - Limit JPEG decoder memory allocation to surface cache size.
This means that for trivial images whose header specifies large
dimensions but with no image data, we don't waste a lot of memory.
See BZ bug 1277397
2023-05-11 09:27:46 +08:00
Moonchild d388e478a0 Issue #1656 - Remove more vim control lines.
Vim control lines were re-introduced or not entirely cleaned up.
This nukes them again.
Removing from the rest of js, caps, chrome, config, devtools, docshell,
image, intl. More to come.
2023-05-04 10:46:38 +08:00
FranklinDM b7f217e5ad Issue #2073 - Follow-up: Use internal Move instead of std::move for consistency 2023-04-30 21:25:05 +08:00
FranklinDM 93644fd33e Issue #2218 - Part 2: Make SurfaceCache free ImageSurfaceCache objects outside of the lock
Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1389479
2023-04-30 21:24:49 +08:00
Martok 845411a7ad Issue #2073 - m-c 1454149: Do not advance animated images which are not displayed 2023-01-10 07:31:40 +08:00
Martok a6a420259c Issue #2073 - m-c 1546500: Avoid dispatching synchronous thread shutdown runnables 2023-01-10 07:31:26 +08:00
Martok 9a39001cc3 Issue #2073 - m-c 1651587: Make image::Image release efficient on main thread 2023-01-10 07:31:09 +08:00
Martok 03a4a17ccf Issue #2073 - m-c 1383404: make SourceBuffer::Compact more efficient (squashed)
The first part also means that Compact no longer needs the SurfaceCache lock (used to be via CreateChunk->CanHold),
which avoids potential deadlocks during shutdown that m-c 523950 would otherwise cause
2023-01-10 07:30:55 +08:00
Martok e96122ede2 Issue #2073 - m-c 523950: Discard decoded frames of very large GIF animations (squashed)
Controlled by image.animated.decode-on-demand.threshold-kb, default 256MB

Includes squashed bugfixes/regressions:
 - m-c 1444537: Shutting down the decode pool should make animated decoders bail early
 - m-c 1628606: Make sure to mark the surface cache entry available before sending the frame complete notification
 - m-c 1502275: Skip recreating the decoder after redecode errors if an animated image is reset
 - m-c 1443232: Don't insert frames into our AnimationFrameBuffer that we consider in error and unusable
2023-01-10 07:30:36 +08:00
Martok eac8afce35 Issue #2073 - m-c 1343341: Infrastructure necessary to allow discarding of animated images (squashed)
Includes squashed changes of:
 - m-c 1317907: Refactor FrameAnimator::GetCompositedFrame to be a bit simpler
 - m-c 1351434: bugfix
 - m-c 686905: Enable the pref image.mem.animated.discardable to allow discarding of animated images
2023-01-10 07:29:50 +08:00
Martok 7d75c2717f Issue #2073 - m-c 1382683: Accelerate GIF decoding to SurfacePipe
1. Implement SurfacePipe::WritePixelBlocks for faster writing of pixels
2. Switch nsGIFDecoder2 to write pixels in blocks instead of individually
2023-01-10 07:29:36 +08:00
Moonchild e69b52eac1 Hold some strong references on nsRefreshDriver 2022-10-27 09:03:27 +08:00
Job Bautista e40697c0c6 Issue #1926 - Update image/Orientation.h 2022-06-22 09:03:10 +08:00
roytam1 6ec59e7984 image: sync with https://repo.palemoon.org/MoonchildProductions/UXP/commit/8e42fccca66d06b664ecc3c7345dc787a26ef4d9 2022-05-31 09:36:20 +08:00
Brian Smith 13fcc4a046 Issue #1829 - Revert "Issue #1751" 2022-05-04 09:40:24 +08:00
FranklinDM 8a7587b401 Issue #21 - Remove use counters telemetry
This reverts Bug 968923 - Implement some equivalent of Chrome's use counters (on top of telemetry?)

For reference: https://bugzilla.mozilla.org/show_bug.cgi?id=968923
2022-04-28 10:43:09 +08:00
Moonchild eaf9e756a0 Issue #21 - Remove remaining telemetry structs, callers and flags. 2022-04-28 10:33:44 +08:00
Moonchild 8d800b1cb0 Issue #21 - Remove Telemetry plumbing and fix build.
Note this won't give working applications. Requires FE changes and
additional js module changes (next part).
2022-04-28 10:25:48 +08:00
roytam1 92a1cc3139 Revert "Issue #21 - Remove use counters telemetry"
This reverts commit 8ca9db6b65.
2022-04-27 16:25:00 +08:00
FranklinDM 8ca9db6b65 Issue #21 - Remove use counters telemetry
This reverts Bug 968923 - Implement some equivalent of Chrome's use counters (on top of telemetry?)

For reference: https://bugzilla.mozilla.org/show_bug.cgi?id=968923
2022-04-27 16:15:31 +08:00