Open Bug 1552149 Opened 5 years ago Updated 2 years ago

Convert Set/Get methods taking a single array into attributes

Categories

(Toolkit :: Places, defect, P3)

defect
Points:
3

Tracking

()

People

(Reporter: mak, Unassigned)

References

Details

After Bug 1551779 converts our idls into Array<>, it looks like in a lot of cases (setTransitions, setParents...) we may go with an attribute instead, that is nicer for js consumers.

This could be split into single replacements mentored bugs.

It's a little dangerous to have an attribute that allocates a new array object on every get. People are much more likely to write inefficient code that iterates the array and allocates it anew for every item, effectively...

But as long as we avoid that, it's fine.

That's a good point, we'd need a way (lint?) to avoid that, that seems complicate.
I noticed a few consumers using Array <> with attribute https://searchfox.org/mozilla-central/search?q=attribute+Array<&case=false&regexp=false&path=.idl and surely there's no automated check currently, so it's all based on review DD.
Let's keep this on the backburner for now, we may have some kind of checks in the future, or just wonfix.
It's likely also a good habit to avoid these Array attributes until we have an answer.

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