uniffi-rs icon indicating copy to clipboard operation
uniffi-rs copied to clipboard

Add support for Gecko C++ and JS consumers

Open rfk opened this issue 2 years ago • 2 comments

In the early days of developing this tool, we had concrete plans to integrate UniFFI comoponents into Desktop Firefox for JS consumers, and we landed a prototype C++/WebIDL/JS bindings backend that could support them. A subsequent iteration of the tool lead to us prototyping an API for consumption by C++ consumers. In both cases, we did not end up shipping any production UniFFI components into Desktop Firefox.

In https://github.com/mozilla/uniffi-rs/pull/990 I am proposing to remove the prototype Gecko bindings backend to simplify ongoing development of UniFFI, and I plan to close out some older issue tracking proposed changes to it.

Instead, let's use this issue to gather context and serve as the entry point for a future effort to ship UniFFI components into Desktop Firefox, whenever we next come to that.

┆Issue is synchronized with this Jira Task ┆Issue Number: UNIFFI-75

rfk avatar Aug 02 '21 03:08 rfk

Here are some high-level notes and context on where we got to with this effort last time; you can also find some good historical artifacts by searching closed issues/prs for the string "gecko".

  • There's some great historical commentary on the initial landing of the GeckoJS backend in #11.
  • There is a suite of design-docs and prototype code linked in this issue comment which will be a great starting point, although some details need updating. In particular:
  • Additional work-in-progress PRs in #285 and #255.
  • Some issues that were not fully addressed in those initial docs include:
    • How to handle blocking IO, especially for C++ consumers? Ref #298.
      • Some initial work on making the C++ calls asynchronous in PR #350.
    • How to test the bindings, without having to build all of Gecko in our CI? Ref #272.
    • How much will this affect the compiled binary size of Firefox? We already have some trouble landing Rust code that significantly increases the size of the compiled artifact.

rfk avatar Aug 02 '21 03:08 rfk

Love your summary (and your format of documenting "here's pointers to what we learned the last time we tried this"—totally gonna steal that)! The Gecko stuff always felt like a "look, we can do this, omg!" prototype, with a long, long tail of fixes and integration work needed to actually make it real—and it shouldn't be holding back all the other cool things you've been doing with it!

❤️❤️❤️ that autofill, FxA client, logins, and tabs are all UniFFIed now, it's been so exciting seeing (from the sidelines, at least 🥺) this take off!

Miss you all!

linabutler avatar Aug 02 '21 03:08 linabutler

if I refactor what has been removed here: https://github.com/mozilla/uniffi-rs/pull/990 could we have a new bindings on javascript with uniffi-rs please?

gogo2464 avatar Sep 07 '23 18:09 gogo2464

if I refactor what has been removed here: #990 could we have a new bindings on javascript with uniffi-rs please?

There is nothing to refactor. The code from #990 integrates with the JavaScript engine of Gecko (what powers Firefox). It's mostly C++ code (and some IDL), only really useful directly in Gecko. It's newer and supported version now lives here: https://searchfox.org/mozilla-central/source/toolkit/components/uniffi-bindgen-gecko-js

JavaScript bindings would need to be build from scratch, and we currently are not working on any.

fwiw, I'm closing this issue as its initial intent is met.

badboy avatar Sep 07 '23 20:09 badboy