Closed Bug 1526382 Opened 5 years ago Closed 5 years ago

Support `Array<nsID>` in XPIDL and XPConnect

Categories

(Core :: XPConnect, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla67
Tracking Status
firefox67 --- fixed

People

(Reporter: nika, Assigned: nika)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

This will allow simplifying callers which currently use [array] for this purpose, including nsIClassInfo::GetInterfaces.

Currently the [ref] and [ptr] types share the same underlying
implementation. This is unfortunate, and can cause correctness problems
with outparam refs (as an example).

By using the same tools used to allow other larger objects (such as
jsid, nsTArray, and nsString) to be stored directly in the nsXPTCVariant
object, this patch directly stores the nsID in the nsXPTCVariant object
when calling from JS into C++.

Using this new strategy avoids an nsID* allocation every time we pass
one over XPConnect, and should also allow us to simplify callers.

In addition, some special casing is added to xpidl to make it possible
to use the nsid reference type objects directly inside of Array<T>,
which will allow us to remove [array] nsIIDPtr callers.

This is a follow-up to the previous part, which actually changes one of
these callers to use Array<nsIIDRef> instead of [array] nsIIDPtr.

From doing this patch, it seems like we should consider changing
the type nsIIDRef to instead simply be nsIID, and treat it more like
the AString types from the POV of XPIDL. nsIIDPtr would then
continue to exist for backwards compatibility, but we can probably
remove almost all current consumers over time.

Depends on D19175

No longer blocks: xpidl-warts
Pushed by nlayzell@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9b2bfb8871c9
Part 1: Split nsID& and nsID* in xpconnect, r=mccr8
https://hg.mozilla.org/integration/autoland/rev/b4258349e68b
Part 2: Make nsIClassInfo use Array<nsIIDRef> for 'interfaces', r=mccr8
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
Depends on: 1528907
Depends on: 1529287
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: