I am constantly tripping up between using .Data() and .get() for nsACString vs nsAutoString, and likewise .Count() and .GetLength() for nsCOMArray and nsIArray and probably many more. I'm not sure if this falls in the purview of MFBT, but it sure would be nice to have unified APIs so that developers don't have to waste time or mental energy accommodating for these differences.
The functions/classes you name are XPCOM, so this probably belongs there.
Component: MFBT → XPCOM
.Data() can be used just fine for nsAutoString, or indeed any string. .get() has totally different behavior from .Data(). Specifically, it guarantees null-termination. That's why there are two different APIs: they do different things. nsCOMArray should just be removed, and we have bugs on that.
nsCOMArray should not be removed unless we can prove that nsTArray<nsCOMPtr> has the same codesize benefits (it did not when I last measured). Bug 493711 made nsCOMArray support the same basic method names as nsTArray, I think. nsIArray is probably not changeable given the addon-compat issues.
You need to log in before you can comment on or make changes to this bug.