On Mon, Apr 9, 2018 at 1:22 AM, Henri Sivonen <hsivo...@hsivonen.fi> wrote:
> In order to remove XPIDL interfaces when corresponding Web Platform > features are available, I've been trying to get our internal JS code > to switch from nsIScriptableUnicodeConverter to TextDecoder and > TextEncoder. > > The main problem is that XPCOM streams expose binary buffers as JS > strings where the lower half of each UTF-16 code unit is a byte value > whereas new Web Platform APIs use Uint8Array for binary. > > It seems that we have some Uint8Array support in XPIDL, but it > involves rather complicated XPIDL syntax, so it's easier to figure out > how to use ACString. > > Do we have the following and documentation is just lacking? If not, > should we have these? > > > * Ability to declare Uint8Array in XPIDL with the same ease as ACString > We don't have this, unless you count passing a jsval. I think you're really asking for integration with the WebIDL TypedArray C++ helpers, which allow you to interface with a TypedArray idiomatically and ignore the fact that it's backed by a JS Object. Adding this would be straightforward but a bit of work. Would need a new builtin XPIDL type and support for it in all the right places. > * Ability to pass a Uint8Array from JS to an XPIDL method that takes > an ACString > We don't have this, but we do have code to pass a Uint8Array as an XPIDL [array]. Reworking that same code to support an ACString target is probably pretty easy. > * Have a method in nsIScriptableInputStream to read an Uint8Buffer > with the same ease as reading the string and without the complication > of nsIBinaryInputStream.readArrayBuffer(). > I don't have anything useful to say on this one. > > -- > Henri Sivonen > hsivo...@hsivonen.fi > https://hsivonen.fi/ > _______________________________________________ > dev-platform mailing list > dev-platform@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-platform > _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform