fune/toolkit/components/uniffi-js
Ben Dean-Kawamura bcea304dfa Bug 1786673 - Additional UniFFI type checking r=markh,skhamis
- Implemented `checkType` on more UniFFI FFIConverters.
- Updated the way we handle locating the errors.
   - The old system was that `checkType` inputted a `name` parameter.  I
     think the idea was that parent types would calculate a name
     parameter for their children.  However, this wasn't great because
     it meant we would need to build the strings up-front and throw
     them away in the vast majority of cases where there was no type
     error.
   - The new system is that we use the `UniFFITypeError` class, which
     has a `prependPath` method.  This gets called by the parent type
     FFIConverter to basically do the same work, but it only needs to
     happen when there's actually an error.
   - I think the resulting error messages are pretty good.  I got this
     when passing a list with garbage data to setLocalTabs: "TypeError:
     remoteTabs[0].title: undefined is not a string"
- Added the `UniFFI.sys.mjs` module, which contains shared, non-generated,
  UniFFI JS code.  This is prep-work for
  https://bugzilla.mozilla.org/show_bug.cgi?id=1804078.

Differential Revision: https://phabricator.services.mozilla.com/D166479
2023-01-17 16:07:40 +00:00
..
js Bug 1786673 - Additional UniFFI type checking r=markh,skhamis 2023-01-17 16:07:40 +00:00
moz.build Bug 1786673 - Additional UniFFI type checking r=markh,skhamis 2023-01-17 16:07:40 +00:00
OwnedRustBuffer.cpp
OwnedRustBuffer.h
README.md
ScaffoldingCall.h
ScaffoldingConverter.h
UniFFICallbacks.cpp Bug 1788306: UniFFI callback interfaces, r=nika 2023-01-03 20:57:53 +00:00
UniFFICallbacks.h Bug 1788306: UniFFI callback interfaces, r=nika 2023-01-03 20:57:53 +00:00
UniFFIFixtureScaffolding.cpp Bug 1788306: UniFFI callback interfaces, r=nika 2023-01-03 20:57:53 +00:00
UniFFIGeneratedScaffolding.cpp Bug 1788306: UniFFI callback interfaces, r=nika 2023-01-03 20:57:53 +00:00
UniFFIPointer.cpp
UniFFIPointer.h
UniFFIPointerType.h
UniFFIRust.h Bug 1788306: UniFFI callback interfaces, r=nika 2023-01-03 20:57:53 +00:00
UniFFIScaffolding.cpp Bug 1788306: UniFFI callback interfaces, r=nika 2023-01-03 20:57:53 +00:00
UniFFIScaffolding.h Bug 1788306: UniFFI callback interfaces, r=nika 2023-01-03 20:57:53 +00:00

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 code for all non-testing UDL files.
    • UniFFIFixtureScaffolding.cpp contains generated code for test fixture UDL files. It's only compiled if --enable-uniffi-fixtures is set.
    • UniFFIScaffolding.cpp is a facade that wraps UniFFIFixtureScaffolding, and UniFFIGeneratedScaffolding if enabled, to implement the interface.
  • ScaffoldingConverter.h, ScaffoldingCall.h contain generic code to make the scaffolding calls. In general, we try to keep the logic of the calls in these files and limit the generated code to routing call IDs to template classes defined here.

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

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