Closed Bug 1759214 Opened 2 years ago Closed 2 years ago

Support arbitrary filetypes in RemoteImages

Categories

(Firefox :: Messaging System, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
102 Branch
Tracking Status
firefox102 --- fixed

People

(Reporter: barret, Assigned: barret)

References

Details

Attachments

(1 file, 1 obsolete file)

It turns out we can create a Blob with type: application/octet-stream for any binary image type and the resulting URL from URL.createObjectURL will render correctly. The only issue is SVG, which must have a mimetype of image/svg+xml to render.

this could theoretically allow us to write .exe or .dmg files to disk, which is less than ideal. Instead lets support the image types listed on MDN.

Attachment #9267463 - Attachment description: Bug 1759214 - Support arbitary filetypes in RemoteImages r?mardak → Bug 1759214 - Support all image types Firefox supports in RemoteImages r?mardak
Attachment #9267463 - Attachment is obsolete: true

This is a rewrite of large portions of RemoteImages. Previously, RemoteImages
just relied on the presence of correctly-names files on disk for its cache. Now
we are keeping proper track of what images we've saved via a JSONFile store.
This removes the need for embedding extensions in image IDs -- images
previously referenced as, e.g., "heart.png" can now be referenced without their
extension e.g., "heart". However, for backwards compatability, image IDs with
extensions will still be accepted, but the extension will be stripped off and
ignored.

Instead, we keep track of the mimetype (as reported by Remote Settings) in our
database, as well as the last time we loaded the image (instead of relying on
the last modified time from the filesystem, which is where we were caching that
information previously).

Additionally, some cleanup has been done to prevent image loading while cleanup
is ocurring and vice versa. All interactions that would modify the database go
through RemoteImages#withDb, which executes a closure with the JSONFile
instance. This closure is a critical section and multiple closures are
prevented from executing at once.

Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8410da1dc02c
Support arbitrary filetypes in RemoteImages r=Mardak
Regressions: 1769164
Flags: needinfo?(brennie)
Flags: needinfo?(brennie)
Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8ae68262ff90
Support arbitrary filetypes in RemoteImages r=Mardak
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 102 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: