Closed Bug 1606575 Opened 5 years ago Closed 1 year ago

Need a formatFileSize API

Categories

(Thunderbird :: Add-Ons: Extensions API, enhancement)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED
125 Branch

People

(Reporter: standard8, Assigned: TbSync)

Details

Attachments

(4 files)

nsIMessenger.formatFileSize is used throughout Thunderbird to provide a consistent file size formatting for users.

Whilst WebExtensions could simulate it, it would seem better to expose it via an API so that it could be consistent.

We can't expose it only where we have APIs that return sizes, as a WebExtension may be displaying other sizes (e.g. pending attachments) that need to be formatted.

Severity: normal → S3

This API will be populated with utility methods useful for extension
developers. The main goal is to be consistent across add-ons and not
forcing add-ons to re-invent methods which already exist in Thunderbird.

If Thunderbrid decides to change the output of these functions, all
add-ons using them will automatically be adjusted as well.

Assignee: nobody → john
Status: NEW → ASSIGNED

Currently add-on developers try to do manual parsing, which is error
prone. It is true that they could load a third party library, but
exposing this makes it so much easier.

Depends on D204473

Target Milestone: --- → 125 Branch

Pushed by daniel@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/11c83faa7fe0
Add messengerUtilities API including a formatFileSize() method. r=mkmelin
https://hg.mozilla.org/comm-central/rev/5ce39dffae42
Add parseMailboxString() to messengerUtilities API. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Pushed by benc@thunderbird.net: https://hg.mozilla.org/comm-central/rev/3ffef1eed480 Follow-up to fix locale issue with formatFileSize. r=benc

Pushed by daniel@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/e0343a9db270
Follow-up to fix missing "optional" property in schema definition. r=mkmelin

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: