gecko-dev/third_party/rust/tabs
Daisuke Akatsuka 13acbcec4a Bug 1874990: Vendor application-services into mozilla-central r=supply-chain-reviewers,lina,markh
Differential Revision: https://phabricator.services.mozilla.com/D198756
2024-01-19 02:44:40 +00:00
..
src Bug 1874990: Vendor application-services into mozilla-central r=supply-chain-reviewers,lina,markh 2024-01-19 02:44:40 +00:00
.cargo-checksum.json Bug 1874990: Vendor application-services into mozilla-central r=supply-chain-reviewers,lina,markh 2024-01-19 02:44:40 +00:00
Cargo.toml Bug 1872201 - vendor new app-services, updating rusqlite/libsqlite3-sys. r=teshaq,supply-chain-reviewers 2024-01-11 16:33:59 +00:00
README.md
build.rs Bug 1812615 - Update to Glean v52.2.0, glean_parser 7.0.0 and UniFFI 0.23. r=chutten,markh,glandium,supply-chain-reviewers 2023-01-31 11:12:05 +00:00
uniffi.toml Bug 1840044 - Update to Glean 53.1.0, UniFFI 0.24.1 and latest application-services. r=TravisLong,nika,markh,supply-chain-reviewers 2023-07-26 15:34:27 +00:00

README.md

Synced Tabs Component

status-img

Implementation Overview

This crate implements an in-memory syncing engine for remote tabs.

Directory structure

The relevant directories are as follows:

  • src: The meat of the library. This contains cross-platform rust code that implements the syncing of tabs.
  • ffi: The Rust public FFI bindings. This is a (memory-unsafe, by necessity) API that is exposed to Kotlin and Swift. It leverages the ffi_support crate to avoid many issues and make it more safe than it otherwise would be. It uses protocol buffers for marshalling data over the FFI.
  • android: This contains android bindings to synced tabs, written in Kotlin. These use JNA to call into to the code in ffi.
  • ios: This contains the iOS binding to synced tabs, written in Swift. These use Swift's native support for calling code written in C to call into the code in ffi.

Features

  • Synchronization of the local and remote session states.

Business Logic

Storage

The storage is all done in memory for simplicity purposes. The host applications are free to persist the remote tabs list if it makes sense to them.

Payload format

Every remote sync record is roughly a list of tabs with their URL history (think of the back button). There is one record for each client.

Association with device IDs

Each remote tabs sync record is associated to a "client" using a client_id field, which is really a foreign-key to a clients collection record. However, because we'd like to move away from the clients collection, which is why this crate associates these records with Firefox Accounts device ids. Currently for platforms using the sync-manager provided in this repo, the client_id is really the Firefox Accounts device ID and all is well, however for older platforms it is a distinct ID, which is why we have to feed the clients collection to this Tabs Sync engine to associate the correct Firefox Account device id.

Getting started

Prerequisites: Firefox account authentication is necessary to obtain the keys to decrypt synced tabs data. See the android-components FxA Client readme for details on how to implement on Android. For iOS, Firefox for iOS still implement the legacy oauth.

Platform-specific details:

API Documentation

  • TODO

Testing

Telemetry

Examples