As of bug 1474369 (https://bugzilla.mozilla.org/show_bug.cgi?id=1474369),
xpidl files now support `Array<T>` in type position. These types are
reflected into C++ as '[const] nsTArray<T>&' and into JS as native JS Array
objects.

Array<T> has a few changes compared to [array, size_is(...)]:
 1. Exposed to C++ as `nsTArray` rather than a raw pointer
 2. Supports complex data types:
     a) AString and DOMString as nsString
     b) ACString and AUTF8String as nsCString
     c) jsval as JS::Value (caller-rooted)
     d) nested Array<T> as nsTArray<T>
 3. Stores 'interface' and 'webidl' types in RefPtr<T>

Do note, that unlike [array], Array<T> does not currently support raw
pointer types (e.g. 'string', 'wstring', and 'nsIDPtr'). Adding support for
passing Array<nsID> is on the roadmap, but I'm not working on it at the
moment.

Please use Array<T> instead of [array] for future xpidl interfaces, and
look into converting existing interfaces to the new type. I'd like to
eliminate [size_is(..)] strings and [array] in the near future to reduce
XPConnect complexity and improve ergonomics.

- nika
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to