gecko-dev/toolkit/components/uniffi-js
Ben Dean-Kawamura a55ba11b63 Bug 1928737 - callback interface fixes, r=markh
There were 2 issues:
  - I didn't finish renaming `free` to `destroy` in all places.
  - The code in CallbackInterfaceRuntime.sys.mjs was still expecting an
    ArrayBuffer with serialized arguments, rather than an array with
    each argument separately.  The tests were passing because of a
    lack of typing and dumb luck.   Added some more tests to hopefully
    avoid this in the future.

There's a few other changes as well:
- Moved the callbacks fixture to using proc-macros.
- Added an if in the template code to avoid an `AppendElements` call with 0 elements.
- Made `uniffiArgs` an `nsTArray` rather than a `Sequence`.  `nsTArray`
  is easier to find in the docs and it's what the `Call` method expects
  anyways.

Differential Revision: https://phabricator.services.mozilla.com/D227763
2024-11-04 18:32:45 +00:00
..
js
moz.build
OwnedRustBuffer.cpp
OwnedRustBuffer.h
README.md
ScaffoldingConverter.h
UniFFICall.cpp
UniFFICall.h
UniFFICallbacks.cpp
UniFFICallbacks.h
UniFFIGeneratedScaffolding.cpp Bug 1928737 - callback interface fixes, r=markh 2024-11-04 18:32:45 +00:00
UniFFIPointer.cpp
UniFFIPointer.h
UniFFIPointerType.h
UniFFIRust.h
UniFFIScaffolding.cpp
UniFFIScaffolding.h

uniffi-js

This directory contains C++ helper code for the UniFFI Rust library (https://github.com/mozilla/uniffi-rs/).

  • UniFFIPointer.* and UniFFIPointerType.* implement the UniFFIPointer WebIDL class

  • UniFFI*Scaffolding.cpp implements the UniFFIScaffolding WebIDL class.

    • UniFFIGeneratedScaffolding.cpp contains the generated C++ code
    • UniFFIScaffolding.cpp is a facade that wraps UniFFIFixtureScaffolding, and UniFFIGeneratedScaffolding if enabled, to implement the interface.
  • ScaffoldingConverter.h contain helper code to convert values between JS and Rust. This is used by the generated code to make scaffolding calls.

  • OwnedRustBuffer.* implements a C++ class to help manager ownership of a RustBuffer.

  • UniFFIRust.h contains definitions for the C functions that UniFFI exports.