diff --git a/.cargo/config.toml.in b/.cargo/config.toml.in index 3f6f8e2dca56..7e1dcde99a15 100644 --- a/.cargo/config.toml.in +++ b/.cargo/config.toml.in @@ -60,9 +60,9 @@ git = "https://github.com/mozilla-spidermonkey/jsparagus" rev = "61f399c53a641ebd3077c1f39f054f6d396a633c" replace-with = "vendored-sources" -[source."git+https://github.com/mozilla/application-services?rev=dbeaef2eb28e9da7cc2f96e26296513cc4e07c07"] +[source."git+https://github.com/mozilla/application-services?rev=b94438a80dc0e6b9fbd521ac99b032dd1e95608b"] git = "https://github.com/mozilla/application-services" -rev = "dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" +rev = "b94438a80dc0e6b9fbd521ac99b032dd1e95608b" replace-with = "vendored-sources" [source."git+https://github.com/mozilla/audioipc?rev=e6f44a2bd1e57d11dfc737632a9e849077632330"] diff --git a/Cargo.lock b/Cargo.lock index 0e406dab1556..d06e7d10f29e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1708,7 +1708,7 @@ dependencies = [ [[package]] name = "error-support" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=dbeaef2eb28e9da7cc2f96e26296513cc4e07c07#dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" +source = "git+https://github.com/mozilla/application-services?rev=b94438a80dc0e6b9fbd521ac99b032dd1e95608b#b94438a80dc0e6b9fbd521ac99b032dd1e95608b" dependencies = [ "error-support-macros", "lazy_static", @@ -1720,7 +1720,7 @@ dependencies = [ [[package]] name = "error-support-macros" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=dbeaef2eb28e9da7cc2f96e26296513cc4e07c07#dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" +source = "git+https://github.com/mozilla/application-services?rev=b94438a80dc0e6b9fbd521ac99b032dd1e95608b#b94438a80dc0e6b9fbd521ac99b032dd1e95608b" dependencies = [ "proc-macro2", "quote", @@ -2374,7 +2374,7 @@ dependencies = [ "uniffi-fixture-refcounts", "url", "viaduct", - "webext_storage_bridge", + "webext-storage", "webrender_bindings", "wgpu_bindings", "wpf-gpu-raster", @@ -3036,7 +3036,7 @@ dependencies = [ [[package]] name = "interrupt-support" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=dbeaef2eb28e9da7cc2f96e26296513cc4e07c07#dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" +source = "git+https://github.com/mozilla/application-services?rev=b94438a80dc0e6b9fbd521ac99b032dd1e95608b#b94438a80dc0e6b9fbd521ac99b032dd1e95608b" dependencies = [ "lazy_static", "parking_lot", @@ -4250,7 +4250,7 @@ dependencies = [ [[package]] name = "nss_build_common" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=dbeaef2eb28e9da7cc2f96e26296513cc4e07c07#dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" +source = "git+https://github.com/mozilla/application-services?rev=b94438a80dc0e6b9fbd521ac99b032dd1e95608b#b94438a80dc0e6b9fbd521ac99b032dd1e95608b" [[package]] name = "nsstring" @@ -4463,7 +4463,7 @@ checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" [[package]] name = "payload-support" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=dbeaef2eb28e9da7cc2f96e26296513cc4e07c07#dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" +source = "git+https://github.com/mozilla/application-services?rev=b94438a80dc0e6b9fbd521ac99b032dd1e95608b#b94438a80dc0e6b9fbd521ac99b032dd1e95608b" dependencies = [ "serde", "serde_derive", @@ -4935,7 +4935,7 @@ checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "relevancy" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=dbeaef2eb28e9da7cc2f96e26296513cc4e07c07#dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" +source = "git+https://github.com/mozilla/application-services?rev=b94438a80dc0e6b9fbd521ac99b032dd1e95608b#b94438a80dc0e6b9fbd521ac99b032dd1e95608b" dependencies = [ "anyhow", "base64 0.21.3", @@ -4958,7 +4958,7 @@ dependencies = [ [[package]] name = "remote_settings" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=dbeaef2eb28e9da7cc2f96e26296513cc4e07c07#dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" +source = "git+https://github.com/mozilla/application-services?rev=b94438a80dc0e6b9fbd521ac99b032dd1e95608b#b94438a80dc0e6b9fbd521ac99b032dd1e95608b" dependencies = [ "log", "parking_lot", @@ -5516,7 +5516,7 @@ dependencies = [ [[package]] name = "sql-support" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=dbeaef2eb28e9da7cc2f96e26296513cc4e07c07#dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" +source = "git+https://github.com/mozilla/application-services?rev=b94438a80dc0e6b9fbd521ac99b032dd1e95608b#b94438a80dc0e6b9fbd521ac99b032dd1e95608b" dependencies = [ "ffi-support", "interrupt-support", @@ -5698,7 +5698,7 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "suggest" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=dbeaef2eb28e9da7cc2f96e26296513cc4e07c07#dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" +source = "git+https://github.com/mozilla/application-services?rev=b94438a80dc0e6b9fbd521ac99b032dd1e95608b#b94438a80dc0e6b9fbd521ac99b032dd1e95608b" dependencies = [ "anyhow", "chrono", @@ -5750,7 +5750,7 @@ dependencies = [ [[package]] name = "sync-guid" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=dbeaef2eb28e9da7cc2f96e26296513cc4e07c07#dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" +source = "git+https://github.com/mozilla/application-services?rev=b94438a80dc0e6b9fbd521ac99b032dd1e95608b#b94438a80dc0e6b9fbd521ac99b032dd1e95608b" dependencies = [ "base64 0.21.3", "rand", @@ -5761,7 +5761,7 @@ dependencies = [ [[package]] name = "sync15" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=dbeaef2eb28e9da7cc2f96e26296513cc4e07c07#dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" +source = "git+https://github.com/mozilla/application-services?rev=b94438a80dc0e6b9fbd521ac99b032dd1e95608b#b94438a80dc0e6b9fbd521ac99b032dd1e95608b" dependencies = [ "anyhow", "error-support", @@ -5793,7 +5793,7 @@ dependencies = [ [[package]] name = "tabs" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=dbeaef2eb28e9da7cc2f96e26296513cc4e07c07#dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" +source = "git+https://github.com/mozilla/application-services?rev=b94438a80dc0e6b9fbd521ac99b032dd1e95608b#b94438a80dc0e6b9fbd521ac99b032dd1e95608b" dependencies = [ "anyhow", "error-support", @@ -6118,7 +6118,7 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "types" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=dbeaef2eb28e9da7cc2f96e26296513cc4e07c07#dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" +source = "git+https://github.com/mozilla/application-services?rev=b94438a80dc0e6b9fbd521ac99b032dd1e95608b#b94438a80dc0e6b9fbd521ac99b032dd1e95608b" dependencies = [ "rusqlite", "serde", @@ -6485,7 +6485,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "viaduct" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=dbeaef2eb28e9da7cc2f96e26296513cc4e07c07#dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" +source = "git+https://github.com/mozilla/application-services?rev=b94438a80dc0e6b9fbd521ac99b032dd1e95608b#b94438a80dc0e6b9fbd521ac99b032dd1e95608b" dependencies = [ "ffi-support", "log", @@ -6633,7 +6633,7 @@ dependencies = [ [[package]] name = "webext-storage" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=dbeaef2eb28e9da7cc2f96e26296513cc4e07c07#dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" +source = "git+https://github.com/mozilla/application-services?rev=b94438a80dc0e6b9fbd521ac99b032dd1e95608b#b94438a80dc0e6b9fbd521ac99b032dd1e95608b" dependencies = [ "anyhow", "error-support", @@ -6655,28 +6655,6 @@ dependencies = [ "url", ] -[[package]] -name = "webext_storage_bridge" -version = "0.1.0" -dependencies = [ - "anyhow", - "atomic_refcell", - "cstr", - "golden_gate", - "interrupt-support", - "moz_task", - "nserror", - "nsstring", - "once_cell", - "serde", - "serde_json", - "sql-support", - "storage_variant", - "thin-vec", - "webext-storage", - "xpcom", -] - [[package]] name = "webrender" version = "0.62.0" diff --git a/Cargo.toml b/Cargo.toml index 235f49b41b12..5b0f4ca49084 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -210,14 +210,14 @@ midir = { git = "https://github.com/mozilla/midir.git", rev = "85156e360a37d8517 malloc_size_of_derive = { path = "xpcom/rust/malloc_size_of_derive" } # application-services overrides to make updating them all simpler. -interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" } -relevancy = { git = "https://github.com/mozilla/application-services", rev = "dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" } -sql-support = { git = "https://github.com/mozilla/application-services", rev = "dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" } -suggest = { git = "https://github.com/mozilla/application-services", rev = "dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" } -sync15 = { git = "https://github.com/mozilla/application-services", rev = "dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" } -tabs = { git = "https://github.com/mozilla/application-services", rev = "dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" } -viaduct = { git = "https://github.com/mozilla/application-services", rev = "dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" } -webext-storage = { git = "https://github.com/mozilla/application-services", rev = "dbeaef2eb28e9da7cc2f96e26296513cc4e07c07" } +interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "b94438a80dc0e6b9fbd521ac99b032dd1e95608b" } +relevancy = { git = "https://github.com/mozilla/application-services", rev = "b94438a80dc0e6b9fbd521ac99b032dd1e95608b" } +sql-support = { git = "https://github.com/mozilla/application-services", rev = "b94438a80dc0e6b9fbd521ac99b032dd1e95608b" } +suggest = { git = "https://github.com/mozilla/application-services", rev = "b94438a80dc0e6b9fbd521ac99b032dd1e95608b" } +sync15 = { git = "https://github.com/mozilla/application-services", rev = "b94438a80dc0e6b9fbd521ac99b032dd1e95608b" } +tabs = { git = "https://github.com/mozilla/application-services", rev = "b94438a80dc0e6b9fbd521ac99b032dd1e95608b" } +viaduct = { git = "https://github.com/mozilla/application-services", rev = "b94438a80dc0e6b9fbd521ac99b032dd1e95608b" } +webext-storage = { git = "https://github.com/mozilla/application-services", rev = "b94438a80dc0e6b9fbd521ac99b032dd1e95608b" } # Patch `gpu-descriptor` 0.3.0 to remove unnecessary `allocator-api2` dep.: # Still waiting for the now-merged to be released. diff --git a/third_party/rust/webext-storage/.cargo-checksum.json b/third_party/rust/webext-storage/.cargo-checksum.json index cbfa3c54246d..a403d7209041 100644 --- a/third_party/rust/webext-storage/.cargo-checksum.json +++ b/third_party/rust/webext-storage/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"81b4e03b6df32859fabe75be2a86051e4646b2eac61d610323beb780b7f7574b","README.md":"821cac7eb5b963fc3f3fe21dd890427ab2bbf335cb25cbae89b713b3350687c5","build.rs":"92f7d380f3d8fab1e6d80276915af57192e276321d132a5f800ea4520e9cb469","sql/create_schema.sql":"a17311a407ec10e033886b7125da4c8b84bc6d761f6b28edc9594de430e1d964","sql/create_sync_temp_tables.sql":"860ede362c94feb47d85522553fa2852f9bdb9f9b025d6438dd5dee3d4acd527","sql/tests/create_schema_v1.sql":"77cf0c90eaac3e1aea626537147e1b8ec349b68d6076c92fa7ae402aac613050","src/api.rs":"b3f0ff950178d006e443ddbeec4513e0acaa8894211053cfdfc1de104b9fb6ab","src/db.rs":"04ef67021b6aad7552a268397c7323302c4f619b3fb07fb140132beb8b37f8b5","src/error.rs":"8587813be8e2a7f5efad4216a5c4686554ed44e98cf94bfd9c2f2c9adc8e9a11","src/ffi.rs":"f66a81393bebe7a4b7e7960cb426df106ff1f02bfebcaa6e335b4b8b56c5c936","src/lib.rs":"ab25e7c6ea67fb905fe6dad866c0d2c462b1e93bcff283db947513aeabbb2d73","src/migration.rs":"8d92f82b2ba38e1039fd054c8c75078a6b896a0d3cdc1a52571456b25a32c9c3","src/schema.rs":"d8dd8f66cad71e3e369722734e0d5d16fd9423d5f6a5abba1854a27e1e814724","src/store.rs":"d208689c46fb97cd2c60a0c610ba1998a7132fb50fffa2eefa1d6b169b7c34f0","src/sync/bridge.rs":"996de05beb2904f84b3cbfc9ef85c4844078fdb4867d9068390d496156bee614","src/sync/incoming.rs":"dd77c64e2ade4f39cba258decab6d3db8ad0b5f513aa018efbd56b9869a021d9","src/sync/mod.rs":"05da064e1bc2cc449c806a534842da92d8d4b24a919f2dff2e88dc69f3e926a5","src/sync/outgoing.rs":"dacb77b956f2546fd60a89367927a199d9b662b17201d0781145f7405b61fdce","src/sync/sync_tests.rs":"bc9845312c7b08c5efd892979f61e9385b553f872a6c5d78600f4587b14421f5","src/webext-storage.udl":"0341d431ba837cf64ea210ef6157010c6664a0b5a194e89acb0414938636b391","uniffi.toml":"beeec89c2f877eb89be0090dc304dbc7c74e787385e7459bad78c6165bb66791"},"package":null} \ No newline at end of file +{"files":{"Cargo.toml":"81b4e03b6df32859fabe75be2a86051e4646b2eac61d610323beb780b7f7574b","README.md":"821cac7eb5b963fc3f3fe21dd890427ab2bbf335cb25cbae89b713b3350687c5","build.rs":"92f7d380f3d8fab1e6d80276915af57192e276321d132a5f800ea4520e9cb469","sql/create_schema.sql":"a17311a407ec10e033886b7125da4c8b84bc6d761f6b28edc9594de430e1d964","sql/create_sync_temp_tables.sql":"860ede362c94feb47d85522553fa2852f9bdb9f9b025d6438dd5dee3d4acd527","sql/tests/create_schema_v1.sql":"77cf0c90eaac3e1aea626537147e1b8ec349b68d6076c92fa7ae402aac613050","src/api.rs":"b3f0ff950178d006e443ddbeec4513e0acaa8894211053cfdfc1de104b9fb6ab","src/db.rs":"22fa988744beca27adb34670eadf926fa288c8362a74869608e23e3563e24a62","src/error.rs":"10d99e3dc6a38951456c0fac7e46fb4f441e976b47fdddea257badbc66b8702d","src/ffi.rs":"f66a81393bebe7a4b7e7960cb426df106ff1f02bfebcaa6e335b4b8b56c5c936","src/lib.rs":"259fbbfe5b60fc1e43ef4cfe08fb131d6c1c42c49fee74a3b687e00ac91c361a","src/migration.rs":"8d92f82b2ba38e1039fd054c8c75078a6b896a0d3cdc1a52571456b25a32c9c3","src/schema.rs":"d8dd8f66cad71e3e369722734e0d5d16fd9423d5f6a5abba1854a27e1e814724","src/store.rs":"d53b74659cc41ba66f6acc91b831c45d0c563c7299308ceb62c7cb4e74ff3e9a","src/sync/bridge.rs":"2b998b18516e6477b7fa29d24b725adcd6ea70f483eca9de1bdad4eda39209a5","src/sync/incoming.rs":"dd77c64e2ade4f39cba258decab6d3db8ad0b5f513aa018efbd56b9869a021d9","src/sync/mod.rs":"bc396eecf80132df5c4bc779e77bc4782f0dcfc75ce27260aa0953caf38d3733","src/sync/outgoing.rs":"dacb77b956f2546fd60a89367927a199d9b662b17201d0781145f7405b61fdce","src/sync/sync_tests.rs":"bc9845312c7b08c5efd892979f61e9385b553f872a6c5d78600f4587b14421f5","src/webext-storage.udl":"9c0614c00e0558ebf5643c29c2aa230ec896103f84224e0d46ab6aa4cd99a788","uniffi.toml":"beeec89c2f877eb89be0090dc304dbc7c74e787385e7459bad78c6165bb66791"},"package":null} \ No newline at end of file diff --git a/third_party/rust/webext-storage/src/db.rs b/third_party/rust/webext-storage/src/db.rs index e24c8ea97c10..e8735fbd860e 100644 --- a/third_party/rust/webext-storage/src/db.rs +++ b/third_party/rust/webext-storage/src/db.rs @@ -120,6 +120,7 @@ impl ThreadSafeStorageDb { Arc::clone(&self.interrupt_handle) } + #[allow(dead_code)] pub fn begin_interrupt_scope(&self) -> Result { Ok(self.interrupt_handle.begin_interrupt_scope()?) } diff --git a/third_party/rust/webext-storage/src/error.rs b/third_party/rust/webext-storage/src/error.rs index 11ed2504364b..7774f15dce47 100644 --- a/third_party/rust/webext-storage/src/error.rs +++ b/third_party/rust/webext-storage/src/error.rs @@ -143,3 +143,11 @@ impl From for WebExtStorageApiError { } } } + +impl From for WebExtStorageApiError { + fn from(value: anyhow::Error) -> Self { + WebExtStorageApiError::UnexpectedError { + reason: value.to_string(), + } + } +} diff --git a/third_party/rust/webext-storage/src/lib.rs b/third_party/rust/webext-storage/src/lib.rs index dd9e72006b84..8f3da9d6b9b4 100644 --- a/third_party/rust/webext-storage/src/lib.rs +++ b/third_party/rust/webext-storage/src/lib.rs @@ -25,6 +25,7 @@ pub use api::SYNC_QUOTA_BYTES_PER_ITEM; pub use crate::error::{QuotaReason, WebExtStorageApiError}; pub use crate::store::WebExtStorageStore; +pub use crate::sync::{bridge::WebExtStorageBridgedEngine, SyncedExtensionChange}; pub use api::UsageInfo; pub use api::{StorageChanges, StorageValueChange}; @@ -42,3 +43,17 @@ impl UniffiCustomTypeConverter for JsonValue { obj.to_string() } } + +// Our UDL uses a `Guid` type. +use sync_guid::Guid; +impl UniffiCustomTypeConverter for Guid { + type Builtin = String; + + fn into_custom(val: Self::Builtin) -> uniffi::Result { + Ok(Guid::new(val.as_str())) + } + + fn from_custom(obj: Self) -> Self::Builtin { + obj.into() + } +} diff --git a/third_party/rust/webext-storage/src/store.rs b/third_party/rust/webext-storage/src/store.rs index d9c3281dd43d..ab697518fd43 100644 --- a/third_party/rust/webext-storage/src/store.rs +++ b/third_party/rust/webext-storage/src/store.rs @@ -29,7 +29,7 @@ use serde_json::Value as JsonValue; /// connection with our sync engines - ie, these engines also hold an Arc<> /// around the same object. pub struct WebExtStorageStore { - db: Arc, + pub(crate) db: Arc, } impl WebExtStorageStore { @@ -119,14 +119,9 @@ impl WebExtStorageStore { /// Returns the bytes in use for the specified items (which can be null, /// a string, or an array) - pub fn get_bytes_in_use(&self, ext_id: &str, keys: JsonValue) -> Result { + pub fn get_bytes_in_use(&self, ext_id: &str, keys: JsonValue) -> Result { let db = self.db.lock(); - api::get_bytes_in_use(&db, ext_id, keys) - } - - /// Returns a bridged sync engine for Desktop for this store. - pub fn bridged_engine(&self) -> sync::BridgedEngine { - sync::BridgedEngine::new(&self.db) + Ok(api::get_bytes_in_use(&db, ext_id, keys)? as u64) } /// Closes the store and its database connection. See the docs for diff --git a/third_party/rust/webext-storage/src/sync/bridge.rs b/third_party/rust/webext-storage/src/sync/bridge.rs index f948003f7a8b..1b7d5e92fbd0 100644 --- a/third_party/rust/webext-storage/src/sync/bridge.rs +++ b/third_party/rust/webext-storage/src/sync/bridge.rs @@ -5,18 +5,30 @@ use anyhow::Result; use rusqlite::Transaction; use std::sync::{Arc, Weak}; -use sync15::bso::IncomingBso; -use sync15::engine::ApplyResults; +use sync15::bso::{IncomingBso, OutgoingBso}; +use sync15::engine::{ApplyResults, BridgedEngine as Sync15BridgedEngine}; use sync_guid::Guid as SyncGuid; use crate::db::{delete_meta, get_meta, put_meta, ThreadSafeStorageDb}; use crate::schema; use crate::sync::incoming::{apply_actions, get_incoming, plan_incoming, stage_incoming}; use crate::sync::outgoing::{get_outgoing, record_uploaded, stage_outgoing}; +use crate::WebExtStorageStore; const LAST_SYNC_META_KEY: &str = "last_sync_time"; const SYNC_ID_META_KEY: &str = "sync_id"; +impl WebExtStorageStore { + // Returns a bridged sync engine for this store. + pub fn bridged_engine(self: Arc) -> Arc { + let engine = Box::new(BridgedEngine::new(&self.db)); + let bridged_engine = WebExtStorageBridgedEngine { + bridge_impl: engine, + }; + Arc::new(bridged_engine) + } +} + /// A bridged engine implements all the methods needed to make the /// `storage.sync` store work with Desktop's Sync implementation. /// Conceptually, it's similar to `sync15::Store`, which we @@ -54,7 +66,7 @@ impl BridgedEngine { } } -impl sync15::engine::BridgedEngine for BridgedEngine { +impl Sync15BridgedEngine for BridgedEngine { fn last_sync(&self) -> Result { let shared_db = self.thread_safe_storage_db()?; let db = shared_db.lock(); @@ -182,6 +194,88 @@ impl sync15::engine::BridgedEngine for BridgedEngine { } } +pub struct WebExtStorageBridgedEngine { + bridge_impl: Box, +} + +impl WebExtStorageBridgedEngine { + pub fn new(bridge_impl: Box) -> Self { + Self { bridge_impl } + } + + pub fn last_sync(&self) -> Result { + self.bridge_impl.last_sync() + } + + pub fn set_last_sync(&self, last_sync: i64) -> Result<()> { + self.bridge_impl.set_last_sync(last_sync) + } + + pub fn sync_id(&self) -> Result> { + self.bridge_impl.sync_id() + } + + pub fn reset_sync_id(&self) -> Result { + self.bridge_impl.reset_sync_id() + } + + pub fn ensure_current_sync_id(&self, sync_id: &str) -> Result { + self.bridge_impl.ensure_current_sync_id(sync_id) + } + + pub fn prepare_for_sync(&self, client_data: &str) -> Result<()> { + self.bridge_impl.prepare_for_sync(client_data) + } + + pub fn store_incoming(&self, incoming: Vec) -> Result<()> { + self.bridge_impl + .store_incoming(self.convert_incoming_bsos(incoming)?) + } + + pub fn apply(&self) -> Result> { + let apply_results = self.bridge_impl.apply()?; + self.convert_outgoing_bsos(apply_results.records) + } + + pub fn set_uploaded(&self, server_modified_millis: i64, guids: Vec) -> Result<()> { + self.bridge_impl + .set_uploaded(server_modified_millis, &guids) + } + + pub fn sync_started(&self) -> Result<()> { + self.bridge_impl.sync_started() + } + + pub fn sync_finished(&self) -> Result<()> { + self.bridge_impl.sync_finished() + } + + pub fn reset(&self) -> Result<()> { + self.bridge_impl.reset() + } + + pub fn wipe(&self) -> Result<()> { + self.bridge_impl.wipe() + } + + fn convert_incoming_bsos(&self, incoming: Vec) -> Result> { + let mut bsos = Vec::with_capacity(incoming.len()); + for inc in incoming { + bsos.push(serde_json::from_str::(&inc)?); + } + Ok(bsos) + } + + // Encode OutgoingBso's into JSON for UniFFI + fn convert_outgoing_bsos(&self, outgoing: Vec) -> Result> { + let mut bsos = Vec::with_capacity(outgoing.len()); + for e in outgoing { + bsos.push(serde_json::to_string(&e)?); + } + Ok(bsos) + } +} + impl From for crate::error::Error { fn from(value: anyhow::Error) -> Self { crate::error::Error::SyncError(value.to_string()) diff --git a/third_party/rust/webext-storage/src/sync/mod.rs b/third_party/rust/webext-storage/src/sync/mod.rs index 22ff912def10..b1e8e9d4f901 100644 --- a/third_party/rust/webext-storage/src/sync/mod.rs +++ b/third_party/rust/webext-storage/src/sync/mod.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -mod bridge; +pub(crate) mod bridge; mod incoming; mod outgoing; @@ -17,7 +17,6 @@ use serde_derive::*; use sql_support::ConnExt; use sync_guid::Guid as SyncGuid; -pub use bridge::BridgedEngine; use incoming::IncomingAction; type JsonMap = serde_json::Map; diff --git a/third_party/rust/webext-storage/src/webext-storage.udl b/third_party/rust/webext-storage/src/webext-storage.udl index f912861030ac..3578804a9bdf 100644 --- a/third_party/rust/webext-storage/src/webext-storage.udl +++ b/third_party/rust/webext-storage/src/webext-storage.udl @@ -5,6 +5,9 @@ [Custom] typedef string JsonValue; +[Custom] +typedef string Guid; + namespace webextstorage { }; @@ -22,6 +25,11 @@ interface WebExtStorageApiError { QuotaError(QuotaReason reason); }; +dictionary SyncedExtensionChange { + string ext_id; + string changes; +}; + dictionary StorageValueChange { string key; JsonValue? old_value; @@ -32,6 +40,9 @@ dictionary StorageChanges { sequence changes; }; +// Note that the `close` function has been intentionally excluded from `WebExtStorageStore` because at present +// it is not necessary for our current use in mozilla central and converting `close` to pass a reference to +// the store resulted in errors. interface WebExtStorageStore { [Throws=WebExtStorageApiError] constructor(string path); @@ -42,9 +53,61 @@ interface WebExtStorageStore { [Throws=WebExtStorageApiError] JsonValue get([ByRef] string ext_id, JsonValue keys); + [Throws=WebExtStorageApiError] + u64 get_bytes_in_use([ByRef] string ext_id, JsonValue keys); + [Throws=WebExtStorageApiError] StorageChanges remove([ByRef] string ext_id, JsonValue keys); [Throws=WebExtStorageApiError] StorageChanges clear([ByRef] string ext_id); + + [Self=ByArc] + WebExtStorageBridgedEngine bridged_engine(); + + [Throws=WebExtStorageApiError] + sequence get_synced_changes(); +}; + +// Note the canonical docs for this are in https://github.com/mozilla/application-services/blob/main/components/sync15/src/engine/bridged_engine.rs +// NOTE: all timestamps here are milliseconds. +interface WebExtStorageBridgedEngine { + [Throws=WebExtStorageApiError] + i64 last_sync(); + + [Throws=WebExtStorageApiError] + void set_last_sync(i64 last_sync); + + [Throws=WebExtStorageApiError] + string? sync_id(); + + [Throws=WebExtStorageApiError] + string reset_sync_id(); + + [Throws=WebExtStorageApiError] + string ensure_current_sync_id([ByRef]string new_sync_id); + + [Throws=WebExtStorageApiError] + void prepare_for_sync([ByRef]string client_data); + + [Throws=WebExtStorageApiError] + void sync_started(); + + [Throws=WebExtStorageApiError] + void store_incoming(sequence incoming); + + [Throws=WebExtStorageApiError] + sequence apply(); + + [Throws=WebExtStorageApiError] + void set_uploaded(i64 server_modified_millis, sequence guids); + + [Throws=WebExtStorageApiError] + void sync_finished(); + + [Throws=WebExtStorageApiError] + void reset(); + + [Throws=WebExtStorageApiError] + void wipe(); }; diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustWebextstorage.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustWebextstorage.sys.mjs new file mode 100644 index 000000000000..e2c65398c43d --- /dev/null +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustWebextstorage.sys.mjs @@ -0,0 +1,1602 @@ +// This file was autogenerated by the `uniffi-bindgen-gecko-js` crate. +// Trust me, you don't want to mess with it! + +import { UniFFITypeError } from "resource://gre/modules/UniFFI.sys.mjs"; + + + +// Objects intended to be used in the unit tests +export var UnitTestObjs = {}; + +// Write/Read data to/from an ArrayBuffer +class ArrayBufferDataStream { + constructor(arrayBuffer) { + this.dataView = new DataView(arrayBuffer); + this.pos = 0; + } + + readUint8() { + let rv = this.dataView.getUint8(this.pos); + this.pos += 1; + return rv; + } + + writeUint8(value) { + this.dataView.setUint8(this.pos, value); + this.pos += 1; + } + + readUint16() { + let rv = this.dataView.getUint16(this.pos); + this.pos += 2; + return rv; + } + + writeUint16(value) { + this.dataView.setUint16(this.pos, value); + this.pos += 2; + } + + readUint32() { + let rv = this.dataView.getUint32(this.pos); + this.pos += 4; + return rv; + } + + writeUint32(value) { + this.dataView.setUint32(this.pos, value); + this.pos += 4; + } + + readUint64() { + let rv = this.dataView.getBigUint64(this.pos); + this.pos += 8; + return Number(rv); + } + + writeUint64(value) { + this.dataView.setBigUint64(this.pos, BigInt(value)); + this.pos += 8; + } + + + readInt8() { + let rv = this.dataView.getInt8(this.pos); + this.pos += 1; + return rv; + } + + writeInt8(value) { + this.dataView.setInt8(this.pos, value); + this.pos += 1; + } + + readInt16() { + let rv = this.dataView.getInt16(this.pos); + this.pos += 2; + return rv; + } + + writeInt16(value) { + this.dataView.setInt16(this.pos, value); + this.pos += 2; + } + + readInt32() { + let rv = this.dataView.getInt32(this.pos); + this.pos += 4; + return rv; + } + + writeInt32(value) { + this.dataView.setInt32(this.pos, value); + this.pos += 4; + } + + readInt64() { + let rv = this.dataView.getBigInt64(this.pos); + this.pos += 8; + return Number(rv); + } + + writeInt64(value) { + this.dataView.setBigInt64(this.pos, BigInt(value)); + this.pos += 8; + } + + readFloat32() { + let rv = this.dataView.getFloat32(this.pos); + this.pos += 4; + return rv; + } + + writeFloat32(value) { + this.dataView.setFloat32(this.pos, value); + this.pos += 4; + } + + readFloat64() { + let rv = this.dataView.getFloat64(this.pos); + this.pos += 8; + return rv; + } + + writeFloat64(value) { + this.dataView.setFloat64(this.pos, value); + this.pos += 8; + } + + + writeString(value) { + const encoder = new TextEncoder(); + // Note: in order to efficiently write this data, we first write the + // string data, reserving 4 bytes for the size. + const dest = new Uint8Array(this.dataView.buffer, this.pos + 4); + const encodeResult = encoder.encodeInto(value, dest); + if (encodeResult.read != value.length) { + throw new UniFFIError( + "writeString: out of space when writing to ArrayBuffer. Did the computeSize() method returned the wrong result?" + ); + } + const size = encodeResult.written; + // Next, go back and write the size before the string data + this.dataView.setUint32(this.pos, size); + // Finally, advance our position past both the size and string data + this.pos += size + 4; + } + + readString() { + const decoder = new TextDecoder(); + const size = this.readUint32(); + const source = new Uint8Array(this.dataView.buffer, this.pos, size) + const value = decoder.decode(source); + this.pos += size; + return value; + } + + // Reads a WebExtStorageBridgedEngine pointer from the data stream + // UniFFI Pointers are **always** 8 bytes long. That is enforced + // by the C++ and Rust Scaffolding code. + readPointerWebExtStorageBridgedEngine() { + const pointerId = 7; // webextstorage:WebExtStorageBridgedEngine + const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); + this.pos += 8; + return res; + } + + // Writes a WebExtStorageBridgedEngine pointer into the data stream + // UniFFI Pointers are **always** 8 bytes long. That is enforced + // by the C++ and Rust Scaffolding code. + writePointerWebExtStorageBridgedEngine(value) { + const pointerId = 7; // webextstorage:WebExtStorageBridgedEngine + UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); + this.pos += 8; + } + + + // Reads a WebExtStorageStore pointer from the data stream + // UniFFI Pointers are **always** 8 bytes long. That is enforced + // by the C++ and Rust Scaffolding code. + readPointerWebExtStorageStore() { + const pointerId = 8; // webextstorage:WebExtStorageStore + const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); + this.pos += 8; + return res; + } + + // Writes a WebExtStorageStore pointer into the data stream + // UniFFI Pointers are **always** 8 bytes long. That is enforced + // by the C++ and Rust Scaffolding code. + writePointerWebExtStorageStore(value) { + const pointerId = 8; // webextstorage:WebExtStorageStore + UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); + this.pos += 8; + } + +} + +function handleRustResult(result, liftCallback, liftErrCallback) { + switch (result.code) { + case "success": + return liftCallback(result.data); + + case "error": + throw liftErrCallback(result.data); + + case "internal-error": + if (result.data) { + throw new UniFFIInternalError(FfiConverterString.lift(result.data)); + } else { + throw new UniFFIInternalError("Unknown error"); + } + + default: + throw new UniFFIError(`Unexpected status code: ${result.code}`); + } +} + +class UniFFIError { + constructor(message) { + this.message = message; + } + + toString() { + return `UniFFIError: ${this.message}` + } +} + +class UniFFIInternalError extends UniFFIError {} + +// Base class for FFI converters +class FfiConverter { + // throw `UniFFITypeError` if a value to be converted has an invalid type + static checkType(value) { + if (value === undefined ) { + throw new UniFFITypeError(`undefined`); + } + if (value === null ) { + throw new UniFFITypeError(`null`); + } + } +} + +// Base class for FFI converters that lift/lower by reading/writing to an ArrayBuffer +class FfiConverterArrayBuffer extends FfiConverter { + static lift(buf) { + return this.read(new ArrayBufferDataStream(buf)); + } + + static lower(value) { + const buf = new ArrayBuffer(this.computeSize(value)); + const dataStream = new ArrayBufferDataStream(buf); + this.write(dataStream, value); + return buf; + } +} + +// Symbols that are used to ensure that Object constructors +// can only be used with a proper UniFFI pointer +const uniffiObjectPtr = Symbol("uniffiObjectPtr"); +const constructUniffiObject = Symbol("constructUniffiObject"); +UnitTestObjs.uniffiObjectPtr = uniffiObjectPtr; + +// Export the FFIConverter object to make external types work. +export class FfiConverterU64 extends FfiConverter { + static checkType(value) { + super.checkType(value); + if (!Number.isSafeInteger(value)) { + throw new UniFFITypeError(`${value} exceeds the safe integer bounds`); + } + if (value < 0) { + throw new UniFFITypeError(`${value} exceeds the U64 bounds`); + } + } + static computeSize() { + return 8; + } + static lift(value) { + return value; + } + static lower(value) { + return value; + } + static write(dataStream, value) { + dataStream.writeUint64(value) + } + static read(dataStream) { + return dataStream.readUint64() + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterI64 extends FfiConverter { + static checkType(value) { + super.checkType(value); + if (!Number.isSafeInteger(value)) { + throw new UniFFITypeError(`${value} exceeds the safe integer bounds`); + } + } + static computeSize() { + return 8; + } + static lift(value) { + return value; + } + static lower(value) { + return value; + } + static write(dataStream, value) { + dataStream.writeInt64(value) + } + static read(dataStream) { + return dataStream.readInt64() + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterString extends FfiConverter { + static checkType(value) { + super.checkType(value); + if (typeof value !== "string") { + throw new UniFFITypeError(`${value} is not a string`); + } + } + + static lift(buf) { + const decoder = new TextDecoder(); + const utf8Arr = new Uint8Array(buf); + return decoder.decode(utf8Arr); + } + static lower(value) { + const encoder = new TextEncoder(); + return encoder.encode(value).buffer; + } + + static write(dataStream, value) { + dataStream.writeString(value); + } + + static read(dataStream) { + return dataStream.readString(); + } + + static computeSize(value) { + const encoder = new TextEncoder(); + return 4 + encoder.encode(value).length + } +} + +export class WebExtStorageBridgedEngine { + // Use `init` to instantiate this class. + // DO NOT USE THIS CONSTRUCTOR DIRECTLY + constructor(opts) { + if (!Object.prototype.hasOwnProperty.call(opts, constructUniffiObject)) { + throw new UniFFIError("Attempting to construct an object using the JavaScript constructor directly" + + "Please use a UDL defined constructor, or the init function for the primary constructor") + } + if (!opts[constructUniffiObject] instanceof UniFFIPointer) { + throw new UniFFIError("Attempting to create a UniFFI object with a pointer that is not an instance of UniFFIPointer") + } + this[uniffiObjectPtr] = opts[constructUniffiObject]; + } + + apply() { + const liftResult = (result) => FfiConverterSequencestring.lift(result); + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + return UniFFIScaffolding.callAsync( + 60, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_apply + FfiConverterTypeWebExtStorageBridgedEngine.lower(this), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + ensureCurrentSyncId(newSyncId) { + const liftResult = (result) => FfiConverterString.lift(result); + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + try { + FfiConverterString.checkType(newSyncId) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("newSyncId"); + } + throw e; + } + return UniFFIScaffolding.callAsync( + 61, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_ensure_current_sync_id + FfiConverterTypeWebExtStorageBridgedEngine.lower(this), + FfiConverterString.lower(newSyncId), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + lastSync() { + const liftResult = (result) => FfiConverterI64.lift(result); + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + return UniFFIScaffolding.callAsync( + 62, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_last_sync + FfiConverterTypeWebExtStorageBridgedEngine.lower(this), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + prepareForSync(clientData) { + const liftResult = (result) => undefined; + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + try { + FfiConverterString.checkType(clientData) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("clientData"); + } + throw e; + } + return UniFFIScaffolding.callAsync( + 63, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_prepare_for_sync + FfiConverterTypeWebExtStorageBridgedEngine.lower(this), + FfiConverterString.lower(clientData), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + reset() { + const liftResult = (result) => undefined; + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + return UniFFIScaffolding.callAsync( + 64, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_reset + FfiConverterTypeWebExtStorageBridgedEngine.lower(this), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + resetSyncId() { + const liftResult = (result) => FfiConverterString.lift(result); + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + return UniFFIScaffolding.callAsync( + 65, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_reset_sync_id + FfiConverterTypeWebExtStorageBridgedEngine.lower(this), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + setLastSync(lastSync) { + const liftResult = (result) => undefined; + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + try { + FfiConverterI64.checkType(lastSync) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("lastSync"); + } + throw e; + } + return UniFFIScaffolding.callAsync( + 66, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_set_last_sync + FfiConverterTypeWebExtStorageBridgedEngine.lower(this), + FfiConverterI64.lower(lastSync), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + setUploaded(serverModifiedMillis,guids) { + const liftResult = (result) => undefined; + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + try { + FfiConverterI64.checkType(serverModifiedMillis) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("serverModifiedMillis"); + } + throw e; + } + try { + FfiConverterSequenceTypeGuid.checkType(guids) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("guids"); + } + throw e; + } + return UniFFIScaffolding.callAsync( + 67, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_set_uploaded + FfiConverterTypeWebExtStorageBridgedEngine.lower(this), + FfiConverterI64.lower(serverModifiedMillis), + FfiConverterSequenceTypeGuid.lower(guids), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + storeIncoming(incoming) { + const liftResult = (result) => undefined; + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + try { + FfiConverterSequencestring.checkType(incoming) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("incoming"); + } + throw e; + } + return UniFFIScaffolding.callAsync( + 68, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_store_incoming + FfiConverterTypeWebExtStorageBridgedEngine.lower(this), + FfiConverterSequencestring.lower(incoming), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + syncFinished() { + const liftResult = (result) => undefined; + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + return UniFFIScaffolding.callAsync( + 69, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_finished + FfiConverterTypeWebExtStorageBridgedEngine.lower(this), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + syncId() { + const liftResult = (result) => FfiConverterOptionalstring.lift(result); + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + return UniFFIScaffolding.callAsync( + 70, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_id + FfiConverterTypeWebExtStorageBridgedEngine.lower(this), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + syncStarted() { + const liftResult = (result) => undefined; + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + return UniFFIScaffolding.callAsync( + 71, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_started + FfiConverterTypeWebExtStorageBridgedEngine.lower(this), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + wipe() { + const liftResult = (result) => undefined; + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + return UniFFIScaffolding.callAsync( + 72, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_wipe + FfiConverterTypeWebExtStorageBridgedEngine.lower(this), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeWebExtStorageBridgedEngine extends FfiConverter { + static lift(value) { + const opts = {}; + opts[constructUniffiObject] = value; + return new WebExtStorageBridgedEngine(opts); + } + + static lower(value) { + const ptr = value[uniffiObjectPtr]; + if (!(ptr instanceof UniFFIPointer)) { + throw new UniFFITypeError("Object is not a 'WebExtStorageBridgedEngine' instance"); + } + return ptr; + } + + static read(dataStream) { + return this.lift(dataStream.readPointerWebExtStorageBridgedEngine()); + } + + static write(dataStream, value) { + dataStream.writePointerWebExtStorageBridgedEngine(value[uniffiObjectPtr]); + } + + static computeSize(value) { + return 8; + } +} + +export class WebExtStorageStore { + // Use `init` to instantiate this class. + // DO NOT USE THIS CONSTRUCTOR DIRECTLY + constructor(opts) { + if (!Object.prototype.hasOwnProperty.call(opts, constructUniffiObject)) { + throw new UniFFIError("Attempting to construct an object using the JavaScript constructor directly" + + "Please use a UDL defined constructor, or the init function for the primary constructor") + } + if (!opts[constructUniffiObject] instanceof UniFFIPointer) { + throw new UniFFIError("Attempting to create a UniFFI object with a pointer that is not an instance of UniFFIPointer") + } + this[uniffiObjectPtr] = opts[constructUniffiObject]; + } + /** + * An async constructor for WebExtStorageStore. + * + * @returns {Promise}: A promise that resolves + * to a newly constructed WebExtStorageStore + */ + static init(path) { + const liftResult = (result) => FfiConverterTypeWebExtStorageStore.lift(result); + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + try { + FfiConverterString.checkType(path) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("path"); + } + throw e; + } + return UniFFIScaffolding.callAsync( + 74, // webextstorage:uniffi_webext_storage_fn_constructor_webextstoragestore_new + FfiConverterString.lower(path), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + }} + + bridgedEngine() { + const liftResult = (result) => FfiConverterTypeWebExtStorageBridgedEngine.lift(result); + const liftError = null; + const functionCall = () => { + return UniFFIScaffolding.callAsync( + 75, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_bridged_engine + FfiConverterTypeWebExtStorageStore.lower(this), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + clear(extId) { + const liftResult = (result) => FfiConverterTypeStorageChanges.lift(result); + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + try { + FfiConverterString.checkType(extId) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("extId"); + } + throw e; + } + return UniFFIScaffolding.callAsync( + 76, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_clear + FfiConverterTypeWebExtStorageStore.lower(this), + FfiConverterString.lower(extId), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + get(extId,keys) { + const liftResult = (result) => FfiConverterTypeJsonValue.lift(result); + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + try { + FfiConverterString.checkType(extId) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("extId"); + } + throw e; + } + try { + FfiConverterTypeJsonValue.checkType(keys) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("keys"); + } + throw e; + } + return UniFFIScaffolding.callAsync( + 77, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_get + FfiConverterTypeWebExtStorageStore.lower(this), + FfiConverterString.lower(extId), + FfiConverterTypeJsonValue.lower(keys), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + getBytesInUse(extId,keys) { + const liftResult = (result) => FfiConverterU64.lift(result); + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + try { + FfiConverterString.checkType(extId) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("extId"); + } + throw e; + } + try { + FfiConverterTypeJsonValue.checkType(keys) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("keys"); + } + throw e; + } + return UniFFIScaffolding.callAsync( + 78, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_get_bytes_in_use + FfiConverterTypeWebExtStorageStore.lower(this), + FfiConverterString.lower(extId), + FfiConverterTypeJsonValue.lower(keys), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + getSyncedChanges() { + const liftResult = (result) => FfiConverterSequenceTypeSyncedExtensionChange.lift(result); + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + return UniFFIScaffolding.callAsync( + 79, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_get_synced_changes + FfiConverterTypeWebExtStorageStore.lower(this), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + remove(extId,keys) { + const liftResult = (result) => FfiConverterTypeStorageChanges.lift(result); + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + try { + FfiConverterString.checkType(extId) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("extId"); + } + throw e; + } + try { + FfiConverterTypeJsonValue.checkType(keys) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("keys"); + } + throw e; + } + return UniFFIScaffolding.callAsync( + 80, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_remove + FfiConverterTypeWebExtStorageStore.lower(this), + FfiConverterString.lower(extId), + FfiConverterTypeJsonValue.lower(keys), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + set(extId,val) { + const liftResult = (result) => FfiConverterTypeStorageChanges.lift(result); + const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); + const functionCall = () => { + try { + FfiConverterString.checkType(extId) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("extId"); + } + throw e; + } + try { + FfiConverterTypeJsonValue.checkType(val) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("val"); + } + throw e; + } + return UniFFIScaffolding.callAsync( + 81, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_set + FfiConverterTypeWebExtStorageStore.lower(this), + FfiConverterString.lower(extId), + FfiConverterTypeJsonValue.lower(val), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeWebExtStorageStore extends FfiConverter { + static lift(value) { + const opts = {}; + opts[constructUniffiObject] = value; + return new WebExtStorageStore(opts); + } + + static lower(value) { + const ptr = value[uniffiObjectPtr]; + if (!(ptr instanceof UniFFIPointer)) { + throw new UniFFITypeError("Object is not a 'WebExtStorageStore' instance"); + } + return ptr; + } + + static read(dataStream) { + return this.lift(dataStream.readPointerWebExtStorageStore()); + } + + static write(dataStream, value) { + dataStream.writePointerWebExtStorageStore(value[uniffiObjectPtr]); + } + + static computeSize(value) { + return 8; + } +} + +export class StorageChanges { + constructor({ changes } = {}) { + try { + FfiConverterSequenceTypeStorageValueChange.checkType(changes) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("changes"); + } + throw e; + } + this.changes = changes; + } + equals(other) { + return ( + this.changes == other.changes + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeStorageChanges extends FfiConverterArrayBuffer { + static read(dataStream) { + return new StorageChanges({ + changes: FfiConverterSequenceTypeStorageValueChange.read(dataStream), + }); + } + static write(dataStream, value) { + FfiConverterSequenceTypeStorageValueChange.write(dataStream, value.changes); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterSequenceTypeStorageValueChange.computeSize(value.changes); + return totalSize + } + + static checkType(value) { + super.checkType(value); + if (!(value instanceof StorageChanges)) { + throw new UniFFITypeError(`Expected 'StorageChanges', found '${typeof value}'`); + } + try { + FfiConverterSequenceTypeStorageValueChange.checkType(value.changes); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".changes"); + } + throw e; + } + } +} + +export class StorageValueChange { + constructor({ key, oldValue, newValue } = {}) { + try { + FfiConverterString.checkType(key) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("key"); + } + throw e; + } + try { + FfiConverterOptionalTypeJsonValue.checkType(oldValue) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("oldValue"); + } + throw e; + } + try { + FfiConverterOptionalTypeJsonValue.checkType(newValue) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("newValue"); + } + throw e; + } + this.key = key; + this.oldValue = oldValue; + this.newValue = newValue; + } + equals(other) { + return ( + this.key == other.key && + this.oldValue == other.oldValue && + this.newValue == other.newValue + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeStorageValueChange extends FfiConverterArrayBuffer { + static read(dataStream) { + return new StorageValueChange({ + key: FfiConverterString.read(dataStream), + oldValue: FfiConverterOptionalTypeJsonValue.read(dataStream), + newValue: FfiConverterOptionalTypeJsonValue.read(dataStream), + }); + } + static write(dataStream, value) { + FfiConverterString.write(dataStream, value.key); + FfiConverterOptionalTypeJsonValue.write(dataStream, value.oldValue); + FfiConverterOptionalTypeJsonValue.write(dataStream, value.newValue); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterString.computeSize(value.key); + totalSize += FfiConverterOptionalTypeJsonValue.computeSize(value.oldValue); + totalSize += FfiConverterOptionalTypeJsonValue.computeSize(value.newValue); + return totalSize + } + + static checkType(value) { + super.checkType(value); + if (!(value instanceof StorageValueChange)) { + throw new UniFFITypeError(`Expected 'StorageValueChange', found '${typeof value}'`); + } + try { + FfiConverterString.checkType(value.key); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".key"); + } + throw e; + } + try { + FfiConverterOptionalTypeJsonValue.checkType(value.oldValue); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".oldValue"); + } + throw e; + } + try { + FfiConverterOptionalTypeJsonValue.checkType(value.newValue); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".newValue"); + } + throw e; + } + } +} + +export class SyncedExtensionChange { + constructor({ extId, changes } = {}) { + try { + FfiConverterString.checkType(extId) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("extId"); + } + throw e; + } + try { + FfiConverterString.checkType(changes) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("changes"); + } + throw e; + } + this.extId = extId; + this.changes = changes; + } + equals(other) { + return ( + this.extId == other.extId && + this.changes == other.changes + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeSyncedExtensionChange extends FfiConverterArrayBuffer { + static read(dataStream) { + return new SyncedExtensionChange({ + extId: FfiConverterString.read(dataStream), + changes: FfiConverterString.read(dataStream), + }); + } + static write(dataStream, value) { + FfiConverterString.write(dataStream, value.extId); + FfiConverterString.write(dataStream, value.changes); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterString.computeSize(value.extId); + totalSize += FfiConverterString.computeSize(value.changes); + return totalSize + } + + static checkType(value) { + super.checkType(value); + if (!(value instanceof SyncedExtensionChange)) { + throw new UniFFITypeError(`Expected 'SyncedExtensionChange', found '${typeof value}'`); + } + try { + FfiConverterString.checkType(value.extId); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".extId"); + } + throw e; + } + try { + FfiConverterString.checkType(value.changes); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".changes"); + } + throw e; + } + } +} + + +export const QuotaReason = { + TOTAL_BYTES: 1, + ITEM_BYTES: 2, + MAX_ITEMS: 3, +}; + +Object.freeze(QuotaReason); +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeQuotaReason extends FfiConverterArrayBuffer { + static read(dataStream) { + switch (dataStream.readInt32()) { + case 1: + return QuotaReason.TOTAL_BYTES + case 2: + return QuotaReason.ITEM_BYTES + case 3: + return QuotaReason.MAX_ITEMS + default: + throw new UniFFITypeError("Unknown QuotaReason variant"); + } + } + + static write(dataStream, value) { + if (value === QuotaReason.TOTAL_BYTES) { + dataStream.writeInt32(1); + return; + } + if (value === QuotaReason.ITEM_BYTES) { + dataStream.writeInt32(2); + return; + } + if (value === QuotaReason.MAX_ITEMS) { + dataStream.writeInt32(3); + return; + } + throw new UniFFITypeError("Unknown QuotaReason variant"); + } + + static computeSize(value) { + return 4; + } + + static checkType(value) { + if (!Number.isInteger(value) || value < 1 || value > 3) { + throw new UniFFITypeError(`${value} is not a valid value for QuotaReason`); + } + } +} + + + + + +export class WebExtStorageApiError extends Error {} + + +export class UnexpectedError extends WebExtStorageApiError { + + constructor( + reason, + ...params + ) { + const message = `reason: ${ reason }`; + super(message, ...params); + this.reason = reason; + } + toString() { + return `UnexpectedError: ${super.toString()}` + } +} + +export class JsonError extends WebExtStorageApiError { + + constructor( + reason, + ...params + ) { + const message = `reason: ${ reason }`; + super(message, ...params); + this.reason = reason; + } + toString() { + return `JsonError: ${super.toString()}` + } +} + +export class QuotaError extends WebExtStorageApiError { + + constructor( + reason, + ...params + ) { + const message = `reason: ${ reason }`; + super(message, ...params); + this.reason = reason; + } + toString() { + return `QuotaError: ${super.toString()}` + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeWebExtStorageApiError extends FfiConverterArrayBuffer { + static read(dataStream) { + switch (dataStream.readInt32()) { + case 1: + return new UnexpectedError( + FfiConverterString.read(dataStream) + ); + case 2: + return new JsonError( + FfiConverterString.read(dataStream) + ); + case 3: + return new QuotaError( + FfiConverterTypeQuotaReason.read(dataStream) + ); + default: + throw new UniFFITypeError("Unknown WebExtStorageApiError variant"); + } + } + static computeSize(value) { + // Size of the Int indicating the variant + let totalSize = 4; + if (value instanceof UnexpectedError) { + totalSize += FfiConverterString.computeSize(value.reason); + return totalSize; + } + if (value instanceof JsonError) { + totalSize += FfiConverterString.computeSize(value.reason); + return totalSize; + } + if (value instanceof QuotaError) { + totalSize += FfiConverterTypeQuotaReason.computeSize(value.reason); + return totalSize; + } + throw new UniFFITypeError("Unknown WebExtStorageApiError variant"); + } + static write(dataStream, value) { + if (value instanceof UnexpectedError) { + dataStream.writeInt32(1); + FfiConverterString.write(dataStream, value.reason); + return; + } + if (value instanceof JsonError) { + dataStream.writeInt32(2); + FfiConverterString.write(dataStream, value.reason); + return; + } + if (value instanceof QuotaError) { + dataStream.writeInt32(3); + FfiConverterTypeQuotaReason.write(dataStream, value.reason); + return; + } + throw new UniFFITypeError("Unknown WebExtStorageApiError variant"); + } + + static errorClass = WebExtStorageApiError; +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterOptionalstring extends FfiConverterArrayBuffer { + static checkType(value) { + if (value !== undefined && value !== null) { + FfiConverterString.checkType(value) + } + } + + static read(dataStream) { + const code = dataStream.readUint8(0); + switch (code) { + case 0: + return null + case 1: + return FfiConverterString.read(dataStream) + default: + throw UniFFIError(`Unexpected code: ${code}`); + } + } + + static write(dataStream, value) { + if (value === null || value === undefined) { + dataStream.writeUint8(0); + return; + } + dataStream.writeUint8(1); + FfiConverterString.write(dataStream, value) + } + + static computeSize(value) { + if (value === null || value === undefined) { + return 1; + } + return 1 + FfiConverterString.computeSize(value) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterOptionalTypeJsonValue extends FfiConverterArrayBuffer { + static checkType(value) { + if (value !== undefined && value !== null) { + FfiConverterTypeJsonValue.checkType(value) + } + } + + static read(dataStream) { + const code = dataStream.readUint8(0); + switch (code) { + case 0: + return null + case 1: + return FfiConverterTypeJsonValue.read(dataStream) + default: + throw UniFFIError(`Unexpected code: ${code}`); + } + } + + static write(dataStream, value) { + if (value === null || value === undefined) { + dataStream.writeUint8(0); + return; + } + dataStream.writeUint8(1); + FfiConverterTypeJsonValue.write(dataStream, value) + } + + static computeSize(value) { + if (value === null || value === undefined) { + return 1; + } + return 1 + FfiConverterTypeJsonValue.computeSize(value) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterSequencestring extends FfiConverterArrayBuffer { + static read(dataStream) { + const len = dataStream.readInt32(); + const arr = []; + for (let i = 0; i < len; i++) { + arr.push(FfiConverterString.read(dataStream)); + } + return arr; + } + + static write(dataStream, value) { + dataStream.writeInt32(value.length); + value.forEach((innerValue) => { + FfiConverterString.write(dataStream, innerValue); + }) + } + + static computeSize(value) { + // The size of the length + let size = 4; + for (const innerValue of value) { + size += FfiConverterString.computeSize(innerValue); + } + return size; + } + + static checkType(value) { + if (!Array.isArray(value)) { + throw new UniFFITypeError(`${value} is not an array`); + } + value.forEach((innerValue, idx) => { + try { + FfiConverterString.checkType(innerValue); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(`[${idx}]`); + } + throw e; + } + }) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterSequenceTypeStorageValueChange extends FfiConverterArrayBuffer { + static read(dataStream) { + const len = dataStream.readInt32(); + const arr = []; + for (let i = 0; i < len; i++) { + arr.push(FfiConverterTypeStorageValueChange.read(dataStream)); + } + return arr; + } + + static write(dataStream, value) { + dataStream.writeInt32(value.length); + value.forEach((innerValue) => { + FfiConverterTypeStorageValueChange.write(dataStream, innerValue); + }) + } + + static computeSize(value) { + // The size of the length + let size = 4; + for (const innerValue of value) { + size += FfiConverterTypeStorageValueChange.computeSize(innerValue); + } + return size; + } + + static checkType(value) { + if (!Array.isArray(value)) { + throw new UniFFITypeError(`${value} is not an array`); + } + value.forEach((innerValue, idx) => { + try { + FfiConverterTypeStorageValueChange.checkType(innerValue); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(`[${idx}]`); + } + throw e; + } + }) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterSequenceTypeSyncedExtensionChange extends FfiConverterArrayBuffer { + static read(dataStream) { + const len = dataStream.readInt32(); + const arr = []; + for (let i = 0; i < len; i++) { + arr.push(FfiConverterTypeSyncedExtensionChange.read(dataStream)); + } + return arr; + } + + static write(dataStream, value) { + dataStream.writeInt32(value.length); + value.forEach((innerValue) => { + FfiConverterTypeSyncedExtensionChange.write(dataStream, innerValue); + }) + } + + static computeSize(value) { + // The size of the length + let size = 4; + for (const innerValue of value) { + size += FfiConverterTypeSyncedExtensionChange.computeSize(innerValue); + } + return size; + } + + static checkType(value) { + if (!Array.isArray(value)) { + throw new UniFFITypeError(`${value} is not an array`); + } + value.forEach((innerValue, idx) => { + try { + FfiConverterTypeSyncedExtensionChange.checkType(innerValue); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(`[${idx}]`); + } + throw e; + } + }) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterSequenceTypeGuid extends FfiConverterArrayBuffer { + static read(dataStream) { + const len = dataStream.readInt32(); + const arr = []; + for (let i = 0; i < len; i++) { + arr.push(FfiConverterTypeGuid.read(dataStream)); + } + return arr; + } + + static write(dataStream, value) { + dataStream.writeInt32(value.length); + value.forEach((innerValue) => { + FfiConverterTypeGuid.write(dataStream, innerValue); + }) + } + + static computeSize(value) { + // The size of the length + let size = 4; + for (const innerValue of value) { + size += FfiConverterTypeGuid.computeSize(innerValue); + } + return size; + } + + static checkType(value) { + if (!Array.isArray(value)) { + throw new UniFFITypeError(`${value} is not an array`); + } + value.forEach((innerValue, idx) => { + try { + FfiConverterTypeGuid.checkType(innerValue); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(`[${idx}]`); + } + throw e; + } + }) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeGuid extends FfiConverter { + static lift(buf) { + return FfiConverterString.lift(buf); + } + + static lower(buf) { + return FfiConverterString.lower(buf); + } + + static write(dataStream, value) { + FfiConverterString.write(dataStream, value); + } + + static read(buf) { + return FfiConverterString.read(buf); + } + + static computeSize(value) { + return FfiConverterString.computeSize(value); + } +} +// TODO: We should also allow JS to customize the type eventually. + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeJsonValue extends FfiConverter { + static lift(buf) { + return FfiConverterString.lift(buf); + } + + static lower(buf) { + return FfiConverterString.lower(buf); + } + + static write(dataStream, value) { + FfiConverterString.write(dataStream, value); + } + + static read(buf) { + return FfiConverterString.read(buf); + } + + static computeSize(value) { + return FfiConverterString.computeSize(value); + } +} +// TODO: We should also allow JS to customize the type eventually. + + + + diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build b/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build index 405711db9829..afdc0a141d31 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build @@ -10,6 +10,7 @@ EXTRA_JS_MODULES += [ "generated/RustSuggest.sys.mjs", "generated/RustSync15.sys.mjs", "generated/RustTabs.sys.mjs", + "generated/RustWebextstorage.sys.mjs", ] with Files("**"): diff --git a/toolkit/components/uniffi-bindgen-gecko-js/config.toml b/toolkit/components/uniffi-bindgen-gecko-js/config.toml index 2aaf3e90eafc..6e175aa7eeee 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/config.toml +++ b/toolkit/components/uniffi-bindgen-gecko-js/config.toml @@ -47,6 +47,10 @@ main = [ "RelevancyStore.interrupt", ] +[webext-storage] +crate_name = "webext_storage" +udl_file = "third_party/rust/webext-storage/src/webext-storage.udl" + [remote_settings] crate_name = "remote_settings" udl_file = "third_party/rust/remote_settings/src/remote_settings.udl" diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustArithmetic.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustArithmetic.sys.mjs index 3929ba2078ed..8716652a6f7a 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustArithmetic.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustArithmetic.sys.mjs @@ -376,7 +376,7 @@ export function add(a,b) { throw e; } return UniFFIScaffolding.callAsync( - 59, // arithmetic:uniffi_arithmetical_fn_func_add + 82, // arithmetic:uniffi_arithmetical_fn_func_add FfiConverterU64.lower(a), FfiConverterU64.lower(b), ) @@ -410,7 +410,7 @@ export function div(dividend,divisor) { throw e; } return UniFFIScaffolding.callAsync( - 60, // arithmetic:uniffi_arithmetical_fn_func_div + 83, // arithmetic:uniffi_arithmetical_fn_func_div FfiConverterU64.lower(dividend), FfiConverterU64.lower(divisor), ) @@ -444,7 +444,7 @@ export function equal(a,b) { throw e; } return UniFFIScaffolding.callAsync( - 61, // arithmetic:uniffi_arithmetical_fn_func_equal + 84, // arithmetic:uniffi_arithmetical_fn_func_equal FfiConverterU64.lower(a), FfiConverterU64.lower(b), ) @@ -478,7 +478,7 @@ export function sub(a,b) { throw e; } return UniFFIScaffolding.callAsync( - 62, // arithmetic:uniffi_arithmetical_fn_func_sub + 85, // arithmetic:uniffi_arithmetical_fn_func_sub FfiConverterU64.lower(a), FfiConverterU64.lower(b), ) diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustCustomTypes.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustCustomTypes.sys.mjs index 900061ac897c..d9c53da56aba 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustCustomTypes.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustCustomTypes.sys.mjs @@ -454,7 +454,7 @@ export function getCustomTypesDemo(demo) { throw e; } return UniFFIScaffolding.callAsync( - 63, // custom_types:uniffi_uniffi_custom_types_fn_func_get_custom_types_demo + 86, // custom_types:uniffi_uniffi_custom_types_fn_func_get_custom_types_demo FfiConverterOptionalTypeCustomTypesDemo.lower(demo), ) } diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustExternalTypes.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustExternalTypes.sys.mjs index 3eac0adc3acd..083de095a588 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustExternalTypes.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustExternalTypes.sys.mjs @@ -380,7 +380,7 @@ export function gradient(value) { throw e; } return UniFFIScaffolding.callAsync( - 64, // external_types:uniffi_uniffi_fixture_external_types_fn_func_gradient + 87, // external_types:uniffi_uniffi_fixture_external_types_fn_func_gradient FfiConverterOptionalTypeLine.lower(value), ) } @@ -413,7 +413,7 @@ export function intersection(ln1,ln2) { throw e; } return UniFFIScaffolding.callAsync( - 65, // external_types:uniffi_uniffi_fixture_external_types_fn_func_intersection + 88, // external_types:uniffi_uniffi_fixture_external_types_fn_func_intersection FfiConverterTypeLine.lower(ln1), FfiConverterTypeLine.lower(ln2), ) diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustGeometry.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustGeometry.sys.mjs index ee70afc34696..633624d0d78f 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustGeometry.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustGeometry.sys.mjs @@ -473,7 +473,7 @@ export function gradient(ln) { throw e; } return UniFFIScaffolding.callAsync( - 70, // geometry:uniffi_uniffi_geometry_fn_func_gradient + 93, // geometry:uniffi_uniffi_geometry_fn_func_gradient FfiConverterTypeLine.lower(ln), ) } @@ -506,7 +506,7 @@ export function intersection(ln1,ln2) { throw e; } return UniFFIScaffolding.callAsync( - 71, // geometry:uniffi_uniffi_geometry_fn_func_intersection + 94, // geometry:uniffi_uniffi_geometry_fn_func_intersection FfiConverterTypeLine.lower(ln1), FfiConverterTypeLine.lower(ln2), ) diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRefcounts.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRefcounts.sys.mjs index 7adb4f0c3a1b..534c1ca99c4f 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRefcounts.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRefcounts.sys.mjs @@ -158,7 +158,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerSingletonObject() { - const pointerId = 7; // refcounts:SingletonObject + const pointerId = 9; // refcounts:SingletonObject const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -168,7 +168,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerSingletonObject(value) { - const pointerId = 7; // refcounts:SingletonObject + const pointerId = 9; // refcounts:SingletonObject UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -320,7 +320,7 @@ export class SingletonObject { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 67, // refcounts:uniffi_uniffi_fixture_refcounts_fn_method_singletonobject_method + 90, // refcounts:uniffi_uniffi_fixture_refcounts_fn_method_singletonobject_method FfiConverterTypeSingletonObject.lower(this), ) } @@ -368,7 +368,7 @@ export function getJsRefcount() { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 68, // refcounts:uniffi_uniffi_fixture_refcounts_fn_func_get_js_refcount + 91, // refcounts:uniffi_uniffi_fixture_refcounts_fn_func_get_js_refcount ) } return handleRustResult(functionCall(), liftResult, liftError); @@ -380,7 +380,7 @@ export function getSingleton() { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 69, // refcounts:uniffi_uniffi_fixture_refcounts_fn_func_get_singleton + 92, // refcounts:uniffi_uniffi_fixture_refcounts_fn_func_get_singleton ) } return handleRustResult(functionCall(), liftResult, liftError); diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRondpoint.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRondpoint.sys.mjs index fa7bdda087f2..b7bd30c80e05 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRondpoint.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRondpoint.sys.mjs @@ -158,7 +158,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerOptionneur() { - const pointerId = 8; // rondpoint:Optionneur + const pointerId = 10; // rondpoint:Optionneur const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -168,7 +168,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerOptionneur(value) { - const pointerId = 8; // rondpoint:Optionneur + const pointerId = 10; // rondpoint:Optionneur UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -178,7 +178,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerRetourneur() { - const pointerId = 9; // rondpoint:Retourneur + const pointerId = 11; // rondpoint:Retourneur const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -188,7 +188,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerRetourneur(value) { - const pointerId = 9; // rondpoint:Retourneur + const pointerId = 11; // rondpoint:Retourneur UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -198,7 +198,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerStringifier() { - const pointerId = 10; // rondpoint:Stringifier + const pointerId = 12; // rondpoint:Stringifier const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -208,7 +208,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerStringifier(value) { - const pointerId = 10; // rondpoint:Stringifier + const pointerId = 12; // rondpoint:Stringifier UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -619,7 +619,7 @@ export class Optionneur { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 73, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_optionneur_new + 96, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_optionneur_new ) } try { @@ -641,7 +641,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 74, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_boolean + 97, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_boolean FfiConverterTypeOptionneur.lower(this), FfiConverterBool.lower(value), ) @@ -666,7 +666,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 75, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_enum + 98, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_enum FfiConverterTypeOptionneur.lower(this), FfiConverterTypeEnumeration.lower(value), ) @@ -691,7 +691,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 76, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f32 + 99, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f32 FfiConverterTypeOptionneur.lower(this), FfiConverterF32.lower(value), ) @@ -716,7 +716,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 77, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f64 + 100, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f64 FfiConverterTypeOptionneur.lower(this), FfiConverterF64.lower(value), ) @@ -741,7 +741,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 78, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec + 101, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec FfiConverterTypeOptionneur.lower(this), FfiConverterI16.lower(value), ) @@ -766,7 +766,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 79, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex + 102, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex FfiConverterTypeOptionneur.lower(this), FfiConverterI16.lower(value), ) @@ -791,7 +791,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 80, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec + 103, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec FfiConverterTypeOptionneur.lower(this), FfiConverterI32.lower(value), ) @@ -816,7 +816,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 81, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex + 104, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex FfiConverterTypeOptionneur.lower(this), FfiConverterI32.lower(value), ) @@ -841,7 +841,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 82, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec + 105, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec FfiConverterTypeOptionneur.lower(this), FfiConverterI64.lower(value), ) @@ -866,7 +866,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 83, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex + 106, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex FfiConverterTypeOptionneur.lower(this), FfiConverterI64.lower(value), ) @@ -891,7 +891,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 84, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec + 107, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec FfiConverterTypeOptionneur.lower(this), FfiConverterI8.lower(value), ) @@ -916,7 +916,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 85, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex + 108, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex FfiConverterTypeOptionneur.lower(this), FfiConverterI8.lower(value), ) @@ -941,7 +941,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 86, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_null + 109, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_null FfiConverterTypeOptionneur.lower(this), FfiConverterOptionalstring.lower(value), ) @@ -966,7 +966,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 87, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_sequence + 110, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_sequence FfiConverterTypeOptionneur.lower(this), FfiConverterSequencestring.lower(value), ) @@ -991,7 +991,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 88, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_string + 111, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_string FfiConverterTypeOptionneur.lower(this), FfiConverterString.lower(value), ) @@ -1016,7 +1016,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 89, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec + 112, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec FfiConverterTypeOptionneur.lower(this), FfiConverterU16.lower(value), ) @@ -1041,7 +1041,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 90, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex + 113, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex FfiConverterTypeOptionneur.lower(this), FfiConverterU16.lower(value), ) @@ -1066,7 +1066,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 91, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec + 114, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec FfiConverterTypeOptionneur.lower(this), FfiConverterU32.lower(value), ) @@ -1091,7 +1091,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 92, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex + 115, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex FfiConverterTypeOptionneur.lower(this), FfiConverterU32.lower(value), ) @@ -1116,7 +1116,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 93, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct + 116, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct FfiConverterTypeOptionneur.lower(this), FfiConverterU32.lower(value), ) @@ -1141,7 +1141,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 94, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec + 117, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec FfiConverterTypeOptionneur.lower(this), FfiConverterU64.lower(value), ) @@ -1166,7 +1166,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 95, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex + 118, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex FfiConverterTypeOptionneur.lower(this), FfiConverterU64.lower(value), ) @@ -1191,7 +1191,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 96, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec + 119, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec FfiConverterTypeOptionneur.lower(this), FfiConverterU8.lower(value), ) @@ -1216,7 +1216,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 97, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex + 120, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex FfiConverterTypeOptionneur.lower(this), FfiConverterU8.lower(value), ) @@ -1241,7 +1241,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 98, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_zero + 121, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_zero FfiConverterTypeOptionneur.lower(this), FfiConverterOptionali32.lower(value), ) @@ -1308,7 +1308,7 @@ export class Retourneur { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 100, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_retourneur_new + 123, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_retourneur_new ) } try { @@ -1330,7 +1330,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 101, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_boolean + 124, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_boolean FfiConverterTypeRetourneur.lower(this), FfiConverterBool.lower(value), ) @@ -1355,7 +1355,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 102, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_double + 125, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_double FfiConverterTypeRetourneur.lower(this), FfiConverterF64.lower(value), ) @@ -1380,7 +1380,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 103, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_float + 126, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_float FfiConverterTypeRetourneur.lower(this), FfiConverterF32.lower(value), ) @@ -1405,7 +1405,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 104, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i16 + 127, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i16 FfiConverterTypeRetourneur.lower(this), FfiConverterI16.lower(value), ) @@ -1430,7 +1430,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 105, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i32 + 128, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i32 FfiConverterTypeRetourneur.lower(this), FfiConverterI32.lower(value), ) @@ -1455,7 +1455,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 106, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i64 + 129, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i64 FfiConverterTypeRetourneur.lower(this), FfiConverterI64.lower(value), ) @@ -1480,7 +1480,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 107, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i8 + 130, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i8 FfiConverterTypeRetourneur.lower(this), FfiConverterI8.lower(value), ) @@ -1505,7 +1505,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 108, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres + 131, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres FfiConverterTypeRetourneur.lower(this), FfiConverterTypeDictionnaireNombres.lower(value), ) @@ -1530,7 +1530,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 109, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes + 132, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes FfiConverterTypeRetourneur.lower(this), FfiConverterTypeDictionnaireNombresSignes.lower(value), ) @@ -1555,7 +1555,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 110, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire + 133, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire FfiConverterTypeRetourneur.lower(this), FfiConverterTypeOptionneurDictionnaire.lower(value), ) @@ -1580,7 +1580,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 111, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_string + 134, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_string FfiConverterTypeRetourneur.lower(this), FfiConverterString.lower(value), ) @@ -1605,7 +1605,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 112, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u16 + 135, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u16 FfiConverterTypeRetourneur.lower(this), FfiConverterU16.lower(value), ) @@ -1630,7 +1630,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 113, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u32 + 136, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u32 FfiConverterTypeRetourneur.lower(this), FfiConverterU32.lower(value), ) @@ -1655,7 +1655,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 114, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u64 + 137, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u64 FfiConverterTypeRetourneur.lower(this), FfiConverterU64.lower(value), ) @@ -1680,7 +1680,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 115, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u8 + 138, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u8 FfiConverterTypeRetourneur.lower(this), FfiConverterU8.lower(value), ) @@ -1747,7 +1747,7 @@ export class Stringifier { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 117, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_stringifier_new + 140, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_stringifier_new ) } try { @@ -1769,7 +1769,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 118, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_boolean + 141, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_boolean FfiConverterTypeStringifier.lower(this), FfiConverterBool.lower(value), ) @@ -1794,7 +1794,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 119, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_double + 142, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_double FfiConverterTypeStringifier.lower(this), FfiConverterF64.lower(value), ) @@ -1819,7 +1819,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 120, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_float + 143, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_float FfiConverterTypeStringifier.lower(this), FfiConverterF32.lower(value), ) @@ -1844,7 +1844,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 121, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i16 + 144, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i16 FfiConverterTypeStringifier.lower(this), FfiConverterI16.lower(value), ) @@ -1869,7 +1869,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 122, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i32 + 145, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i32 FfiConverterTypeStringifier.lower(this), FfiConverterI32.lower(value), ) @@ -1894,7 +1894,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 123, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i64 + 146, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i64 FfiConverterTypeStringifier.lower(this), FfiConverterI64.lower(value), ) @@ -1919,7 +1919,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 124, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i8 + 147, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i8 FfiConverterTypeStringifier.lower(this), FfiConverterI8.lower(value), ) @@ -1944,7 +1944,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 125, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u16 + 148, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u16 FfiConverterTypeStringifier.lower(this), FfiConverterU16.lower(value), ) @@ -1969,7 +1969,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 126, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u32 + 149, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u32 FfiConverterTypeStringifier.lower(this), FfiConverterU32.lower(value), ) @@ -1994,7 +1994,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 127, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u64 + 150, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u64 FfiConverterTypeStringifier.lower(this), FfiConverterU64.lower(value), ) @@ -2019,7 +2019,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 128, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u8 + 151, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u8 FfiConverterTypeStringifier.lower(this), FfiConverterU8.lower(value), ) @@ -2044,7 +2044,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 129, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_well_known_string + 152, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_well_known_string FfiConverterTypeStringifier.lower(this), FfiConverterString.lower(value), ) @@ -3283,7 +3283,7 @@ export function copieCarte(c) { throw e; } return UniFFIScaffolding.callAsync( - 130, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_carte + 153, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_carte FfiConverterMapStringTypeEnumerationAvecDonnees.lower(c), ) } @@ -3308,7 +3308,7 @@ export function copieDictionnaire(d) { throw e; } return UniFFIScaffolding.callAsync( - 131, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_dictionnaire + 154, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_dictionnaire FfiConverterTypeDictionnaire.lower(d), ) } @@ -3333,7 +3333,7 @@ export function copieEnumeration(e) { throw e; } return UniFFIScaffolding.callAsync( - 132, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumeration + 155, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumeration FfiConverterTypeEnumeration.lower(e), ) } @@ -3358,7 +3358,7 @@ export function copieEnumerations(e) { throw e; } return UniFFIScaffolding.callAsync( - 133, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumerations + 156, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumerations FfiConverterSequenceTypeEnumeration.lower(e), ) } @@ -3383,7 +3383,7 @@ export function switcheroo(b) { throw e; } return UniFFIScaffolding.callAsync( - 134, // rondpoint:uniffi_uniffi_rondpoint_fn_func_switcheroo + 157, // rondpoint:uniffi_uniffi_rondpoint_fn_func_switcheroo FfiConverterBool.lower(b), ) } diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustSprites.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustSprites.sys.mjs index 06d55d3ac3ce..c57567a6af56 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustSprites.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustSprites.sys.mjs @@ -158,7 +158,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerSprite() { - const pointerId = 11; // sprites:Sprite + const pointerId = 13; // sprites:Sprite const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -168,7 +168,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerSprite(value) { - const pointerId = 11; // sprites:Sprite + const pointerId = 13; // sprites:Sprite UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -324,7 +324,7 @@ export class Sprite { throw e; } return UniFFIScaffolding.callAsync( - 136, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new + 159, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new FfiConverterOptionalTypePoint.lower(initialPosition), ) } @@ -360,7 +360,7 @@ export class Sprite { throw e; } return UniFFIScaffolding.callAsync( - 137, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new_relative_to + 160, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new_relative_to FfiConverterTypePoint.lower(reference), FfiConverterTypeVector.lower(direction), ) @@ -376,7 +376,7 @@ export class Sprite { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 138, // sprites:uniffi_uniffi_sprites_fn_method_sprite_get_position + 161, // sprites:uniffi_uniffi_sprites_fn_method_sprite_get_position FfiConverterTypeSprite.lower(this), ) } @@ -400,7 +400,7 @@ export class Sprite { throw e; } return UniFFIScaffolding.callAsync( - 139, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_by + 162, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_by FfiConverterTypeSprite.lower(this), FfiConverterTypeVector.lower(direction), ) @@ -425,7 +425,7 @@ export class Sprite { throw e; } return UniFFIScaffolding.callAsync( - 140, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_to + 163, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_to FfiConverterTypeSprite.lower(this), FfiConverterTypePoint.lower(position), ) @@ -677,7 +677,7 @@ export function translate(position,direction) { throw e; } return UniFFIScaffolding.callAsync( - 141, // sprites:uniffi_uniffi_sprites_fn_func_translate + 164, // sprites:uniffi_uniffi_sprites_fn_func_translate FfiConverterTypePoint.lower(position), FfiConverterTypeVector.lower(direction), ) diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustTodolist.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustTodolist.sys.mjs index c4de5f7dd339..1288b11a4e1e 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustTodolist.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustTodolist.sys.mjs @@ -158,7 +158,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerTodoList() { - const pointerId = 12; // todolist:TodoList + const pointerId = 14; // todolist:TodoList const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -168,7 +168,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerTodoList(value) { - const pointerId = 12; // todolist:TodoList + const pointerId = 14; // todolist:TodoList UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -297,7 +297,7 @@ export class TodoList { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 143, // todolist:uniffi_uniffi_todolist_fn_constructor_todolist_new + 166, // todolist:uniffi_uniffi_todolist_fn_constructor_todolist_new ) } try { @@ -319,7 +319,7 @@ export class TodoList { throw e; } return UniFFIScaffolding.callAsync( - 144, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entries + 167, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entries FfiConverterTypeTodoList.lower(this), FfiConverterSequenceTypeTodoEntry.lower(entries), ) @@ -344,7 +344,7 @@ export class TodoList { throw e; } return UniFFIScaffolding.callAsync( - 145, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entry + 168, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entry FfiConverterTypeTodoList.lower(this), FfiConverterTypeTodoEntry.lower(entry), ) @@ -369,7 +369,7 @@ export class TodoList { throw e; } return UniFFIScaffolding.callAsync( - 146, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_item + 169, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_item FfiConverterTypeTodoList.lower(this), FfiConverterString.lower(todo), ) @@ -394,7 +394,7 @@ export class TodoList { throw e; } return UniFFIScaffolding.callAsync( - 147, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_items + 170, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_items FfiConverterTypeTodoList.lower(this), FfiConverterSequencestring.lower(items), ) @@ -419,7 +419,7 @@ export class TodoList { throw e; } return UniFFIScaffolding.callAsync( - 148, // todolist:uniffi_uniffi_todolist_fn_method_todolist_clear_item + 171, // todolist:uniffi_uniffi_todolist_fn_method_todolist_clear_item FfiConverterTypeTodoList.lower(this), FfiConverterString.lower(todo), ) @@ -436,7 +436,7 @@ export class TodoList { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 149, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_entries + 172, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_entries FfiConverterTypeTodoList.lower(this), ) } @@ -452,7 +452,7 @@ export class TodoList { const liftError = (data) => FfiConverterTypeTodoError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsync( - 150, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_first + 173, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_first FfiConverterTypeTodoList.lower(this), ) } @@ -468,7 +468,7 @@ export class TodoList { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 151, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_items + 174, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_items FfiConverterTypeTodoList.lower(this), ) } @@ -484,7 +484,7 @@ export class TodoList { const liftError = (data) => FfiConverterTypeTodoError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsync( - 152, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last + 175, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last FfiConverterTypeTodoList.lower(this), ) } @@ -500,7 +500,7 @@ export class TodoList { const liftError = (data) => FfiConverterTypeTodoError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsync( - 153, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last_entry + 176, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last_entry FfiConverterTypeTodoList.lower(this), ) } @@ -516,7 +516,7 @@ export class TodoList { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 154, // todolist:uniffi_uniffi_todolist_fn_method_todolist_make_default + 177, // todolist:uniffi_uniffi_todolist_fn_method_todolist_make_default FfiConverterTypeTodoList.lower(this), ) } @@ -879,7 +879,7 @@ export function createEntryWith(todo) { throw e; } return UniFFIScaffolding.callAsync( - 155, // todolist:uniffi_uniffi_todolist_fn_func_create_entry_with + 178, // todolist:uniffi_uniffi_todolist_fn_func_create_entry_with FfiConverterString.lower(todo), ) } @@ -896,7 +896,7 @@ export function getDefaultList() { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 156, // todolist:uniffi_uniffi_todolist_fn_func_get_default_list + 179, // todolist:uniffi_uniffi_todolist_fn_func_get_default_list ) } try { @@ -920,7 +920,7 @@ export function setDefaultList(list) { throw e; } return UniFFIScaffolding.callAsync( - 157, // todolist:uniffi_uniffi_todolist_fn_func_set_default_list + 180, // todolist:uniffi_uniffi_todolist_fn_func_set_default_list FfiConverterTypeTodoList.lower(list), ) } diff --git a/toolkit/components/uniffi-js/UniFFIFixtureScaffolding.cpp b/toolkit/components/uniffi-js/UniFFIFixtureScaffolding.cpp index fe5da4b4528d..b7ad81d28901 100644 --- a/toolkit/components/uniffi-js/UniFFIFixtureScaffolding.cpp +++ b/toolkit/components/uniffi-js/UniFFIFixtureScaffolding.cpp @@ -4173,283 +4173,283 @@ public: UniquePtr UniFFIFixturesGetHandler(uint64_t aId) { switch (aId) { - case 59: { + case 82: { return MakeUnique(); } - case 60: { + case 83: { return MakeUnique(); } - case 61: { + case 84: { return MakeUnique(); } - case 62: { + case 85: { return MakeUnique(); } - case 63: { + case 86: { return MakeUnique(); } - case 64: { + case 87: { return MakeUnique(); } - case 65: { + case 88: { return MakeUnique(); } - case 67: { + case 90: { return MakeUnique(); } - case 68: { + case 91: { return MakeUnique(); } - case 69: { + case 92: { return MakeUnique(); } - case 70: { + case 93: { return MakeUnique(); } - case 71: { + case 94: { return MakeUnique(); } - case 73: { + case 96: { return MakeUnique(); } - case 74: { + case 97: { return MakeUnique(); } - case 75: { + case 98: { return MakeUnique(); } - case 76: { + case 99: { return MakeUnique(); } - case 77: { + case 100: { return MakeUnique(); } - case 78: { + case 101: { return MakeUnique(); } - case 79: { + case 102: { return MakeUnique(); } - case 80: { + case 103: { return MakeUnique(); } - case 81: { + case 104: { return MakeUnique(); } - case 82: { + case 105: { return MakeUnique(); } - case 83: { + case 106: { return MakeUnique(); } - case 84: { + case 107: { return MakeUnique(); } - case 85: { + case 108: { return MakeUnique(); } - case 86: { + case 109: { return MakeUnique(); } - case 87: { + case 110: { return MakeUnique(); } - case 88: { + case 111: { return MakeUnique(); } - case 89: { + case 112: { return MakeUnique(); } - case 90: { + case 113: { return MakeUnique(); } - case 91: { + case 114: { return MakeUnique(); } - case 92: { + case 115: { return MakeUnique(); } - case 93: { + case 116: { return MakeUnique(); } - case 94: { + case 117: { return MakeUnique(); } - case 95: { + case 118: { return MakeUnique(); } - case 96: { + case 119: { return MakeUnique(); } - case 97: { + case 120: { return MakeUnique(); } - case 98: { + case 121: { return MakeUnique(); } - case 100: { + case 123: { return MakeUnique(); } - case 101: { + case 124: { return MakeUnique(); } - case 102: { + case 125: { return MakeUnique(); } - case 103: { + case 126: { return MakeUnique(); } - case 104: { + case 127: { return MakeUnique(); } - case 105: { + case 128: { return MakeUnique(); } - case 106: { + case 129: { return MakeUnique(); } - case 107: { + case 130: { return MakeUnique(); } - case 108: { + case 131: { return MakeUnique(); } - case 109: { + case 132: { return MakeUnique(); } - case 110: { + case 133: { return MakeUnique(); } - case 111: { + case 134: { return MakeUnique(); } - case 112: { + case 135: { return MakeUnique(); } - case 113: { + case 136: { return MakeUnique(); } - case 114: { + case 137: { return MakeUnique(); } - case 115: { + case 138: { return MakeUnique(); } - case 117: { + case 140: { return MakeUnique(); } - case 118: { + case 141: { return MakeUnique(); } - case 119: { + case 142: { return MakeUnique(); } - case 120: { + case 143: { return MakeUnique(); } - case 121: { + case 144: { return MakeUnique(); } - case 122: { + case 145: { return MakeUnique(); } - case 123: { + case 146: { return MakeUnique(); } - case 124: { + case 147: { return MakeUnique(); } - case 125: { + case 148: { return MakeUnique(); } - case 126: { + case 149: { return MakeUnique(); } - case 127: { + case 150: { return MakeUnique(); } - case 128: { + case 151: { return MakeUnique(); } - case 129: { + case 152: { return MakeUnique(); } - case 130: { + case 153: { return MakeUnique(); } - case 131: { + case 154: { return MakeUnique(); } - case 132: { + case 155: { return MakeUnique(); } - case 133: { + case 156: { return MakeUnique(); } - case 134: { + case 157: { return MakeUnique(); } - case 136: { + case 159: { return MakeUnique(); } - case 137: { + case 160: { return MakeUnique(); } - case 138: { + case 161: { return MakeUnique(); } - case 139: { + case 162: { return MakeUnique(); } - case 140: { + case 163: { return MakeUnique(); } - case 141: { + case 164: { return MakeUnique(); } - case 143: { + case 166: { return MakeUnique(); } - case 144: { + case 167: { return MakeUnique(); } - case 145: { + case 168: { return MakeUnique(); } - case 146: { + case 169: { return MakeUnique(); } - case 147: { + case 170: { return MakeUnique(); } - case 148: { + case 171: { return MakeUnique(); } - case 149: { + case 172: { return MakeUnique(); } - case 150: { + case 173: { return MakeUnique(); } - case 151: { + case 174: { return MakeUnique(); } - case 152: { + case 175: { return MakeUnique(); } - case 153: { + case 176: { return MakeUnique(); } - case 154: { + case 177: { return MakeUnique(); } - case 155: { + case 178: { return MakeUnique(); } - case 156: { + case 179: { return MakeUnique(); } - case 157: { + case 180: { return MakeUnique(); } @@ -4461,27 +4461,27 @@ UniquePtr UniFFIFixturesGetHandler(uint64_t aId) { Maybe> UniFFIFixturesReadPointer(const GlobalObject& aGlobal, uint64_t aId, const ArrayBuffer& aArrayBuff, long aPosition, ErrorResult& aError) { const UniFFIPointerType* type; switch (aId) { - case 7: { // refcounts:SingletonObject + case 9: { // refcounts:SingletonObject type = &kRefcountsSingletonObjectPointerType; break; } - case 8: { // rondpoint:Optionneur + case 10: { // rondpoint:Optionneur type = &kRondpointOptionneurPointerType; break; } - case 9: { // rondpoint:Retourneur + case 11: { // rondpoint:Retourneur type = &kRondpointRetourneurPointerType; break; } - case 10: { // rondpoint:Stringifier + case 12: { // rondpoint:Stringifier type = &kRondpointStringifierPointerType; break; } - case 11: { // sprites:Sprite + case 13: { // sprites:Sprite type = &kSpritesSpritePointerType; break; } - case 12: { // todolist:TodoList + case 14: { // todolist:TodoList type = &kTodolistTodoListPointerType; break; } @@ -4494,27 +4494,27 @@ Maybe> UniFFIFixturesReadPointer(const GlobalObj bool UniFFIFixturesWritePointer(const GlobalObject& aGlobal, uint64_t aId, const UniFFIPointer& aPtr, const ArrayBuffer& aArrayBuff, long aPosition, ErrorResult& aError) { const UniFFIPointerType* type; switch (aId) { - case 7: { // refcounts:SingletonObject + case 9: { // refcounts:SingletonObject type = &kRefcountsSingletonObjectPointerType; break; } - case 8: { // rondpoint:Optionneur + case 10: { // rondpoint:Optionneur type = &kRondpointOptionneurPointerType; break; } - case 9: { // rondpoint:Retourneur + case 11: { // rondpoint:Retourneur type = &kRondpointRetourneurPointerType; break; } - case 10: { // rondpoint:Stringifier + case 12: { // rondpoint:Stringifier type = &kRondpointStringifierPointerType; break; } - case 11: { // sprites:Sprite + case 13: { // sprites:Sprite type = &kSpritesSpritePointerType; break; } - case 12: { // todolist:TodoList + case 14: { // todolist:TodoList type = &kTodolistTodoListPointerType; break; } diff --git a/toolkit/components/uniffi-js/UniFFIGeneratedScaffolding.cpp b/toolkit/components/uniffi-js/UniFFIGeneratedScaffolding.cpp index e229bd3afcf0..4c70c79819bf 100644 --- a/toolkit/components/uniffi-js/UniFFIGeneratedScaffolding.cpp +++ b/toolkit/components/uniffi-js/UniFFIGeneratedScaffolding.cpp @@ -95,6 +95,31 @@ extern "C" { void* uniffi_tabs_fn_method_tabsstore_new_remote_command_store(void*, RustCallStatus*); void uniffi_tabs_fn_method_tabsstore_register_with_sync_manager(void*, RustCallStatus*); void uniffi_tabs_fn_method_tabsstore_set_local_tabs(void*, RustBuffer, RustCallStatus*); + void* uniffi_webext_storage_fn_clone_webextstoragebridgedengine(void*, RustCallStatus*); + void uniffi_webext_storage_fn_free_webextstoragebridgedengine(void*, RustCallStatus*); + RustBuffer uniffi_webext_storage_fn_method_webextstoragebridgedengine_apply(void*, RustCallStatus*); + RustBuffer uniffi_webext_storage_fn_method_webextstoragebridgedengine_ensure_current_sync_id(void*, RustBuffer, RustCallStatus*); + int64_t uniffi_webext_storage_fn_method_webextstoragebridgedengine_last_sync(void*, RustCallStatus*); + void uniffi_webext_storage_fn_method_webextstoragebridgedengine_prepare_for_sync(void*, RustBuffer, RustCallStatus*); + void uniffi_webext_storage_fn_method_webextstoragebridgedengine_reset(void*, RustCallStatus*); + RustBuffer uniffi_webext_storage_fn_method_webextstoragebridgedengine_reset_sync_id(void*, RustCallStatus*); + void uniffi_webext_storage_fn_method_webextstoragebridgedengine_set_last_sync(void*, int64_t, RustCallStatus*); + void uniffi_webext_storage_fn_method_webextstoragebridgedengine_set_uploaded(void*, int64_t, RustBuffer, RustCallStatus*); + void uniffi_webext_storage_fn_method_webextstoragebridgedengine_store_incoming(void*, RustBuffer, RustCallStatus*); + void uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_finished(void*, RustCallStatus*); + RustBuffer uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_id(void*, RustCallStatus*); + void uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_started(void*, RustCallStatus*); + void uniffi_webext_storage_fn_method_webextstoragebridgedengine_wipe(void*, RustCallStatus*); + void* uniffi_webext_storage_fn_clone_webextstoragestore(void*, RustCallStatus*); + void uniffi_webext_storage_fn_free_webextstoragestore(void*, RustCallStatus*); + void* uniffi_webext_storage_fn_constructor_webextstoragestore_new(RustBuffer, RustCallStatus*); + void* uniffi_webext_storage_fn_method_webextstoragestore_bridged_engine(void*, RustCallStatus*); + RustBuffer uniffi_webext_storage_fn_method_webextstoragestore_clear(void*, RustBuffer, RustCallStatus*); + RustBuffer uniffi_webext_storage_fn_method_webextstoragestore_get(void*, RustBuffer, RustBuffer, RustCallStatus*); + uint64_t uniffi_webext_storage_fn_method_webextstoragestore_get_bytes_in_use(void*, RustBuffer, RustBuffer, RustCallStatus*); + RustBuffer uniffi_webext_storage_fn_method_webextstoragestore_get_synced_changes(void*, RustCallStatus*); + RustBuffer uniffi_webext_storage_fn_method_webextstoragestore_remove(void*, RustBuffer, RustBuffer, RustCallStatus*); + RustBuffer uniffi_webext_storage_fn_method_webextstoragestore_set(void*, RustBuffer, RustBuffer, RustCallStatus*); } // Define pointer types @@ -133,6 +158,16 @@ const static mozilla::uniffi::UniFFIPointerType kTabsTabsStorePointerType { uniffi_tabs_fn_clone_tabsstore, uniffi_tabs_fn_free_tabsstore, }; +const static mozilla::uniffi::UniFFIPointerType kWebextstorageWebExtStorageBridgedEnginePointerType { + "webextstorage::WebExtStorageBridgedEngine"_ns, + uniffi_webext_storage_fn_clone_webextstoragebridgedengine, + uniffi_webext_storage_fn_free_webextstoragebridgedengine, +}; +const static mozilla::uniffi::UniFFIPointerType kWebextstorageWebExtStorageStorePointerType { + "webextstorage::WebExtStorageStore"_ns, + uniffi_webext_storage_fn_clone_webextstoragestore, + uniffi_webext_storage_fn_free_webextstoragestore, +}; // Define the data we need per-callback interface @@ -2265,6 +2300,864 @@ public: virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { } }; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragebridgedengineApply : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntermediateType mPtr; + + // MakeRustCall stores the result of the call in these fields + typename ScaffoldingConverter::IntermediateType mUniffiReturnValue; + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + mUniffiReturnValue = ScaffoldingConverter::FromRust( + uniffi_webext_storage_fn_method_webextstoragebridgedengine_apply( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntoRust(std::move(mPtr)), + &callStatus + ) + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + ScaffoldingConverter::IntoJs( + aCx, + std::move(mUniffiReturnValue), + aDest, + aError + ); + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragebridgedengineEnsureCurrentSyncId : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntermediateType mPtr; + typename ScaffoldingConverter::IntermediateType mNewSyncId; + + // MakeRustCall stores the result of the call in these fields + typename ScaffoldingConverter::IntermediateType mUniffiReturnValue; + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + ScaffoldingConverter::FromJs(aArgs[1], &mNewSyncId, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + mUniffiReturnValue = ScaffoldingConverter::FromRust( + uniffi_webext_storage_fn_method_webextstoragebridgedengine_ensure_current_sync_id( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntoRust(std::move(mPtr)), + ScaffoldingConverter::IntoRust(std::move(mNewSyncId)), + &callStatus + ) + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + ScaffoldingConverter::IntoJs( + aCx, + std::move(mUniffiReturnValue), + aDest, + aError + ); + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragebridgedengineLastSync : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntermediateType mPtr; + + // MakeRustCall stores the result of the call in these fields + typename ScaffoldingConverter::IntermediateType mUniffiReturnValue; + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + mUniffiReturnValue = ScaffoldingConverter::FromRust( + uniffi_webext_storage_fn_method_webextstoragebridgedengine_last_sync( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntoRust(std::move(mPtr)), + &callStatus + ) + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + ScaffoldingConverter::IntoJs( + aCx, + std::move(mUniffiReturnValue), + aDest, + aError + ); + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragebridgedenginePrepareForSync : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntermediateType mPtr; + typename ScaffoldingConverter::IntermediateType mClientData; + + // MakeRustCall stores the result of the call in these fields + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + ScaffoldingConverter::FromJs(aArgs[1], &mClientData, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + uniffi_webext_storage_fn_method_webextstoragebridgedengine_prepare_for_sync( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntoRust(std::move(mPtr)), + ScaffoldingConverter::IntoRust(std::move(mClientData)), + &callStatus + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragebridgedengineReset : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntermediateType mPtr; + + // MakeRustCall stores the result of the call in these fields + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + uniffi_webext_storage_fn_method_webextstoragebridgedengine_reset( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntoRust(std::move(mPtr)), + &callStatus + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragebridgedengineResetSyncId : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntermediateType mPtr; + + // MakeRustCall stores the result of the call in these fields + typename ScaffoldingConverter::IntermediateType mUniffiReturnValue; + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + mUniffiReturnValue = ScaffoldingConverter::FromRust( + uniffi_webext_storage_fn_method_webextstoragebridgedengine_reset_sync_id( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntoRust(std::move(mPtr)), + &callStatus + ) + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + ScaffoldingConverter::IntoJs( + aCx, + std::move(mUniffiReturnValue), + aDest, + aError + ); + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragebridgedengineSetLastSync : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntermediateType mPtr; + typename ScaffoldingConverter::IntermediateType mLastSync; + + // MakeRustCall stores the result of the call in these fields + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + ScaffoldingConverter::FromJs(aArgs[1], &mLastSync, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + uniffi_webext_storage_fn_method_webextstoragebridgedengine_set_last_sync( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntoRust(std::move(mPtr)), + ScaffoldingConverter::IntoRust(std::move(mLastSync)), + &callStatus + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragebridgedengineSetUploaded : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntermediateType mPtr; + typename ScaffoldingConverter::IntermediateType mServerModifiedMillis; + typename ScaffoldingConverter::IntermediateType mGuids; + + // MakeRustCall stores the result of the call in these fields + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + ScaffoldingConverter::FromJs(aArgs[1], &mServerModifiedMillis, aError); + if (aError.Failed()) { + return; + } + ScaffoldingConverter::FromJs(aArgs[2], &mGuids, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + uniffi_webext_storage_fn_method_webextstoragebridgedengine_set_uploaded( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntoRust(std::move(mPtr)), + ScaffoldingConverter::IntoRust(std::move(mServerModifiedMillis)), + ScaffoldingConverter::IntoRust(std::move(mGuids)), + &callStatus + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragebridgedengineStoreIncoming : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntermediateType mPtr; + typename ScaffoldingConverter::IntermediateType mIncoming; + + // MakeRustCall stores the result of the call in these fields + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + ScaffoldingConverter::FromJs(aArgs[1], &mIncoming, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + uniffi_webext_storage_fn_method_webextstoragebridgedengine_store_incoming( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntoRust(std::move(mPtr)), + ScaffoldingConverter::IntoRust(std::move(mIncoming)), + &callStatus + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragebridgedengineSyncFinished : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntermediateType mPtr; + + // MakeRustCall stores the result of the call in these fields + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_finished( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntoRust(std::move(mPtr)), + &callStatus + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragebridgedengineSyncId : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntermediateType mPtr; + + // MakeRustCall stores the result of the call in these fields + typename ScaffoldingConverter::IntermediateType mUniffiReturnValue; + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + mUniffiReturnValue = ScaffoldingConverter::FromRust( + uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_id( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntoRust(std::move(mPtr)), + &callStatus + ) + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + ScaffoldingConverter::IntoJs( + aCx, + std::move(mUniffiReturnValue), + aDest, + aError + ); + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragebridgedengineSyncStarted : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntermediateType mPtr; + + // MakeRustCall stores the result of the call in these fields + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_started( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntoRust(std::move(mPtr)), + &callStatus + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragebridgedengineWipe : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntermediateType mPtr; + + // MakeRustCall stores the result of the call in these fields + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + uniffi_webext_storage_fn_method_webextstoragebridgedengine_wipe( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntoRust(std::move(mPtr)), + &callStatus + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnConstructorWebextstoragestoreNew : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingConverter::IntermediateType mPath; + + // MakeRustCall stores the result of the call in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::IntermediateType mUniffiReturnValue; + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingConverter::FromJs(aArgs[0], &mPath, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + mUniffiReturnValue = ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::FromRust( + uniffi_webext_storage_fn_constructor_webextstoragestore_new( + ScaffoldingConverter::IntoRust(std::move(mPath)), + &callStatus + ) + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::IntoJs( + aCx, + std::move(mUniffiReturnValue), + aDest, + aError + ); + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragestoreBridgedEngine : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::IntermediateType mPtr; + + // MakeRustCall stores the result of the call in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntermediateType mUniffiReturnValue; + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + mUniffiReturnValue = ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::FromRust( + uniffi_webext_storage_fn_method_webextstoragestore_bridged_engine( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::IntoRust(std::move(mPtr)), + &callStatus + ) + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageBridgedEnginePointerType>::IntoJs( + aCx, + std::move(mUniffiReturnValue), + aDest, + aError + ); + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragestoreClear : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::IntermediateType mPtr; + typename ScaffoldingConverter::IntermediateType mExtId; + + // MakeRustCall stores the result of the call in these fields + typename ScaffoldingConverter::IntermediateType mUniffiReturnValue; + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + ScaffoldingConverter::FromJs(aArgs[1], &mExtId, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + mUniffiReturnValue = ScaffoldingConverter::FromRust( + uniffi_webext_storage_fn_method_webextstoragestore_clear( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::IntoRust(std::move(mPtr)), + ScaffoldingConverter::IntoRust(std::move(mExtId)), + &callStatus + ) + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + ScaffoldingConverter::IntoJs( + aCx, + std::move(mUniffiReturnValue), + aDest, + aError + ); + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragestoreGet : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::IntermediateType mPtr; + typename ScaffoldingConverter::IntermediateType mExtId; + typename ScaffoldingConverter::IntermediateType mKeys; + + // MakeRustCall stores the result of the call in these fields + typename ScaffoldingConverter::IntermediateType mUniffiReturnValue; + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + ScaffoldingConverter::FromJs(aArgs[1], &mExtId, aError); + if (aError.Failed()) { + return; + } + ScaffoldingConverter::FromJs(aArgs[2], &mKeys, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + mUniffiReturnValue = ScaffoldingConverter::FromRust( + uniffi_webext_storage_fn_method_webextstoragestore_get( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::IntoRust(std::move(mPtr)), + ScaffoldingConverter::IntoRust(std::move(mExtId)), + ScaffoldingConverter::IntoRust(std::move(mKeys)), + &callStatus + ) + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + ScaffoldingConverter::IntoJs( + aCx, + std::move(mUniffiReturnValue), + aDest, + aError + ); + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragestoreGetBytesInUse : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::IntermediateType mPtr; + typename ScaffoldingConverter::IntermediateType mExtId; + typename ScaffoldingConverter::IntermediateType mKeys; + + // MakeRustCall stores the result of the call in these fields + typename ScaffoldingConverter::IntermediateType mUniffiReturnValue; + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + ScaffoldingConverter::FromJs(aArgs[1], &mExtId, aError); + if (aError.Failed()) { + return; + } + ScaffoldingConverter::FromJs(aArgs[2], &mKeys, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + mUniffiReturnValue = ScaffoldingConverter::FromRust( + uniffi_webext_storage_fn_method_webextstoragestore_get_bytes_in_use( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::IntoRust(std::move(mPtr)), + ScaffoldingConverter::IntoRust(std::move(mExtId)), + ScaffoldingConverter::IntoRust(std::move(mKeys)), + &callStatus + ) + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + ScaffoldingConverter::IntoJs( + aCx, + std::move(mUniffiReturnValue), + aDest, + aError + ); + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragestoreGetSyncedChanges : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::IntermediateType mPtr; + + // MakeRustCall stores the result of the call in these fields + typename ScaffoldingConverter::IntermediateType mUniffiReturnValue; + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + mUniffiReturnValue = ScaffoldingConverter::FromRust( + uniffi_webext_storage_fn_method_webextstoragestore_get_synced_changes( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::IntoRust(std::move(mPtr)), + &callStatus + ) + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + ScaffoldingConverter::IntoJs( + aCx, + std::move(mUniffiReturnValue), + aDest, + aError + ); + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragestoreRemove : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::IntermediateType mPtr; + typename ScaffoldingConverter::IntermediateType mExtId; + typename ScaffoldingConverter::IntermediateType mKeys; + + // MakeRustCall stores the result of the call in these fields + typename ScaffoldingConverter::IntermediateType mUniffiReturnValue; + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + ScaffoldingConverter::FromJs(aArgs[1], &mExtId, aError); + if (aError.Failed()) { + return; + } + ScaffoldingConverter::FromJs(aArgs[2], &mKeys, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + mUniffiReturnValue = ScaffoldingConverter::FromRust( + uniffi_webext_storage_fn_method_webextstoragestore_remove( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::IntoRust(std::move(mPtr)), + ScaffoldingConverter::IntoRust(std::move(mExtId)), + ScaffoldingConverter::IntoRust(std::move(mKeys)), + &callStatus + ) + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + ScaffoldingConverter::IntoJs( + aCx, + std::move(mUniffiReturnValue), + aDest, + aError + ); + } +}; +class ScaffoldingCallHandlerUniFFIUniffiWebextStorageFnMethodWebextstoragestoreSet : public UniffiHandlerBase { +private: + // PrepareRustArgs stores the resulting arguments in these fields + typename ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::IntermediateType mPtr; + typename ScaffoldingConverter::IntermediateType mExtId; + typename ScaffoldingConverter::IntermediateType mVal; + + // MakeRustCall stores the result of the call in these fields + typename ScaffoldingConverter::IntermediateType mUniffiReturnValue; + +public: + void PrepareRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::FromJs(aArgs[0], &mPtr, aError); + if (aError.Failed()) { + return; + } + ScaffoldingConverter::FromJs(aArgs[1], &mExtId, aError); + if (aError.Failed()) { + return; + } + ScaffoldingConverter::FromJs(aArgs[2], &mVal, aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall() override { + RustCallStatus callStatus{}; + mUniffiReturnValue = ScaffoldingConverter::FromRust( + uniffi_webext_storage_fn_method_webextstoragestore_set( + ScaffoldingObjectConverter<&kWebextstorageWebExtStorageStorePointerType>::IntoRust(std::move(mPtr)), + ScaffoldingConverter::IntoRust(std::move(mExtId)), + ScaffoldingConverter::IntoRust(std::move(mVal)), + &callStatus + ) + ); + + mUniffiCallStatusCode = callStatus.code; + if (callStatus.error_buf.data) { + mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf); + } + } + + virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + ScaffoldingConverter::IntoJs( + aCx, + std::move(mUniffiReturnValue), + aDest, + aError + ); + } +}; UniquePtr UniFFIGetHandler(uint64_t aId) { switch (aId) { @@ -2424,6 +3317,69 @@ UniquePtr UniFFIGetHandler(uint64_t aId) { case 58: { return MakeUnique(); } + case 60: { + return MakeUnique(); + } + case 61: { + return MakeUnique(); + } + case 62: { + return MakeUnique(); + } + case 63: { + return MakeUnique(); + } + case 64: { + return MakeUnique(); + } + case 65: { + return MakeUnique(); + } + case 66: { + return MakeUnique(); + } + case 67: { + return MakeUnique(); + } + case 68: { + return MakeUnique(); + } + case 69: { + return MakeUnique(); + } + case 70: { + return MakeUnique(); + } + case 71: { + return MakeUnique(); + } + case 72: { + return MakeUnique(); + } + case 74: { + return MakeUnique(); + } + case 75: { + return MakeUnique(); + } + case 76: { + return MakeUnique(); + } + case 77: { + return MakeUnique(); + } + case 78: { + return MakeUnique(); + } + case 79: { + return MakeUnique(); + } + case 80: { + return MakeUnique(); + } + case 81: { + return MakeUnique(); + } default: return nullptr; @@ -2461,6 +3417,14 @@ Maybe> UniFFIReadPointer(const GlobalObject& aGl type = &kTabsTabsStorePointerType; break; } + case 7: { // webextstorage:WebExtStorageBridgedEngine + type = &kWebextstorageWebExtStorageBridgedEnginePointerType; + break; + } + case 8: { // webextstorage:WebExtStorageStore + type = &kWebextstorageWebExtStorageStorePointerType; + break; + } default: return Nothing(); } @@ -2498,6 +3462,14 @@ bool UniFFIWritePointer(const GlobalObject& aGlobal, uint64_t aId, const UniFFIP type = &kTabsTabsStorePointerType; break; } + case 7: { // webextstorage:WebExtStorageBridgedEngine + type = &kWebextstorageWebExtStorageBridgedEnginePointerType; + break; + } + case 8: { // webextstorage:WebExtStorageStore + type = &kWebextstorageWebExtStorageStorePointerType; + break; + } default: return false; }