nsISupportsArray and friends are deprecated, slated for removal in 55

Skip to first unread message

Eric Rahm

Nov 15, 2016, 4:21:40 PM11/15/16
to dev-platform
nsISupportsArray, nsICollection, nsIEnumerator, nsIBidirectionalEnumerator
have all been marked as deprecated in their IDL declarations as of Firefox
52 (currently dev edition).

This is not a new thing -- they've been semi-deprecated for 12 years [1] --
we just never fully removed them.

Over the years there's been a ton of work to remove usages of the
interfaces. I recently did a fair amount of work in bug 792209 [2] to
finish off getting rid of all remaining usage in mozilla-central and to
make our alternative, nsIArray, behave like nsISupportsArray in order to
make it easier to transition add-ons.

*What does this mean?*

Not that much, just please don't use those interfaces. You should see a
slew of warnings if you do (in C++ at least).

*How can I help?*

*comm-central* - mailnews/calendar still has some usage [3], if you have
some spare cycles to help out I'm sure they would appreciate it. If we
can't get rid of the usage by release 55 I still plan on removing the IDL
files from mozilla-central, it's possible we can move the definitions to
comm-central instead.

*add-ons* - Are you an add-on dev? Do you know an add-on dev? Transition
your code from using those interfaces or encourage the developer of your
favorite add-on to do so.

*What do I use instead?*

*nsIArray* and *nsIMutableArray* along with nsISimpleEnumerator are the
recommended replacements. For the most part they are drop-in compatible
with nsISupportsArray.

In C++ code if you need a new mutable array just use:

> nsCOMPtr<nsIMutableArray> arr = nsArray::Create();

In JavaScript:

> let arr = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);


[2] https://bugzilla.mozilla.org/show_bug.cgi?id=792209
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=394167
Reply all
Reply to author
0 new messages