tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

rust-calls.md (2443B)


Rust Calls from JavaScript

Background

Sync Rust calls

* The first argument to callSync() is a numeric identifier for the FFI call, known to both the JavaScript and C++ code generators. * That is followed by lowered argument from the JavaScript call.

This code is statically linked to the Rust code, so it can make this call directly.

Wrapped-async calls

Async calls

Note: The generated code does not handle cancellation or the foreign_future_dropped_callback. In JavaScript once an async task has started running, there's no way to force it to stop. Other JavaScript bindings have handled this by passing an Abort Controller as an extra argument to async functions, maybe we could also do this in the future.