Closed Bug 1551704 Opened 5 years ago Closed 4 years ago

Consider removing [array] use in xpidl in Thunderbird

Categories

(Thunderbird :: General, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 73.0

People

(Reporter: bzbarsky, Unassigned)

References

(Blocks 1 open bug)

Details

We'd generally like to remove [array] from xpconnect. See bug 1509981.

The replacement is the Array type. So for example, an API like getSubjects() in nsIActivity.idl would change from:

  void getSubjects(out unsigned long length, [retval, array,
                   size_is(length)] out nsIVariant aSubjects);

to

  Array<nsIVariant> getSubjects();

C++ callers would need to change to use nsTArray for the array. JS callers can mostly not change much; in this specific case the aCount argument and setting its .value can go away in nsActivity.js, and JS callers can stop passing the {} argument they ignore.

It looks like there are a few uses in mail/, a bunch in mailnews/, and a bunch in calendar/. I don't know whether those need separate bugs.

Oh, one other heads-up: you can't do Array<string> or Array<wstring>. Generally you would do Array<ACString>, Array<AUTF8String>, or Array<AString> depending on the semantics you want.

Type: defect → task

Thanks for the heads-up. We'll deal with it in the 69 cycle.

I guess we're looking at all these:
https://searchfox.org/comm-central/search?q=retval%2C+array%2C+size_is&case=false&regexp=false&path=

All those, yes but also, for example, these: https://searchfox.org/comm-central/search?q=array%2C+size_is%28aCount%29%2C+retval&path= (the annotations are in a different order).

And also the non-retvals: https://searchfox.org/comm-central/search?q=%5Barray%2C+size_is(aCount)%5D&case=false&regexp=false&path= (plus maybe other names for the size).

What I've been querying for on the m-c side are lines in .idl files that contain both "array" and '['. I've also considered just instrumenting the xpidl parser to spit out the list of things involved; if that would be useful I can probably post a patch for that.

Aceman or Ben, can I get you interested in this. Otherwise Magnus needs to assign someone before this ends up in big bustage.

Flags: needinfo?(mkmelin+mozilla)
Flags: needinfo?(benc)
Flags: needinfo?(acelists)
Depends on: 1557504
Depends on: 1557506
Depends on: 1562152
Depends on: 1562157
Depends on: 1562158
Flags: needinfo?(mkmelin+mozilla)
Flags: needinfo?(acelists)

I'm looking at the ldap ones now then I'll move onto the other C++ ones.
(can look into the JS ones too after that if needed)

Flags: needinfo?(benc)
Depends on: 1604645
Depends on: 1604950
Depends on: 1605603
Depends on: 557504
No longer depends on: 557504

This is now done!

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 73.0

Right. Strangely M-C aren't done yet. If you click on the links in comment #2 and comment #3, you'll see four IDL files in M-C which still use the old syntax.

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