Open Bug 1509976 Opened 6 years ago Updated 2 years ago

Replaces XPIDL uses of nsIArray with Array<T>

Categories

(Core :: XPCOM, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: nika, Unassigned, Mentored)

References

(Blocks 1 open bug)

Details

Currently we have a ton of places where we pass around `nsIArray` objects. It would be much nicer to just directly work with xpidl's `Array<T>` instead, both from C++ and JS code. We should switch to this newer type where possible.
Priority: -- → P3

Out of interest, is there any canonical documentation on this? In particular, how the xpidl types map to C++ types?
There are a few hints here and there (eg https://bugzilla.mozilla.org/show_bug.cgi?id=1551704#c1), but mostly I've been looking at patches on Bug 1509981 to try and work it out.

(In reply to Ben Campbell from comment #1)

Out of interest, is there any canonical documentation on this? In particular, how the xpidl types map to C++ types?

https://developer.mozilla.org/en-US/docs/Archive/Mozilla/XPIDL is apparently kept relatively fresh. The information you're looking for is primarily tables 1 and 2 (and probably should be adjusted to add Rust notes too).

Thanks Joshua.
One thing that caused me a few minutes head-scratching just now is that an .idl definiton of:

Array<AString> getFoo()

comes out in C++ as:

NS_IMETHOD GetFoo(nsTArray<nsString >& _retval)

Rather than what I was expecting:

NS_IMETHOD GetFoo(nsTArray<nsAString >& _retval)

ie different to the AString -> nsAString mapping for non-array strings.
It's obvious in hindsight - nsAString is abstract, but the nsTArray needs to hold a concrete class.

Not suggesting any action on this, just wanted to leave breadcrumbs in case anyone else got confused too :-)

See Also: → 1583030
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.