diff --git a/.cargo/config.toml.in b/.cargo/config.toml.in index 0c7d7bd252378..cd0942d2a4f4d 100644 --- a/.cargo/config.toml.in +++ b/.cargo/config.toml.in @@ -80,9 +80,9 @@ git = "https://github.com/martinthomson/ohttp.git" rev = "bf6a983845cc0b540effb3a615e92d914dfcfd0b" replace-with = "vendored-sources" -[source."git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2"] +[source."git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288"] git = "https://github.com/mozilla/application-services" -rev = "0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +rev = "009bf85091ebface00fcace0ef4470921a8b9288" replace-with = "vendored-sources" [source."git+https://github.com/mozilla/audioipc?rev=82fe7fa7e3aaa35468137239a0e4c2f867457214"] diff --git a/AdsClient.md b/AdsClient.md new file mode 100644 index 0000000000000..35d1fb37bdcaf --- /dev/null +++ b/AdsClient.md @@ -0,0 +1,145 @@ +# AdsClient in newtab + +## 1. Add ads-client crate to dependencies + +- See `docs/rust-components/developing-rust-components/uniffi.md` +- `./mach vendor run` to update the rust code +- `./mach uniffi generate` to generate the bindings +- Update `toolkit/components/uniffi-bindgen-gecko-js/config.toml` to add the new bindings wrappers: +```toml +[ads_client.async_wrappers] +MozAdsClient = "AsyncWrapped" +"MozAdsClient.new" = "Sync" +"MozAdsClient.clear_cache" = "Sync" +"MozAdsClient.cycle_context_id" = "Sync" +"MozAdsClient.record_click" = "AsyncWrapped" +"MozAdsClient.record_impression" = "AsyncWrapped" +"MozAdsClient.report_ad" = "AsyncWrapped" +"MozAdsClient.request_image_ads" = "AsyncWrapped" +"MozAdsClient.request_spoc_ads" = "AsyncWrapped" +"MozAdsClient.request_tile_ads" = "AsyncWrapped" +"MozAdsTelemetry.record_build_cache_error" = "Sync" +"MozAdsTelemetry.record_client_error" = "Sync" +"MozAdsTelemetry.record_client_operation_total" = "Sync" +"MozAdsTelemetry.record_deserialization_error" = "Sync" +"MozAdsTelemetry.record_http_cache_outcome" = "Sync" +``` +- `./mach build` to build the rust code +- `./mach run` to run the newtab + +## 2. Create the AdsClient singleton + +Import the types from the generated bindings: +```js +import { MozAdsClient, MozAdsClientConfig, MozAdsCacheConfig, MozAdsEnvironment, MozAdsTelemetry } from "moz-src:///toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustAdsClient.sys.mjs"; +``` + +Create the AdsClient singleton: +```js +const AdsClient = MozAdsClient.init(new MozAdsClientConfig({ + cacheConfig: new MozAdsCacheConfig({ + dbPath: "ads_cache.db", + }), + environment: MozAdsEnvironment.PROD, + telemetry: new LoggerTelemetry(), +})); +``` + +Example how to create a Telemetry implementation, this should use Glean in production. +> BUG: https://mozilla.slack.com/archives/C0559DDDPQF/p1767895618186219 +```js +class LoggerTelemetry extends MozAdsTelemetry { + recordBuildCacheError(label, value) { + console.error("AdsClient - recordBuildCacheError", label, value); + } + recordClientError(label, value) { + console.error("AdsClient - recordClientError", label, value); + } + recordClientOperationTotal(label, value) { + console.error("AdsClient - recordClientOperationTotal", label, value); + } + recordDeserializationError(label, value) { + console.error("AdsClient - recordDeserializationError", label, value); + } + recordHttpCacheOutcome(label, value) { + console.error("AdsClient - recordHttpCacheOutcome", label, value); + } +} +``` + +## 3. Fetch ads using the AdsClient in the newtab + +We can safely replace the existing `responseData`: +```js +if(USE_ADS_CLIENT) { + responseData = await this.fetchWithAdsClient(placements); +} +``` + +With AdsClient, we need to differentiate separate calls between tiles, images and stories. + +Here is an example of a `fetchWithAdsClient` implementation filtering on the placementId: +```js +async fetchWithAdsClient(placements) { + console.error("AdsClient - fetchWithAdsClient calling with", placements); + const formattedResponse = {}; + try { + const tilesRequests = placements.filter( + p => (p.placementId || p.placement)?.startsWith("newtab_tile_") + ).map(p => new MozAdsPlacementRequest({ + placementId: p.placementId || p.placement, + iabContent: p.iabContent ?? null, + })); + if (tilesRequests.length) { + console.error("AdsClient - requestTileAds calling with", tilesRequests); + const tiles = await AdsClient.requestTileAds(tilesRequests, null); + console.error("AdsClient - requestTileAds SUCCESS - tiles:", tiles); + + for (const [placementId, tile] of tiles) { + tile.name = `${VERSION}: ${tile.name}`; + formattedResponse[placementId] = [tile]; + } + } + + const storiesRequests = placements.filter( + p => (p.placementId || p.placement)?.startsWith("newtab_stories_") + ).map(p => new MozAdsPlacementRequestWithCount({ + placementId: p.placementId || p.placement, + iabContent: p.iabContent ?? null, + count: p.count, + })); + if (storiesRequests.length) { + console.error("AdsClient - requestSpocAds calling with", storiesRequests); + const spocs = await AdsClient.requestSpocAds(storiesRequests, null); + console.error("AdsClient - requestSpocAds SUCCESS - spocs:", spocs); + + for (const [placementId, spoc] of spocs) { + spoc[0].name = `${VERSION}: ${spoc[0].name}`; + formattedResponse[placementId] = spoc; + } + } + } catch (error) { + console.error("AdsClient - requestTileAds ERROR:", error); + } + console.error("AdsClient - formattedResponse:", formattedResponse); + return formattedResponse; +} +``` + +# 4. Cache the ads using the AdsClient + +In AdsClient, we already have a persistent cache mechanism using a SQLite database. +This might conflict with the existing cache mechanism in the newtab `this.cache = this.PersistentCache(CACHE_KEY, true)`. +We could deactivate the existing cache by setting `this.cache = null` when using AdsClient or eventually remove it. + +# 5. Recording clicks and impressions using the AdsClient + +I did not go into the details of recording clicks and impressions using the AdsClient. +This should be straightforward to implement, just pass the click and impression URLs to the AdsClient. + +```js +await AdsClient.recordClick(clickUrl); +await AdsClient.recordImpression(impressionUrl); +``` + +> WARNING: We manually add context to the URL using a query parameter `request_hash`. You NEED to pass an URL generated by the AdsClient itself to these methods. \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index f71752a3ba5ed..a7d78b177dc89 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "aa-stroke" @@ -32,6 +32,27 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" +[[package]] +name = "ads-client" +version = "0.1.0" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" +dependencies = [ + "chrono", + "context_id", + "error-support", + "once_cell", + "parking_lot", + "rusqlite 0.37.0", + "serde", + "serde_json", + "sql-support", + "thiserror 2.0.12", + "uniffi", + "url", + "uuid", + "viaduct", +] + [[package]] name = "aho-corasick" version = "1.1.0" @@ -980,7 +1001,7 @@ dependencies = [ [[package]] name = "context_id" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "chrono", "error-support", @@ -1922,7 +1943,7 @@ dependencies = [ [[package]] name = "error-support" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "env_logger", "error-support-macros", @@ -1937,7 +1958,7 @@ dependencies = [ [[package]] name = "error-support-macros" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "proc-macro2", "quote", @@ -2032,7 +2053,7 @@ dependencies = [ [[package]] name = "filter_adult" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "base64 0.22.1", "error-support", @@ -2068,7 +2089,7 @@ dependencies = [ [[package]] name = "firefox-versioning" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "serde_json", "thiserror 2.0.12", @@ -2696,6 +2717,7 @@ dependencies = [ name = "gkrust-uniffi-components" version = "0.1.0" dependencies = [ + "ads-client", "context_id", "error-support", "filter_adult", @@ -3451,7 +3473,7 @@ dependencies = [ [[package]] name = "init_rust_components" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "nss", "uniffi", @@ -3460,7 +3482,7 @@ dependencies = [ [[package]] name = "interrupt-support" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "lazy_static", "parking_lot", @@ -3634,7 +3656,7 @@ dependencies = [ [[package]] name = "jwcrypto" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "base64 0.21.999", "error-support", @@ -3966,7 +3988,7 @@ checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" [[package]] name = "logins" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "anyhow", "async-trait", @@ -5026,7 +5048,7 @@ dependencies = [ [[package]] name = "nss" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "base64 0.21.999", "error-support", @@ -5055,12 +5077,12 @@ dependencies = [ [[package]] name = "nss_build_common" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" [[package]] name = "nss_sys" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "libsqlite3-sys", "nss_build_common", @@ -5348,7 +5370,7 @@ checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" [[package]] name = "payload-support" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "serde", "serde_derive", @@ -5871,7 +5893,7 @@ dependencies = [ [[package]] name = "rc_crypto" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "base64 0.21.999", "error-support", @@ -5941,7 +5963,7 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "relevancy" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "anyhow", "base64 0.21.999", @@ -5965,7 +5987,7 @@ dependencies = [ [[package]] name = "remote_settings" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "anyhow", "camino", @@ -6236,7 +6258,7 @@ dependencies = [ [[package]] name = "search" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "error-support", "firefox-versioning", @@ -6561,7 +6583,7 @@ dependencies = [ [[package]] name = "sql-support" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "error-support", "interrupt-support", @@ -6750,7 +6772,7 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "suggest" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "anyhow", "chrono", @@ -6803,7 +6825,7 @@ dependencies = [ [[package]] name = "sync-guid" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "base64 0.21.999", "rand", @@ -6814,7 +6836,7 @@ dependencies = [ [[package]] name = "sync15" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "anyhow", "base16", @@ -6858,7 +6880,7 @@ dependencies = [ [[package]] name = "tabs" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "anyhow", "error-support", @@ -7207,7 +7229,7 @@ dependencies = [ [[package]] name = "tracing-support" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "parking_lot", "serde_json", @@ -7279,7 +7301,7 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "types" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "rusqlite 0.37.0", "serde", @@ -7660,7 +7682,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "viaduct" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "async-trait", "error-support", @@ -7835,7 +7857,7 @@ dependencies = [ [[package]] name = "webext-storage" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2#0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" +source = "git+https://github.com/mozilla/application-services?rev=009bf85091ebface00fcace0ef4470921a8b9288#009bf85091ebface00fcace0ef4470921a8b9288" dependencies = [ "anyhow", "error-support", diff --git a/Cargo.toml b/Cargo.toml index cafbc9f07a018..42706c6eb9cc2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -273,21 +273,22 @@ ohttp = { git = "https://github.com/martinthomson/ohttp.git", rev = "bf6a983845c bhttp = { git = "https://github.com/martinthomson/ohttp.git", rev = "bf6a983845cc0b540effb3a615e92d914dfcfd0b" } # application-services overrides to make updating them all simpler. -context_id = { git = "https://github.com/mozilla/application-services", rev = "0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" } -error-support = { git = "https://github.com/mozilla/application-services", rev = "0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" } -filter_adult = { git = "https://github.com/mozilla/application-services", rev = "0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" } -interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" } -relevancy = { git = "https://github.com/mozilla/application-services", rev = "0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" } -search = { git = "https://github.com/mozilla/application-services", rev = "0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" } -sql-support = { git = "https://github.com/mozilla/application-services", rev = "0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" } -suggest = { git = "https://github.com/mozilla/application-services", rev = "0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" } -sync15 = { git = "https://github.com/mozilla/application-services", rev = "0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" } -tabs = { git = "https://github.com/mozilla/application-services", rev = "0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" } -tracing-support = { git = "https://github.com/mozilla/application-services", rev = "0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" } -viaduct = { git = "https://github.com/mozilla/application-services", rev = "0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" } -webext-storage = { git = "https://github.com/mozilla/application-services", rev = "0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" } -logins = { git = "https://github.com/mozilla/application-services", rev = "0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" } -init_rust_components = { git = "https://github.com/mozilla/application-services", rev = "0376c542e4a31cde8d33dd0e8da17dcfbc6c58b2" } +ads-client = { git = "https://github.com/mozilla/application-services", rev = "009bf85091ebface00fcace0ef4470921a8b9288" } +context_id = { git = "https://github.com/mozilla/application-services", rev = "009bf85091ebface00fcace0ef4470921a8b9288" } +error-support = { git = "https://github.com/mozilla/application-services", rev = "009bf85091ebface00fcace0ef4470921a8b9288" } +filter_adult = { git = "https://github.com/mozilla/application-services", rev = "009bf85091ebface00fcace0ef4470921a8b9288" } +interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "009bf85091ebface00fcace0ef4470921a8b9288" } +relevancy = { git = "https://github.com/mozilla/application-services", rev = "009bf85091ebface00fcace0ef4470921a8b9288" } +search = { git = "https://github.com/mozilla/application-services", rev = "009bf85091ebface00fcace0ef4470921a8b9288" } +sql-support = { git = "https://github.com/mozilla/application-services", rev = "009bf85091ebface00fcace0ef4470921a8b9288" } +suggest = { git = "https://github.com/mozilla/application-services", rev = "009bf85091ebface00fcace0ef4470921a8b9288" } +sync15 = { git = "https://github.com/mozilla/application-services", rev = "009bf85091ebface00fcace0ef4470921a8b9288" } +tabs = { git = "https://github.com/mozilla/application-services", rev = "009bf85091ebface00fcace0ef4470921a8b9288" } +tracing-support = { git = "https://github.com/mozilla/application-services", rev = "009bf85091ebface00fcace0ef4470921a8b9288" } +viaduct = { git = "https://github.com/mozilla/application-services", rev = "009bf85091ebface00fcace0ef4470921a8b9288" } +webext-storage = { git = "https://github.com/mozilla/application-services", rev = "009bf85091ebface00fcace0ef4470921a8b9288" } +logins = { git = "https://github.com/mozilla/application-services", rev = "009bf85091ebface00fcace0ef4470921a8b9288" } +init_rust_components = { git = "https://github.com/mozilla/application-services", rev = "009bf85091ebface00fcace0ef4470921a8b9288" } # Patched version of zip 2.4.2 to allow for reading omnijars. zip = { path = "third_party/rust/zip" } diff --git a/ads_cache.db b/ads_cache.db new file mode 100644 index 0000000000000..761e0d4714ee0 Binary files /dev/null and b/ads_cache.db differ diff --git a/ads_cache.db-shm b/ads_cache.db-shm new file mode 100644 index 0000000000000..92c71c5f616a8 Binary files /dev/null and b/ads_cache.db-shm differ diff --git a/ads_cache.db-wal b/ads_cache.db-wal new file mode 100644 index 0000000000000..527adff1d60c5 Binary files /dev/null and b/ads_cache.db-wal differ diff --git a/browser/extensions/newtab/lib/AdsFeed.sys.mjs b/browser/extensions/newtab/lib/AdsFeed.sys.mjs index ca56e24e0cd84..4b1b560056557 100644 --- a/browser/extensions/newtab/lib/AdsFeed.sys.mjs +++ b/browser/extensions/newtab/lib/AdsFeed.sys.mjs @@ -1,6 +1,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * 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/. */ +const VERSION = "7"; const lazy = { Utils: "resource://services-settings/Utils.sys.mjs", @@ -46,7 +47,50 @@ const PREF_SHOW_SPONSORED = "showSponsored"; const PREF_SYSTEM_SHOW_SPONSORED = "system.showSponsored"; const CACHE_KEY = "ads_feed"; -const ADS_UPDATE_TIME = 30 * 60 * 1000; // 30 minutes +const ADS_UPDATE_TIME = 1; // 30 minutes +const USE_ADS_CLIENT = true; + +import { + MozAdsClient, + MozAdsClientConfig, + MozAdsEnvironment, + MozAdsPlacementRequest, + MozAdsPlacementRequestWithCount, + MozAdsCacheConfig, + MozAdsTelemetryImpl, +} from "moz-src:///toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustAdsClient.sys.mjs" + +class LoggerTelemetry extends MozAdsTelemetryImpl { + constructor(opts) { + console.error("LoggerTelemetry - simple constructor"); + super(opts); + } + recordBuildCacheError(label, value) { + console.error("AdsClient - recordBuildCacheError", label, value); + } + recordClientError(label, value) { + console.error("AdsClient - recordClientError", label, value); + } + recordClientOperationTotal(label, value) { + console.error("AdsClient - recordClientOperationTotal", label, value); + } + recordDeserializationError(label, value) { + console.error("AdsClient - recordDeserializationError", label, value); + } + recordHttpCacheOutcome(label, value) { + console.error("AdsClient - recordHttpCacheOutcome", label, value); + } +} + +const telemetry = new LoggerTelemetry(); + +const AdsClient = MozAdsClient.init(new MozAdsClientConfig({ + cacheConfig: new MozAdsCacheConfig({ + dbPath: "ads_cache.db", + }), + environment: MozAdsEnvironment.PROD, + telemetry, +})); export class AdsFeed { constructor() { @@ -363,6 +407,9 @@ export class AdsFeed { signal, }; + if(USE_ADS_CLIENT) { + responseData = await this.fetchWithAdsClient(placements); + } else { // Make Oblivious Fetch Request if (marsOhttpEnabled && ohttpConfigURL && ohttpRelayURL) { const config = await lazy.ObliviousHTTP.getOHTTPConfig(ohttpConfigURL); @@ -388,11 +435,13 @@ export class AdsFeed { if (response && response.status === 200) { responseData = await response.json(); + console.error("AdsClient - responseData", responseData); } else { throw new Error( `Error fetching data: ${response.status} - ${response.statusText}` ); } + } if (supportedAdTypes.tiles) { const filteredRespDataTiles = Object.keys(responseData) @@ -420,6 +469,50 @@ export class AdsFeed { return returnData; } + async fetchWithAdsClient(placements) { + console.error("AdsClient - fetchWithAdsClient calling with", placements); + const formattedResponse = {}; + try { + const tilesRequests = placements.filter( + p => (p.placementId || p.placement)?.startsWith("newtab_tile_") + ).map(p => new MozAdsPlacementRequest({ + placementId: p.placementId || p.placement, + iabContent: p.iabContent ?? null, + })); + if (tilesRequests.length) { + console.error("AdsClient - requestTileAds calling with", tilesRequests); + const tiles = await AdsClient.requestTileAds(tilesRequests, null); + console.error("AdsClient - requestTileAds SUCCESS - tiles:", tiles); + + for (const [placementId, tile] of tiles) { + tile.name = `${VERSION}: ${tile.name}`; + formattedResponse[placementId] = [tile]; + } + } + + const storiesRequests = placements.filter( + p => (p.placementId || p.placement)?.startsWith("newtab_stories_") + ).map(p => new MozAdsPlacementRequestWithCount({ + placementId: p.placementId || p.placement, + iabContent: p.iabContent ?? null, + count: p.count, + })); + if (storiesRequests.length) { + console.error("AdsClient - requestSpocAds calling with", storiesRequests); + const spocs = await AdsClient.requestSpocAds(storiesRequests, null); + console.error("AdsClient - requestSpocAds SUCCESS - spocs:", spocs); + + for (const [placementId, spoc] of spocs) { + spoc[0].name = `${VERSION}: ${spoc[0].name}`; + formattedResponse[placementId] = spoc; + } + } + } catch (error) { + console.error("AdsClient - requestTileAds ERROR:", error); + } + console.error("AdsClient - formattedResponse:", formattedResponse); + return formattedResponse; + } /** * Init function that runs only from onAction at.INIT call. * diff --git a/docs/rust-components/api/js/ads_client.md b/docs/rust-components/api/js/ads_client.md new file mode 100644 index 0000000000000..b30a0b5f52f62 --- /dev/null +++ b/docs/rust-components/api/js/ads_client.md @@ -0,0 +1,5 @@ +# RustAdsClient.sys.mjs +```{js:autoclass} RustAdsClient.sys.Other + :members: + :exclude-members: Other +``` diff --git a/third_party/rust/ads-client/.cargo-checksum.json b/third_party/rust/ads-client/.cargo-checksum.json new file mode 100644 index 0000000000000..a1b3f397a0d49 --- /dev/null +++ b/third_party/rust/ads-client/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"ARCHITECTURE.md":"514f53d499ad92e82fac0b72b1e4cb5e6b4bcbbc449ed37f378872ff1d7f525b","Cargo.toml":"8053bfbff8c79f90cb74d533d8abd89cb944c3192dabb2aaac2a5cacb041f8b4","README.md":"5f673cdf7bff923c3a3932306ad34dddb363dd849b37a81133fc202d7c8ac127","android/build.gradle":"a194a6162cc80264d59fd0758d5b262ef808a4d8095093f99e6beabb2971befd","android/proguard-rules.pro":"4a5a73944e7a54670597f34d1abe8d063733ae43320ecb40afbf9ccf3fac5769","android/src/main/AndroidManifest.xml":"0a05039a6124be0296764c2b0f41e863b5538d75e6164dd9ae945b59d983c318","docs/usage.md":"b16a709a120e09fe04977014695c95fe37e0d2fa00b6cc57722571a7dadc9f12","metrics.yaml":"b38216552403d783ae679af1fceb1aab9542dd9d2e4dc8725255aac1eb4f1db5","src/client.rs":"2350a5fcd030c22ad856e2354b1843340448a8af1029db074813f9c3ff0d59e4","src/client/ad_request.rs":"3a5e65db67b3ae0966eeeefe8e06442e63ad35b63d7a2888bf2578fbf3bad812","src/client/ad_response.rs":"4278a9e17407ca6b7a31e1238c658eac32fcf23898ff832e4e00e895beffae4e","src/client/config.rs":"95b8e6dac925b084d4a9a74a383d4dd8883e44a3a804235736f66582da806857","src/error.rs":"022238c58d6dca8450f7d77c8ddab3b6f7cb5c2c771d17f5c3911ed0ce77a6aa","src/ffi.rs":"5853906b0b733b6c86af2411dcc139cd9ba43b5f3cf06fb0db07adfa93830743","src/ffi/telemetry.rs":"71a2d2ad0f4b1bffdf8f031d0d35acb5c441503531767de396320d52f41fd644","src/http_cache.rs":"fb1449c65df9be1705296e4b56a8e8a19b7fe1d0309270d32c79003e92a50496","src/http_cache/builder.rs":"5c8eaaeb81f166467e38b50bddcb6116d5752e0e2c230f2ae37d3ab444361fec","src/http_cache/bytesize.rs":"547e455627f440a8aee58097416fced58f11c23fb2c5ad490ffff4261410ec8d","src/http_cache/cache_control.rs":"296f6bc6f93bb1da973d958e669977317a2b6649e786fe422dd9a0ee1b95621e","src/http_cache/clock.rs":"017b8577c5a9cb95021e45f97842db2e904ae921c345fe9a24a9656b06bf9543","src/http_cache/connection_initializer.rs":"8c3b0dcc4eaba62dae372974742a4e2a55cc3c9b3aa4b65656ee731e86242144","src/http_cache/request_hash.rs":"d26d28c71b7d3b4bb868b106e179468f4bbfdc774a1e1e16550483df1fdf9c62","src/http_cache/store.rs":"bd1a777e76e979bb868c9837cb358717fa75185057f4db9eb1f5391ead2843e8","src/lib.rs":"7a7a97658d3b0506e0a25547e30804b2782d1b6067da3796cc082a1a05b0e7a6","src/mars.rs":"7c5eb96d518e277bffc441518e9c43c3b2028e2c3ea46f2f83231b8e96b0a095","src/telemetry.rs":"b5775f11d605989f4bd4bcb073620ecc77a4fef351526fb0eee990fa97e23bdd","src/test_utils.rs":"ba0880bde4af31431b120bba1afcf03fe3b0f6387bdfd4ac187cc69d8f0427af","tests/integration_test.rs":"327a420b9509af495e0714c741351c59bb59000b6ec528b3dbc5f5182227641d","uniffi.toml":"e2569a13b648b28a68399a8790c05a6c4aaeee9e5d74e5f2d125f7b19cba866c"},"package":null} \ No newline at end of file diff --git a/third_party/rust/ads-client/ARCHITECTURE.md b/third_party/rust/ads-client/ARCHITECTURE.md new file mode 100644 index 0000000000000..ac64eb99b2bbe --- /dev/null +++ b/third_party/rust/ads-client/ARCHITECTURE.md @@ -0,0 +1,89 @@ +# Architecture + +## Type Separation: FFI Types vs Business Logic Types + +This component uses a clear separation between **FFI (Foreign Function Interface) types** and **business logic types**. This architectural decision provides several important benefits for maintainability, API stability, and development velocity. + +### Overview + +- **FFI Types** (`MozAds*` prefix, defined in `src/ffi.rs`): Types exposed through UniFFI to external consumers (e.g., Kotlin, Swift, Python bindings) +- **Business Logic Types** (no prefix, defined in `src/client/`): Internal types used for core functionality, serialization, and business logic + +### Key Benefits + +#### 1. Clear Public API Identification + +All types prefixed with `MozAds` (e.g., `MozAdsClient`, `MozAd`, `MozAdsClientConfig`) represent the **public API contract**. This makes it immediately obvious: + +- What types external consumers depend on +- What changes require coordination with consumers +- What documentation needs to be kept up-to-date + +#### 2. Breaking Change Detection + +When modifying types: + +- Changes to `MozAds*` types in `ffi.rs` = **potential breaking change** for external consumers +- Changes to business logic types in `client/` = **internal refactoring** (non-breaking) + +This clear boundary helps developers: + +- Understand the impact of their changes before making them +- Follow proper deprecation processes for public API changes +- Make internal improvements without affecting external consumers + +#### 3. Versioned Public API + +The separation enables future API versioning strategies: + +- Maintain multiple versions of `MozAds*` types (e.g., `MozAdV1`, `MozAdV2`) +- Evolve the public API independently from internal implementation +- Provide migration paths between API versions + +### Implementation Pattern + +The conversion between FFI and business logic types is handled through `From`/`Into` trait implementations in `ffi.rs`: + +```rust +// FFI type (public API) +pub struct MozAd { ... } + +// Business logic type (internal) +pub struct Ad { ... } + +// Conversion implementations +impl From for MozAd { ... } +impl From for Ad { ... } +``` + +The public API in `lib.rs` uses `MozAds*` types at the boundary and converts to/from business logic types internally: + +```rust +pub fn request_ads( + moz_ad_requests: Vec, // FFI type + options: Option, +) -> AdsClientApiResult> { + // Convert to business logic types + let requests: Vec = moz_ad_requests.iter().map(|r| r.into()).collect(); + + // Use business logic types internally + let placements = inner.request_ads(requests, ...)?; + + // Convert back to FFI types + placements.into_iter().map(|(k, v)| (k, v.into())).collect() +} +``` + +### File Organization + +- `src/ffi.rs`: All UniFFI-exposed types (`MozAds*`), error types, and conversions +- `src/lib.rs`: Public API entry point, handles FFI ↔ business logic conversions +- `src/client/`: Business logic types and implementation +- `src/error.rs`: Internal error types (FFI errors are in `ffi.rs`) + +### Guidelines for Developers + +1. **Adding new public API**: Create `MozAds*` types in `ffi.rs` with corresponding business logic types +2. **Modifying public API**: Consider breaking change implications and deprecation strategy +3. **Internal refactoring**: Feel free to modify business logic types, ensuring conversions remain correct +4. **Removing unused code**: Check both FFI and business logic types for unused conversions diff --git a/third_party/rust/ads-client/Cargo.toml b/third_party/rust/ads-client/Cargo.toml new file mode 100644 index 0000000000000..b767b2f36ac60 --- /dev/null +++ b/third_party/rust/ads-client/Cargo.toml @@ -0,0 +1,89 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies. +# +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. + +[package] +edition = "2021" +name = "ads-client" +version = "0.1.0" +build = false +autolib = false +autobins = false +autoexamples = false +autotests = false +autobenches = false +readme = "README.md" +license = "MPL-2.0" + +[features] +default = [] +dev = [] + +[lib] +name = "ads_client" +path = "src/lib.rs" + +[[test]] +name = "integration_test" +path = "tests/integration_test.rs" + +[dependencies] +chrono = "0.4" +once_cell = "1.5" +parking_lot = "0.12" +serde = "1" +serde_json = "1" +thiserror = "2" + +[dependencies.context_id] +path = "../context_id" + +[dependencies.error-support] +path = "../support/error" + +[dependencies.rusqlite] +version = "0.37.0" +features = [ + "functions", + "bundled", + "serde_json", + "unlock_notify", +] + +[dependencies.sql-support] +path = "../support/sql" + +[dependencies.uniffi] +version = "0.29.0" + +[dependencies.url] +version = "2" +features = ["serde"] + +[dependencies.uuid] +version = "1.3" +features = ["v4"] + +[dependencies.viaduct] +path = "../viaduct" + +[dev-dependencies] +mockall = "0.12" + +[dev-dependencies.mockito] +version = "0.31" +default-features = false + +[dev-dependencies.viaduct-dev] +path = "../support/viaduct-dev" + +[build-dependencies.uniffi] +version = "0.29.0" +features = ["build"] diff --git a/third_party/rust/ads-client/README.md b/third_party/rust/ads-client/README.md new file mode 100644 index 0000000000000..e6473eb7ef8e8 --- /dev/null +++ b/third_party/rust/ads-client/README.md @@ -0,0 +1,45 @@ +# Ads Client + +## Overview + +Mozilla Ads Client (also referred to as "MAC") is a library that handles integration with the Mozilla Ads Routing Service (MARS). It is primarily intended for use on mobile surfaces, namely Firefox iOS and Android, but can be used by any surface able to ingest components from Application Services. + +The Ads Client component can request and display standard ad placements, and calls the appropriate callback URLs to send anonymized impressions and clicks back to Mozilla. MAC also provides a facility to report user dissatisfaction with ads so we can take appropriate action as necessary. + +Like MARS, Ads Client is privacy-first. It does not track user information and it does not send sensitive identifiable information to Mozilla. Of the information Mozilla does receive, anything shared with advertisers is aggregated and/or de-identified to preserve user privacy. + +While we welcome outside feedback and are committed to open source, this library is intended solely for use on Mozilla properties. + +This component is currently still under construction. + +## Tests + +### Unit Tests + +Unit tests are run with + +```shell +cargo test -p ads-client +``` + +### Integration Tests + +Integration tests make real HTTP calls to the Mozilla Ads Routing Service (MARS) and are not run automatically in CI. They are marked with `#[ignore]` and must be run manually. + +To run integration tests: + +```shell +cargo test -p ads-client --test integration_test -- --ignored +``` + +To run a specific integration test: + +```shell +cargo test -p ads-client --test integration_test -- --ignored test_mock_pocket_billboard_1_placement +``` + +**Note:** Integration tests require network access and will make real HTTP requests to the MARS API. + +## Usage + +Please refer to `./docs/usage.md` for information on using the component. diff --git a/third_party/rust/ads-client/android/build.gradle b/third_party/rust/ads-client/android/build.gradle new file mode 100644 index 0000000000000..8974a9c8687c7 --- /dev/null +++ b/third_party/rust/ads-client/android/build.gradle @@ -0,0 +1,50 @@ +buildscript { + if (gradle.hasProperty("mozconfig")) { + repositories { + gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORIES.each { repository -> + maven { + url = repository + if (gradle.mozconfig.substs.ALLOW_INSECURE_GRADLE_REPOSITORIES) { + allowInsecureProtocol = true + } + } + } + } + + dependencies { + classpath libs.mozilla.glean.gradle.plugin + } + } +} + +plugins { + alias libs.plugins.python.envs.plugin +} + +apply from: "$appServicesRootDir/build-scripts/component-common.gradle" +apply from: "$appServicesRootDir/publish.gradle" + +ext { + gleanNamespace = "mozilla.telemetry.glean" + gleanYamlFiles = ["${project.projectDir}/../metrics.yaml"] + if (gradle.hasProperty("mozconfig")) { + gleanPythonEnvDir = gradle.mozconfig.substs.GRADLE_GLEAN_PARSER_VENV + } +} +apply plugin: "org.mozilla.telemetry.glean-gradle-plugin" + +android { + namespace 'org.mozilla.appservices.ads_client' +} + +dependencies { + api project(":httpconfig") + + implementation libs.mozilla.glean + + testImplementation libs.mozilla.glean.forUnitTests +} + +ext.configureUniFFIBindgen("ads_client") +ext.dependsOnTheMegazord() +ext.configurePublish() diff --git a/third_party/rust/ads-client/android/proguard-rules.pro b/third_party/rust/ads-client/android/proguard-rules.pro new file mode 100644 index 0000000000000..cf504086aa2bc --- /dev/null +++ b/third_party/rust/ads-client/android/proguard-rules.pro @@ -0,0 +1,22 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile + diff --git a/third_party/rust/ads-client/android/src/main/AndroidManifest.xml b/third_party/rust/ads-client/android/src/main/AndroidManifest.xml new file mode 100644 index 0000000000000..c6af8abcbb562 --- /dev/null +++ b/third_party/rust/ads-client/android/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + diff --git a/third_party/rust/ads-client/docs/usage.md b/third_party/rust/ads-client/docs/usage.md new file mode 100644 index 0000000000000..cfd34c3a08345 --- /dev/null +++ b/third_party/rust/ads-client/docs/usage.md @@ -0,0 +1,551 @@ +# Mozilla Ads Client (MAC) — UniFFI API Reference + +## Overview + +This document lists the Rust types and functions exposed via UniFFI by the `ads_client` component. +It only includes items that are part of the UniFFI surface. This document is aimed at users of the ads-client who want to know what is available to them. + +--- + +## `MozAdsClient` + +Top-level client object for requesting ads and recording lifecycle events. + +```rust +pub struct MozAdsClient { + ... // No public fields +} +``` + +#### Constructors + +```rust +impl MozAdsClient { + pub fn new(client_config: Option) -> Self +} +``` + +Creates a new ads client with an optional configuration object. +If a cache configuration is provided, the client will initialize an on-disk HTTP cache at the given path. + +#### Methods + +| Method | Return Type | Description | +| ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `clear_cache(&self)` | `AdsClientApiResult<()>` | Clears the client's HTTP cache. Returns an error if clearing fails. | +| `cycle_context_id(&self)` | `AdsClientApiResult` | Rotates the client's context ID and returns the **previous** ID. | +| `record_click(&self, click_url: String)` | `AdsClientApiResult<()>` | Records a click using the provided callback URL (typically from `ad.callbacks.click`). | +| `record_impression(&self, impression_url: String)` | `AdsClientApiResult<()>` | Records an impression using the provided callback URL (typically from `ad.callbacks.impression`). | +| `report_ad(&self, report_url: String)` | `AdsClientApiResult<()>` | Reports an ad using the provided callback URL (typically from `ad.callbacks.report`). | +| `request_image_ads(&self, moz_ad_requests: Vec, options: Option)` | `AdsClientApiResult>` | Requests one image ad per placement. Optional `MozAdsRequestOptions` can adjust caching behavior. Returns a map keyed by `placement_id`. | +| `request_spoc_ads(&self, moz_ad_requests: Vec, options: Option)` | `AdsClientApiResult>>` | Requests spoc ads per placement. Each placement request specifies its own count. Optional `MozAdsRequestOptions` can adjust caching behavior. Returns a map keyed by `placement_id`. | +| `request_tile_ads(&self, moz_ad_requests: Vec, options: Option)` | `AdsClientApiResult>` | Requests one tile ad per placement. Optional `MozAdsRequestOptions` can adjust caching behavior. Returns a map keyed by `placement_id`. | + +> **Notes** +> +> - We recommend that this client be initialized as a singleton or something similar so that multiple instances of the client do not exist at once. +> - Responses omit placements with no fill. Empty placements do not appear in the returned maps. +> - The HTTP cache is internally managed. Configuration can be set with `MozAdsClientConfig`. Per-request cache settings can be set with `MozAdsRequestOptions`. +> - If `cache_config` is `None`, caching is disabled entirely. + +--- + +## `MozAdsClientConfig` + +Configuration for initializing the ads client. + +```rust +pub struct MozAdsClientConfig { + pub environment: Environment, + pub cache_config: Option, + pub telemetry: Option>, +} +``` + +| Field | Type | Description | +| -------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------ | +| `environment` | `Environment` | Selects which MARS environment to connect to. Unless in a dev build, this value can only ever be Prod. | +| `cache_config` | `Option` | Optional configuration for the internal cache. | +| `telemetry` | `Option>` | Optional telemetry instance for recording metrics. If not provided, a no-op implementation is used. | + +--- + +## `MozAdsTelemetry` + +Telemetry interface for recording ads client metrics. You must provide an implementation of this interface to the `MozAdsClientConfig` constructor to enable telemetry collection. If no telemetry instance is provided, a no-op implementation is used and no metrics will be recorded. + +```rust +pub trait MozAdsTelemetry: Send + Sync { + fn record_build_cache_error(&self, label: String, value: String); + fn record_client_error(&self, label: String, value: String); + fn record_client_operation_total(&self, label: String); + fn record_deserialization_error(&self, label: String, value: String); + fn record_http_cache_outcome(&self, label: String, value: String); +} +``` + +### Implementing Telemetry + +To enable telemetry collection, you need to implement the `MozAdsTelemetry` interface and provide an instance to the `MozAdsClientConfig` constructor. The following examples show how to bind Glean metrics to the telemetry interface. + +#### Swift Example + +```swift +import MozillaRustComponents +import Glean + +public final class AdsClientTelemetry: MozAdsTelemetry { + public func recordBuildCacheError(label: String, value: String) { + AdsClientMetrics.buildCacheError[label].set(value) + } + + public func recordClientError(label: String, value: String) { + AdsClientMetrics.clientError[label].set(value) + } + + public func recordClientOperationTotal(label: String) { + AdsClientMetrics.clientOperationTotal[label].add() + } + + public func recordDeserializationError(label: String, value: String) { + AdsClientMetrics.deserializationError[label].set(value) + } + + public func recordHttpCacheOutcome(label: String, value: String) { + AdsClientMetrics.httpCacheOutcome[label].set(value) + } +} +``` + +#### Kotlin Example + +```kotlin +import mozilla.appservices.adsclient.MozAdsTelemetry +import org.mozilla.appservices.ads_client.GleanMetrics.AdsClient + +class AdsClientTelemetry : MozAdsTelemetry { + override fun recordBuildCacheError(label: String, value: String) { + AdsClient.buildCacheError[label].set(value) + } + + override fun recordClientError(label: String, value: String) { + AdsClient.clientError[label].set(value) + } + + override fun recordClientOperationTotal(label: String) { + AdsClient.clientOperationTotal[label].add() + } + + override fun recordDeserializationError(label: String, value: String) { + AdsClient.deserializationError[label].set(value) + } + + override fun recordHttpCacheOutcome(label: String, value: String) { + AdsClient.httpCacheOutcome[label].set(value) + } +} +``` + +--- + +## `MozAdsCacheConfig` + +Describes the behavior and location of the on-disk HTTP cache. + +```rust +pub struct MozAdsCacheConfig { + pub db_path: String, + pub default_cache_ttl_seconds: Option, + pub max_size_mib: Option, +} +``` + +| Field | Type | Description | +| --------------------------- | ------------- | ------------------------------------------------------------------------------------ | +| `db_path` | `String` | Path to the SQLite database file used for cache storage. Required to enable caching. | +| `default_cache_ttl_seconds` | `Option` | Default TTL for cached entries. If omitted, defaults to 300 seconds (5 minutes). | +| `max_size_mib` | `Option` | Maximum cache size. If omitted, defaults to 10 MiB. | + +**Defaults** + +- default_cache_ttl_seconds: 300 seconds (5 min) +- max_size_mib: 10 MiB + +--- + +## `MozAdsPlacementRequest` + +Describes a single ad placement to request from MARS. A vector of these are required for the `request_image_ads` and `request_tile_ads` methods on the client. + +```rust +pub struct MozAdsPlacementRequest { + pub placement_id: String, + pub iab_content: Option, +} +``` + +| Field | Type | Description | +| -------------- | -------------------------- | ------------------------------------------------------------------------------- | +| `placement_id` | `String` | Unique identifier for the ad placement. Must be unique within one request call. | +| `iab_content` | `Option` | Optional IAB content classification for targeting. | + +**Validation Rules:** + +- `placement_id` values must be unique per request. + +--- + +## `MozAdsPlacementRequestWithCount` + +Describes a single ad placement to request from MARS with a count parameter. A vector of these are required for the `request_spoc_ads` method on the client. + +```rust +pub struct MozAdsPlacementRequestWithCount { + pub count: u32, + pub placement_id: String, + pub iab_content: Option, +} +``` + +| Field | Type | Description | +| -------------- | -------------------------- | ------------------------------------------------------------------------------- | +| `count` | `u32` | Number of spoc ads to request for this placement. | +| `placement_id` | `String` | Unique identifier for the ad placement. Must be unique within one request call. | +| `iab_content` | `Option` | Optional IAB content classification for targeting. | + +**Validation Rules:** + +- `placement_id` values must be unique per request. + +--- + +## `MozAdsRequestOptions` + +Options passed when making a single ad request. + +```rust +pub struct MozAdsRequestOptions { + pub cache_policy: Option, +} +``` + +| Field | Type | Description | +| -------------- | ---------------------------------- | ---------------------------------------------------------------------------------------------- | +| `cache_policy` | `Option` | Per-request caching policy. If `None`, uses the client's default TTL with a `CacheFirst` mode. | + +--- + +## `MozAdsRequestCachePolicy` + +Defines how each request interacts with the cache. + +```rust +pub struct MozAdsRequestCachePolicy { + pub mode: MozAdsCacheMode, + pub ttl_seconds: Option, +} +``` + +| Field | Type | Description | +| ------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `mode` | `MozAdsCacheMode` | Strategy for combining cache and network. Can be `CacheFirst` or `NetworkFirst`. | +| `ttl_seconds` | `Option` | Optional per-request TTL override in seconds. `None` uses the client default. `Some(0)` disables caching for this request. | + +--- + +## `MozAdsCacheMode` + +Determines how the cache is used during a request. + +```rust +pub enum MozAdsCacheMode { + CacheFirst, + NetworkFirst, +} +``` + +| Variant | Behavior | +| -------------- | -------------------------------------------------------------------------------------------------- | +| `CacheFirst` | Check cache first, return cached response if found, otherwise make a network request and store it. | +| `NetworkFirst` | Always fetch from network, then cache the result. | + +--- + +## `MozAdsImage` + +The image ad creative, callbacks, and metadata provided for each image ad returned from MARS. + +```rust +pub struct MozAdsImage { + pub alt_text: Option, + pub block_key: String, + pub callbacks: MozAdsCallbacks, + pub format: String, + pub image_url: String, + pub url: String, +} +``` + +| Field | Type | Description | +| ----------- | ----------------- | ------------------------------------------- | +| `url` | `String` | Destination URL. | +| `image_url` | `String` | Creative asset URL. | +| `format` | `String` | Ad format e.g., `"skyscraper"`. | +| `block_key` | `String` | The block key generated for the advertiser. | +| `alt_text` | `Option` | Alt text if available. | +| `callbacks` | `MozAdsCallbacks` | Lifecycle callback endpoints. | + +--- + +## `MozAdsSpoc` + +The spoc ad creative, callbacks, and metadata provided for each spoc ad returned from MARS. + +```rust +pub struct MozAdsSpoc { + pub block_key: String, + pub callbacks: MozAdsCallbacks, + pub caps: MozAdsSpocFrequencyCaps, + pub domain: String, + pub excerpt: String, + pub format: String, + pub image_url: String, + pub ranking: MozAdsSpocRanking, + pub sponsor: String, + pub sponsored_by_override: Option, + pub title: String, + pub url: String, +} +``` + +| Field | Type | Description | +| ----------------------- | ------------------------- | ------------------------------------------- | +| `url` | `String` | Destination URL. | +| `image_url` | `String` | Creative asset URL. | +| `format` | `String` | Ad format e.g., `"spoc"`. | +| `block_key` | `String` | The block key generated for the advertiser. | +| `title` | `String` | Spoc ad title. | +| `excerpt` | `String` | Spoc ad excerpt/description. | +| `domain` | `String` | Domain of the spoc ad. | +| `sponsor` | `String` | Sponsor name. | +| `sponsored_by_override` | `Option` | Optional override for sponsor name. | +| `caps` | `MozAdsSpocFrequencyCaps` | Frequency capping information. | +| `ranking` | `MozAdsSpocRanking` | Ranking and personalization information. | +| `callbacks` | `MozAdsCallbacks` | Lifecycle callback endpoints. | + +--- + +## `MozAdsTile` + +The tile ad creative, callbacks, and metadata provided for each tile ad returned from MARS. + +```rust +pub struct MozAdsTile { + pub block_key: String, + pub callbacks: MozAdsCallbacks, + pub format: String, + pub image_url: String, + pub name: String, + pub url: String, +} +``` + +| Field | Type | Description | +| ----------- | ----------------- | ------------------------------------------- | +| `url` | `String` | Destination URL. | +| `image_url` | `String` | Creative asset URL. | +| `format` | `String` | Ad format e.g., `"tile"`. | +| `block_key` | `String` | The block key generated for the advertiser. | +| `name` | `String` | Tile ad name. | +| `callbacks` | `MozAdsCallbacks` | Lifecycle callback endpoints. | + +--- + +## `MozAdsSpocFrequencyCaps` + +Frequency capping information for spoc ads. + +```rust +pub struct MozAdsSpocFrequencyCaps { + pub cap_key: String, + pub day: u32, +} +``` + +| Field | Type | Description | +| --------- | -------- | --------------------------------- | +| `cap_key` | `String` | Frequency cap key identifier. | +| `day` | `u32` | Day number for the frequency cap. | + +--- + +## `MozAdsSpocRanking` + +Ranking and personalization information for spoc ads. + +```rust +pub struct MozAdsSpocRanking { + pub priority: u32, + pub personalization_models: HashMap, + pub item_score: f64, +} +``` + +| Field | Type | Description | +| ------------------------ | ---------------------- | ----------------------------- | +| `priority` | `u32` | Priority score for ranking. | +| `personalization_models` | `HashMap` | Personalization model scores. | +| `item_score` | `f64` | Overall item score. | + +--- + +## `MozAdsCallbacks` + +```rust +pub struct MozAdsCallbacks { + pub click: Url, + pub impression: Url, + pub report: Option, +} +``` + +| Field | Type | Description | +| ------------ | ------------- | ------------------------ | +| `click` | `Url` | Click callback URL. | +| `impression` | `Url` | Impression callback URL. | +| `report` | `Option` | Report callback URL. | + +--- + +## `MozAdsIABContent` + +Provides IAB content classification context for a placement. + +```rust +pub struct MozAdsIABContent { + pub taxonomy: MozAdsIABContentTaxonomy, + pub category_ids: Vec, +} +``` + +| Field | Type | Description | +| -------------- | -------------------------- | ------------------------------------- | +| `taxonomy` | `MozAdsIABContentTaxonomy` | IAB taxonomy version. | +| `category_ids` | `Vec` | One or more IAB category identifiers. | + +--- + +## `MozAdsIABContentTaxonomy` + +The [IAB Content Taxonomy](https://www.iab.com/guidelines/content-taxonomy/) version to be used in the request. e.g `IAB-1.0` + +```rust +pub enum MozAdsIABContentTaxonomy { + IAB1_0, + IAB2_0, + IAB2_1, + IAB2_2, + IAB3_0, +} +``` + +> Note: The generated native bindings for the values may look different depending on the language (snake-case, camel case, etc.) as a result of UniFFI's formatting. + +--- + +## Internal Cache Behavior + +### Cache Overview + +The internal HTTP cache is a SQLite-backed key-value store layered over viaduct::Request::send(). +It reduces redundant network traffic and improves latency for repeated or identical ad requests. + +### Cache Lifecycle + +Each network response can be stored in the cache with an associated effective TTL, computed as: + +```rust +effective_ttl = min(server_max_age, client_default_ttl, per_request_ttl) +``` + +where: + +- `server_max_age` comes from the HTTP Cache-Control: max-age=N header (if present), +- `client_default_ttl` is set in `MozAdsCacheConfig`, +- `per_request_ttl` is an optional override set in `MozAdsRequestCachePolicy`. + +If the effective TTL resolves to 0 seconds, the response is not cached. + +### Configuring The Cache + +#### Example Client Configuration + +```swift +// Swift example +let cache = MozAdsCacheConfig( + dbPath: "/tmp/ads_cache.sqlite", + defaultCacheTtlSeconds: 600, // 10 min + maxSizeMib: 20 // 20 MiB +) + +let telemetry = AdsClientTelemetry() +let clientCfg = MozAdsClientConfig( + environment: .prod, + cacheConfig: cache, + telemetry: telemetry +) + +let client = MozAdsClient(clientConfig: clientCfg) +``` + +```kotlin +// Kotlin example +val cache = MozAdsCacheConfig( + dbPath = "/tmp/ads_cache.sqlite", + defaultCacheTtlSeconds = 600L, // 10 min + maxSizeMib = 20L // 20 MiB +) + +val telemetry = AdsClientTelemetry() +val clientCfg = MozAdsClientConfig( + environment = MozAdsEnvironment.PROD, + cacheConfig = cache, + telemetry = telemetry +) + +val client = MozAdsClient(clientCfg) +``` + +Where `db_path` represents the location of the SQLite file. This must be a file that the client has permission to write to. + +#### Example Request Policy Override + +Assuming you have at least initialized the client with a `db_path`, individual requests can override caching behavior. However, recall the minimum TTL is always respected. So this override will only provide a new ttl floor. + +```rust +// Always fetch from network but only cache for 60 seconds +let options = MozAdsRequestOptions( + cachePolicy: MozAdsRequestCachePolicy(mode: .networkFirst, ttlSeconds: 60) +) + +// Use it when requesting ads +let placements = client.requestImageAds(configs, options: options) +``` + +### Cache Invalidation + +**TTL-based expiry (automatic):** + +At the start of each send, the cache computes a cutoff from chrono::Utc::now() - ttl and deletes rows older than that. This is a coarse, global freshness window that bounds how long entries can live. + +**Size-based trimming (automatic):** +After storing a cacheable miss, the cache enforces max_size by deleting the oldest rows until the total stored size is ≤ the maximum allowed size of the cache. Due to the small size of items in the cache and the relatively short TTL, this behavior should be rare. + +**Manual clearing (explicit):** +The cache can be manually cleared by the client using the exposed `client.clear_cache()` method. This clears _all_ objects in the cache. + +--- + +### Example Usage + +Under construction diff --git a/third_party/rust/ads-client/metrics.yaml b/third_party/rust/ads-client/metrics.yaml new file mode 100644 index 0000000000000..f42c7aa4c95bf --- /dev/null +++ b/third_party/rust/ads-client/metrics.yaml @@ -0,0 +1,127 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# 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/. + + +--- +$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0 + + +ads_client: + build_cache_error: + type: labeled_string + description: > + Errors encountered when building the HTTP cache, labeled by error type. + The string value contains the error message or error type. + labels: + - builder_error + - database_error + - empty_db_path + - invalid_max_size + - invalid_ttl + bugs: + - https://github.com/mozilla/application-services/pull/7111 + data_reviews: + - https://github.com/mozilla/application-services/pull/7111 + data_sensitivity: + - technical + notification_emails: + - ahanot@mozilla.com + - llisi@mozilla.com + - toast@mozilla.com + expires: never + + client_error: + type: labeled_string + description: > + Errors encountered when using the ads client, labeled by operation type. + The string value contains the error message or error type. Errors are + recorded even if they are propagated to the consumer. + labels: + - record_click + - record_impression + - report_ad + - request_ads + bugs: + - https://github.com/mozilla/application-services/pull/7111 + data_reviews: + - https://github.com/mozilla/application-services/pull/7111 + data_sensitivity: + - interaction + notification_emails: + - ahanot@mozilla.com + - llisi@mozilla.com + - toast@mozilla.com + expires: never + + client_operation_total: + type: labeled_counter + description: > + The total number of operations attempted by the ads client, labeled by + operation type. Used as the denominator for client_operation_success_rate. + labels: + - new + - record_click + - record_impression + - report_ad + - request_ads + bugs: + - https://github.com/mozilla/application-services/pull/7111 + data_reviews: + - https://github.com/mozilla/application-services/pull/7111 + data_sensitivity: + - interaction + notification_emails: + - ahanot@mozilla.com + - llisi@mozilla.com + - toast@mozilla.com + expires: never + + deserialization_error: + type: labeled_string + description: > + Deserialization errors encountered when parsing AdResponse data, + labeled by error type. The string value contains the error message or + details. Invalid ad items are skipped but these errors are tracked for + monitoring data quality issues. + labels: + - invalid_ad_item + - invalid_array + - invalid_structure + bugs: + - https://github.com/mozilla/application-services/pull/7111 + data_reviews: + - https://github.com/mozilla/application-services/pull/7111 + data_sensitivity: + - technical + notification_emails: + - ahanot@mozilla.com + - llisi@mozilla.com + - toast@mozilla.com + expires: never + + http_cache_outcome: + type: labeled_string + description: > + The total number of outcomes encountered during read operations on the + http cache, labeled by type. The string value contains the error message or + error type. + labels: + - cleanup_failed + - hit + - lookup_failed + - miss_not_cacheable + - miss_stored + - no_cache + - store_failed + bugs: + - https://github.com/mozilla/application-services/pull/7111 + data_reviews: + - https://github.com/mozilla/application-services/pull/7111 + data_sensitivity: + - technical + notification_emails: + - ahanot@mozilla.com + - llisi@mozilla.com + - toast@mozilla.com + expires: never diff --git a/third_party/rust/ads-client/src/client.rs b/third_party/rust/ads-client/src/client.rs new file mode 100644 index 0000000000000..cf27bbba10217 --- /dev/null +++ b/third_party/rust/ads-client/src/client.rs @@ -0,0 +1,390 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public +* 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/. +*/ + +use std::collections::HashMap; +use std::time::Duration; + +use crate::client::ad_response::{ + pop_request_hash_from_url, AdImage, AdResponse, AdResponseValue, AdSpoc, AdTile, +}; +use crate::client::config::AdsClientConfig; +use crate::error::{RecordClickError, RecordImpressionError, ReportAdError, RequestAdsError}; +use crate::http_cache::{HttpCache, RequestCachePolicy}; +use crate::mars::MARSClient; +use crate::telemetry::Telemetry; +use ad_request::{AdPlacementRequest, AdRequest}; +use context_id::{ContextIDComponent, DefaultContextIdCallback}; +use url::Url; +use uuid::Uuid; + +use crate::http_cache::{ByteSize, HttpCacheError}; + +pub mod ad_request; +pub mod ad_response; +pub mod config; + +const DEFAULT_TTL_SECONDS: u64 = 300; +const DEFAULT_MAX_CACHE_SIZE_MIB: u64 = 10; + +pub struct AdsClient +where + T: Clone + Telemetry, +{ + client: MARSClient, + context_id_component: ContextIDComponent, + telemetry: T, +} + +impl AdsClient +where + T: Clone + Telemetry, +{ + pub fn new(client_config: AdsClientConfig) -> Self { + let context_id = Uuid::new_v4().to_string(); + let context_id_component = ContextIDComponent::new( + &context_id, + 0, + cfg!(test), + Box::new(DefaultContextIdCallback), + ); + let telemetry = client_config.telemetry; + + // Configure the cache if a path is provided. + // Defaults for ttl and cache size are also set if unspecified. + if let Some(cache_cfg) = client_config.cache_config { + let default_cache_ttl = Duration::from_secs( + cache_cfg + .default_cache_ttl_seconds + .unwrap_or(DEFAULT_TTL_SECONDS), + ); + let max_cache_size = + ByteSize::mib(cache_cfg.max_size_mib.unwrap_or(DEFAULT_MAX_CACHE_SIZE_MIB)); + + let http_cache = match HttpCache::builder(cache_cfg.db_path) + .max_size(max_cache_size) + .default_ttl(default_cache_ttl) + .build() + { + Ok(cache) => Some(cache), + Err(e) => { + telemetry.record(&e); + None + } + }; + + let client = MARSClient::new(client_config.environment, http_cache, telemetry.clone()); + let client = Self { + context_id_component, + client, + telemetry: telemetry.clone(), + }; + telemetry.record(&ClientOperationEvent::New); + return client; + } + + let client = MARSClient::new(client_config.environment, None, telemetry.clone()); + let client = Self { + context_id_component, + client, + telemetry: telemetry.clone(), + }; + telemetry.record(&ClientOperationEvent::New); + client + } + + fn request_ads( + &self, + ad_placement_requests: Vec, + options: Option, + ) -> Result, RequestAdsError> + where + A: AdResponseValue, + { + let context_id = self.get_context_id()?; + let ad_request = AdRequest::build(context_id, ad_placement_requests)?; + let cache_policy = options.unwrap_or_default(); + let (mut response, request_hash) = + self.client.fetch_ads::(&ad_request, &cache_policy)?; + response.add_request_hash_to_callbacks(&request_hash); + Ok(response) + } + + pub fn request_image_ads( + &self, + ad_placement_requests: Vec, + options: Option, + ) -> Result, RequestAdsError> { + let response = self + .request_ads::(ad_placement_requests, options) + .inspect_err(|e| { + self.telemetry.record(e); + })?; + self.telemetry.record(&ClientOperationEvent::RequestAds); + Ok(response.take_first()) + } + + pub fn request_spoc_ads( + &self, + ad_placement_requests: Vec, + options: Option, + ) -> Result>, RequestAdsError> { + let result = self.request_ads::(ad_placement_requests, options); + result + .inspect_err(|e| { + self.telemetry.record(e); + }) + .map(|response| { + self.telemetry.record(&ClientOperationEvent::RequestAds); + response.data + }) + } + + pub fn request_tile_ads( + &self, + ad_placement_requests: Vec, + options: Option, + ) -> Result, RequestAdsError> { + let result = self.request_ads::(ad_placement_requests, options); + result + .inspect_err(|e| { + self.telemetry.record(e); + }) + .map(|response| { + self.telemetry.record(&ClientOperationEvent::RequestAds); + response.take_first() + }) + } + + pub fn record_impression(&self, impression_url: Url) -> Result<(), RecordImpressionError> { + let mut impression_url = impression_url.clone(); + if let Some(request_hash) = pop_request_hash_from_url(&mut impression_url) { + let _ = self.client.invalidate_cache_by_hash(&request_hash); + } + self.client + .record_impression(impression_url) + .inspect_err(|e| { + self.telemetry.record(e); + }) + .inspect(|_| { + self.telemetry + .record(&ClientOperationEvent::RecordImpression); + }) + } + + pub fn record_click(&self, click_url: Url) -> Result<(), RecordClickError> { + let mut click_url = click_url.clone(); + if let Some(request_hash) = pop_request_hash_from_url(&mut click_url) { + let _ = self.client.invalidate_cache_by_hash(&request_hash); + } + self.client + .record_click(click_url) + .inspect_err(|e| { + self.telemetry.record(e); + }) + .inspect(|_| { + self.telemetry.record(&ClientOperationEvent::RecordClick); + }) + } + + pub fn report_ad(&self, report_url: Url) -> Result<(), ReportAdError> { + self.client + .report_ad(report_url) + .inspect_err(|e| { + self.telemetry.record(e); + }) + .inspect(|_| { + self.telemetry.record(&ClientOperationEvent::ReportAd); + }) + } + + pub fn get_context_id(&self) -> context_id::ApiResult { + self.context_id_component.request(0) + } + + pub fn cycle_context_id(&mut self) -> context_id::ApiResult { + let old_context_id = self.get_context_id()?; + self.context_id_component.force_rotation()?; + Ok(old_context_id) + } + + pub fn clear_cache(&self) -> Result<(), HttpCacheError> { + self.client.clear_cache() + } +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum ClientOperationEvent { + New, + RecordClick, + RecordImpression, + ReportAd, + RequestAds, +} + +#[cfg(test)] +mod tests { + use crate::{ + client::config::Environment, + ffi::telemetry::MozAdsTelemetryWrapper, + test_utils::{ + get_example_happy_image_response, get_example_happy_spoc_response, + get_example_happy_uatile_response, make_happy_placement_requests, + }, + }; + + use super::*; + + fn new_with_mars_client( + client: MARSClient, + ) -> AdsClient { + let context_id_component = ContextIDComponent::new( + &uuid::Uuid::new_v4().to_string(), + 0, + false, + Box::new(DefaultContextIdCallback), + ); + AdsClient { + context_id_component, + client, + telemetry: MozAdsTelemetryWrapper::noop(), + } + } + + #[test] + fn test_get_context_id() { + let config = AdsClientConfig { + environment: Environment::Test, + cache_config: None, + telemetry: MozAdsTelemetryWrapper::noop(), + }; + let client = AdsClient::new(config); + let context_id = client.get_context_id().unwrap(); + assert!(!context_id.is_empty()); + } + + #[test] + fn test_cycle_context_id() { + let config = AdsClientConfig { + environment: Environment::Test, + cache_config: None, + telemetry: MozAdsTelemetryWrapper::noop(), + }; + let mut client = AdsClient::new(config); + let old_id = client.get_context_id().unwrap(); + let previous_id = client.cycle_context_id().unwrap(); + assert_eq!(previous_id, old_id); + let new_id = client.get_context_id().unwrap(); + assert_ne!(new_id, old_id); + } + + #[test] + fn test_request_image_ads_happy() { + viaduct_dev::init_backend_dev(); + + let expected_response = get_example_happy_image_response(); + let _m = mockito::mock("POST", "/ads") + .with_status(200) + .with_header("content-type", "application/json") + .with_body(serde_json::to_string(&expected_response.data).unwrap()) + .create(); + + let telemetry = MozAdsTelemetryWrapper::noop(); + let mars_client = MARSClient::new(Environment::Test, None, telemetry); + let ads_client = new_with_mars_client(mars_client); + + let ad_placement_requests = make_happy_placement_requests(); + + let result = ads_client.request_image_ads(ad_placement_requests, None); + + assert!(result.is_ok()); + } + + #[test] + fn test_request_spocs_happy() { + viaduct_dev::init_backend_dev(); + + let expected_response = get_example_happy_spoc_response(); + let _m = mockito::mock("POST", "/ads") + .with_status(200) + .with_header("content-type", "application/json") + .with_body(serde_json::to_string(&expected_response.data).unwrap()) + .create(); + + let telemetry = MozAdsTelemetryWrapper::noop(); + let mars_client = MARSClient::new(Environment::Test, None, telemetry); + let ads_client = new_with_mars_client(mars_client); + + let ad_placement_requests = make_happy_placement_requests(); + + let result = ads_client.request_spoc_ads(ad_placement_requests, None); + + assert!(result.is_ok()); + } + + #[test] + fn test_request_tiles_happy() { + viaduct_dev::init_backend_dev(); + + let expected_response = get_example_happy_uatile_response(); + let _m = mockito::mock("POST", "/ads") + .with_status(200) + .with_header("content-type", "application/json") + .with_body(serde_json::to_string(&expected_response.data).unwrap()) + .create(); + + let telemetry = MozAdsTelemetryWrapper::noop(); + let mars_client = MARSClient::new(Environment::Test, None, telemetry.clone()); + let ads_client = new_with_mars_client(mars_client); + + let ad_placement_requests = make_happy_placement_requests(); + + let result = ads_client.request_tile_ads(ad_placement_requests, None); + + assert!(result.is_ok()); + } + + #[test] + fn test_record_click_invalidates_cache() { + viaduct_dev::init_backend_dev(); + let cache = HttpCache::builder("test_record_click_invalidates_cache") + .build() + .unwrap(); + let telemetry = MozAdsTelemetryWrapper::noop(); + let mars_client = MARSClient::new(Environment::Test, Some(cache), telemetry.clone()); + let ads_client = new_with_mars_client(mars_client); + + let response = get_example_happy_image_response(); + + let _m1 = mockito::mock("POST", "/ads") + .with_status(200) + .with_header("content-type", "application/json") + .with_body(serde_json::to_string(&response.data).unwrap()) + .expect(2) // we expect 2 requests to the server, one for the initial ad request and one after for the cache invalidation request + .create(); + + let response = ads_client + .request_image_ads(make_happy_placement_requests(), None) + .unwrap(); + let callback_url = response.values().next().unwrap().callbacks.click.clone(); + + let _m2 = mockito::mock("GET", callback_url.path()) + .with_status(200) + .create(); + + // Doing another request should hit the cache + ads_client + .request_image_ads(make_happy_placement_requests(), None) + .unwrap(); + + ads_client.record_click(callback_url).unwrap(); + + ads_client + .request_ads::( + make_happy_placement_requests(), + Some(RequestCachePolicy::default()), + ) + .unwrap(); + } +} diff --git a/third_party/rust/ads-client/src/client/ad_request.rs b/third_party/rust/ads-client/src/client/ad_request.rs new file mode 100644 index 0000000000000..da49263e4374e --- /dev/null +++ b/third_party/rust/ads-client/src/client/ad_request.rs @@ -0,0 +1,224 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public +* 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/. +*/ + +use std::collections::HashSet; + +use serde::{Deserialize, Serialize}; + +use crate::error::BuildRequestError; + +#[derive(Debug, PartialEq, Serialize)] +pub struct AdRequest { + pub context_id: String, + pub placements: Vec, +} + +impl AdRequest { + pub fn build( + context_id: String, + placements: Vec, + ) -> Result { + if placements.is_empty() { + return Err(BuildRequestError::EmptyConfig); + }; + + let mut request = AdRequest { + placements: vec![], + context_id, + }; + + let mut used_placement_ids: HashSet = HashSet::new(); + + for ad_placement_request in placements { + if used_placement_ids.contains(&ad_placement_request.placement) { + return Err(BuildRequestError::DuplicatePlacementId { + placement_id: ad_placement_request.placement.clone(), + }); + } + + request.placements.push(AdPlacementRequest { + placement: ad_placement_request.placement.clone(), + count: ad_placement_request.count, + content: ad_placement_request + .content + .map(|iab_content| AdContentCategory { + categories: iab_content.categories, + taxonomy: iab_content.taxonomy, + }), + }); + + used_placement_ids.insert(ad_placement_request.placement.clone()); + } + + Ok(request) + } +} + +#[derive(Debug, PartialEq, Serialize)] +pub struct AdPlacementRequest { + pub placement: String, + pub count: u32, + pub content: Option, +} + +#[derive(Debug, Deserialize, PartialEq, Serialize)] +pub struct AdContentCategory { + pub taxonomy: IABContentTaxonomy, + pub categories: Vec, +} + +#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +pub enum IABContentTaxonomy { + #[serde(rename = "IAB-1.0")] + IAB1_0, + + #[serde(rename = "IAB-2.0")] + IAB2_0, + + #[serde(rename = "IAB-2.1")] + IAB2_1, + + #[serde(rename = "IAB-2.2")] + IAB2_2, + + #[serde(rename = "IAB-3.0")] + IAB3_0, +} + +#[cfg(test)] +mod tests { + use crate::test_utils::TEST_CONTEXT_ID; + + use super::*; + use serde_json::{json, to_value}; + + #[test] + fn test_ad_placement_request_with_content_serialize() { + let request = AdPlacementRequest { + placement: "example_placement".into(), + count: 1, + content: Some(AdContentCategory { + taxonomy: IABContentTaxonomy::IAB2_1, + categories: vec!["Technology".into(), "Programming".into()], + }), + }; + + let serialized = to_value(&request).unwrap(); + + let expected_json = json!({ + "placement": "example_placement", + "count": 1, + "content": { + "taxonomy": "IAB-2.1", + "categories": ["Technology", "Programming"] + } + }); + + assert_eq!(serialized, expected_json); + } + + #[test] + fn test_iab_content_taxonomy_serialize() { + use serde_json::to_string; + + // We expect that enums map to strings like "IAB-2.2" + let s = to_string(&IABContentTaxonomy::IAB1_0).unwrap(); + assert_eq!(s, "\"IAB-1.0\""); + + let s = to_string(&IABContentTaxonomy::IAB2_0).unwrap(); + assert_eq!(s, "\"IAB-2.0\""); + + let s = to_string(&IABContentTaxonomy::IAB2_1).unwrap(); + assert_eq!(s, "\"IAB-2.1\""); + + let s = to_string(&IABContentTaxonomy::IAB2_2).unwrap(); + assert_eq!(s, "\"IAB-2.2\""); + + let s = to_string(&IABContentTaxonomy::IAB3_0).unwrap(); + assert_eq!(s, "\"IAB-3.0\""); + } + + #[test] + fn test_build_ad_request_happy() { + let request = AdRequest::build( + TEST_CONTEXT_ID.to_string(), + vec![ + AdPlacementRequest { + placement: "example_placement_1".to_string(), + count: 1, + content: Some(AdContentCategory { + taxonomy: IABContentTaxonomy::IAB2_1, + categories: vec!["entertainment".to_string()], + }), + }, + AdPlacementRequest { + placement: "example_placement_2".to_string(), + count: 2, + content: Some(AdContentCategory { + taxonomy: IABContentTaxonomy::IAB2_1, + categories: vec![], + }), + }, + ], + ) + .unwrap(); + + let expected_request = AdRequest { + context_id: TEST_CONTEXT_ID.to_string(), + placements: vec![ + AdPlacementRequest { + placement: "example_placement_1".to_string(), + count: 1, + content: Some(AdContentCategory { + taxonomy: IABContentTaxonomy::IAB2_1, + categories: vec!["entertainment".to_string()], + }), + }, + AdPlacementRequest { + placement: "example_placement_2".to_string(), + count: 2, + content: Some(AdContentCategory { + taxonomy: IABContentTaxonomy::IAB2_1, + categories: vec![], + }), + }, + ], + }; + + assert_eq!(request, expected_request); + } + + #[test] + fn test_build_ad_request_fails_on_duplicate_placement_id() { + let request = AdRequest::build( + TEST_CONTEXT_ID.to_string(), + vec![ + AdPlacementRequest { + placement: "example_placement_1".to_string(), + count: 1, + content: Some(AdContentCategory { + taxonomy: IABContentTaxonomy::IAB2_1, + categories: vec!["entertainment".to_string()], + }), + }, + AdPlacementRequest { + placement: "example_placement_1".to_string(), + count: 1, + content: Some(AdContentCategory { + taxonomy: IABContentTaxonomy::IAB3_0, + categories: vec![], + }), + }, + ], + ); + assert!(request.is_err()); + } + + #[test] + fn test_build_ad_request_fails_on_empty_request() { + let request = AdRequest::build(TEST_CONTEXT_ID.to_string(), vec![]); + assert!(request.is_err()); + } +} diff --git a/third_party/rust/ads-client/src/client/ad_response.rs b/third_party/rust/ads-client/src/client/ad_response.rs new file mode 100644 index 0000000000000..24bf6ffd0e5bf --- /dev/null +++ b/third_party/rust/ads-client/src/client/ad_response.rs @@ -0,0 +1,489 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public +* 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/. +*/ + +use crate::http_cache::RequestHash; +use crate::telemetry::Telemetry; +use serde::de::DeserializeOwned; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; +use url::Url; + +#[derive(Debug, PartialEq, Serialize)] +pub struct AdResponse { + pub data: HashMap>, +} + +impl AdResponse { + pub fn parse( + data: serde_json::Value, + telemetry: &T, + ) -> Result, serde_json::Error> { + let raw: HashMap = serde_json::from_value(data)?; + let mut result = HashMap::new(); + + for (key, value) in raw { + if let serde_json::Value::Array(arr) = value { + let mut ads: Vec = vec![]; + for item in arr { + match serde_json::from_value::(item.clone()) { + Ok(ad) => ads.push(ad), + Err(e) => { + telemetry.record(&e); + } + } + } + if !ads.is_empty() { + result.insert(key, ads); + } + } + } + + Ok(AdResponse { data: result }) + } + + pub fn add_request_hash_to_callbacks(&mut self, request_hash: &RequestHash) { + for ads in self.data.values_mut() { + for ad in ads.iter_mut() { + let callbacks = ad.callbacks_mut(); + let hash_str = request_hash.to_string(); + callbacks + .click + .query_pairs_mut() + .append_pair("request_hash", &hash_str); + callbacks + .impression + .query_pairs_mut() + .append_pair("request_hash", &hash_str); + } + } + } + + pub fn take_first(self) -> HashMap { + self.data + .into_iter() + .filter_map(|(k, mut v)| { + if v.is_empty() { + None + } else { + Some((k, v.remove(0))) + } + }) + .collect() + } +} + +pub fn pop_request_hash_from_url(url: &mut Url) -> Option { + let mut request_hash = None; + let mut query = url::form_urlencoded::Serializer::new(String::new()); + + for (key, value) in url.query_pairs() { + if key == "request_hash" { + request_hash = Some(RequestHash::from(value.as_ref())); + } else { + query.append_pair(&key, &value); + } + } + + let query_string = query.finish(); + if query_string.is_empty() { + url.set_query(None); + } else { + url.set_query(Some(&query_string)); + } + request_hash +} + +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] +pub struct AdImage { + pub alt_text: Option, + pub block_key: String, + pub callbacks: AdCallbacks, + pub format: String, + pub image_url: String, + pub url: String, +} + +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] +pub struct AdSpoc { + pub block_key: String, + pub callbacks: AdCallbacks, + pub caps: SpocFrequencyCaps, + pub domain: String, + pub excerpt: String, + pub format: String, + pub image_url: String, + pub ranking: SpocRanking, + pub sponsor: String, + pub sponsored_by_override: Option, + pub title: String, + pub url: String, +} + +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] +pub struct AdTile { + pub block_key: String, + pub callbacks: AdCallbacks, + pub format: String, + pub image_url: String, + pub name: String, + pub url: String, +} + +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] +pub struct SpocFrequencyCaps { + pub cap_key: String, + pub day: u32, +} + +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] +pub struct SpocRanking { + pub priority: u32, + pub personalization_models: Option>, + pub item_score: f64, +} + +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] +pub struct AdCallbacks { + pub click: Url, + pub impression: Url, + pub report: Option, +} + +pub trait AdResponseValue: DeserializeOwned { + fn callbacks_mut(&mut self) -> &mut AdCallbacks; +} + +impl AdResponseValue for AdImage { + fn callbacks_mut(&mut self) -> &mut AdCallbacks { + &mut self.callbacks + } +} + +impl AdResponseValue for AdSpoc { + fn callbacks_mut(&mut self) -> &mut AdCallbacks { + &mut self.callbacks + } +} + +impl AdResponseValue for AdTile { + fn callbacks_mut(&mut self) -> &mut AdCallbacks { + &mut self.callbacks + } +} + +#[cfg(test)] +mod tests { + use crate::ffi::telemetry::MozAdsTelemetryWrapper; + + use super::*; + use serde_json::{from_str, json}; + + #[test] + fn test_moz_ad_full() { + let response_full = json!({ + "alt_text": "An ad for an anvil", + "block_key": "abc123", + "callbacks": { + "click": "https://buyanvilseveryday.test/click", + "impression": "https://buyanvilseveryday.test/impression", + "report": "https://buyanvilseveryday.test/report" + }, + "format": "Leaderboard", + "image_url": "https://buyanvilseveryday.test/img.png", + "url": "https://buyanvilseveryday.test" + }) + .to_string(); + + let full: AdImage = from_str(&response_full).unwrap(); + assert_eq!( + full, + AdImage { + alt_text: Some("An ad for an anvil".into()), + block_key: "abc123".into(), + callbacks: AdCallbacks { + click: Url::parse("https://buyanvilseveryday.test/click").unwrap(), + impression: Url::parse("https://buyanvilseveryday.test/impression").unwrap(), + report: Some(Url::parse("https://buyanvilseveryday.test/report").unwrap()), + }, + format: "Leaderboard".into(), + image_url: "https://buyanvilseveryday.test/img.png".into(), + url: "https://buyanvilseveryday.test".into(), + } + ); + } + + #[test] + fn test_moz_ad_response_partial() { + let response_partial = json!({ + "alt_text": null, + "block_key": "abc123", + "callbacks": { + "click": "https://example.test/click", + "impression": "https://example.test/impression", + "report": null + }, + "format": "Leaderboard", + "image_url": "https://example.test/image.png", + "url": "https://example.test/item" + }) + .to_string(); + + let partial: AdImage = from_str(&response_partial).unwrap(); + assert_eq!( + partial, + AdImage { + alt_text: None, + block_key: "abc123".into(), + callbacks: AdCallbacks { + click: Url::parse("https://example.test/click").unwrap(), + impression: Url::parse("https://example.test/impression").unwrap(), + report: None, + }, + format: "Leaderboard".into(), + image_url: "https://example.test/image.png".into(), + url: "https://example.test/item".into(), + } + ); + } + + #[test] + fn test_ad_response_serialization() { + let raw_ad_response = json!({ + "missing_click_url": [ + { + "block_key": "abc123", + "url": "https://ads.fakeexample.org/example_ad_1", + "image_url": "https://ads.fakeexample.org/example_image_1", + "format": "billboard", + "alt_text": "An ad for a puppy", + "callbacks": { + "impression": "https://ads.fakeexample.org/impression/example_ad_1", + } + } + ], + "incorrect_click_url": [ + { + "block_key": "abc123", + "url": "https://ads.fakeexample.org/example_ad_1", + "image_url": "https://ads.fakeexample.org/example_image_1", + "format": "billboard", + "alt_text": "An ad for a puppy", + "callbacks": { + "click": "incorrect-click-url", + "impression": "https://ads.fakeexample.org/impression/example_ad_1", + } + } + ], + "missing_impression_url": [ + { + "block_key": "abc123", + "url": "https://ads.fakeexample.org/example_ad_1", + "image_url": "https://ads.fakeexample.org/example_image_1", + "format": "billboard", + "alt_text": "An ad for a puppy", + "callbacks": { + "click": "https://ads.fakeexample.org/click/example_ad_1", + } + } + ], + "incorrect_impression_url": [ + { + "block_key": "abc123", + "url": "https://ads.fakeexample.org/example_ad_2", + "image_url": "https://ads.fakeexample.org/example_image_2", + "format": "skyscraper", + "alt_text": "An ad for a pet duck", + "callbacks": { + "click": "https://ads.fakeexample.org/click/example_ad_2", + "impression": "incorrect-impression-url", + } + } + ], + "valid_ad": [ + { + "block_key": "abc123", + "url": "https://ads.fakeexample.org/example_ad_3", + "image_url": "https://ads.fakeexample.org/example_image_3", + "format": "skyscraper", + "alt_text": "An ad for a pet duck", + "callbacks": { + "click": "https://ads.fakeexample.org/click/example_ad_3", + "impression": "https://ads.fakeexample.org/impression/example_ad_3", + "report": "https://ads.fakeexample.org/report/example_ad_3" + } + } + ] + }); + + let parsed = + AdResponse::::parse(raw_ad_response, &MozAdsTelemetryWrapper::noop()).unwrap(); + + let expected = AdResponse { + data: HashMap::from([( + "valid_ad".to_string(), + vec![AdImage { + url: "https://ads.fakeexample.org/example_ad_3".to_string(), + image_url: "https://ads.fakeexample.org/example_image_3".to_string(), + format: "skyscraper".to_string(), + block_key: "abc123".into(), + alt_text: Some("An ad for a pet duck".to_string()), + callbacks: AdCallbacks { + click: Url::parse("https://ads.fakeexample.org/click/example_ad_3") + .unwrap(), + impression: Url::parse( + "https://ads.fakeexample.org/impression/example_ad_3", + ) + .unwrap(), + report: Some( + Url::parse("https://ads.fakeexample.org/report/example_ad_3").unwrap(), + ), + }, + }], + )]), + }; + + assert_eq!(parsed, expected); + } + + #[test] + fn test_empty_ad_response_serialization() { + let raw_ad_response = json!({ + "example_placement_1": [], + "example_placement_2": [] + }); + + let parsed = + AdResponse::::parse(raw_ad_response, &MozAdsTelemetryWrapper::noop()).unwrap(); + + let expected = AdResponse { + data: HashMap::from([]), + }; + + assert_eq!(parsed, expected); + } + + #[test] + fn test_take_first() { + let mut response = AdResponse { + data: HashMap::new(), + }; + response.data.insert( + "placement_1".to_string(), + vec![ + AdImage { + alt_text: Some("First ad".to_string()), + block_key: "key1".to_string(), + callbacks: AdCallbacks { + click: Url::parse("https://example.com/click1").unwrap(), + impression: Url::parse("https://example.com/impression1").unwrap(), + report: None, + }, + format: "billboard".to_string(), + image_url: "https://example.com/image1.png".to_string(), + url: "https://example.com/ad1".to_string(), + }, + AdImage { + alt_text: Some("Second ad".to_string()), + block_key: "key2".to_string(), + callbacks: AdCallbacks { + click: Url::parse("https://example.com/click2").unwrap(), + impression: Url::parse("https://example.com/impression2").unwrap(), + report: None, + }, + format: "billboard".to_string(), + image_url: "https://example.com/image2.png".to_string(), + url: "https://example.com/ad2".to_string(), + }, + ], + ); + response.data.insert( + "placement_2".to_string(), + vec![AdImage { + alt_text: Some("Third ad".to_string()), + block_key: "key3".to_string(), + callbacks: AdCallbacks { + click: Url::parse("https://example.com/click3").unwrap(), + impression: Url::parse("https://example.com/impression3").unwrap(), + report: None, + }, + format: "skyscraper".to_string(), + image_url: "https://example.com/image3.png".to_string(), + url: "https://example.com/ad3".to_string(), + }], + ); + response.data.insert("placement_3".to_string(), vec![]); + + let result = response.take_first(); + + assert_eq!(result.len(), 2); + assert!(result.contains_key("placement_1")); + assert!(result.contains_key("placement_2")); + assert!(!result.contains_key("placement_3")); + + let first_ad = result.get("placement_1").unwrap(); + assert_eq!(first_ad.alt_text, Some("First ad".to_string())); + assert_eq!(first_ad.block_key, "key1"); + + let second_ad = result.get("placement_2").unwrap(); + assert_eq!(second_ad.alt_text, Some("Third ad".to_string())); + assert_eq!(second_ad.block_key, "key3"); + } + + #[test] + fn test_add_request_hash_to_callbacks() { + let mut response = AdResponse { + data: HashMap::from([( + "placement_1".to_string(), + vec![AdImage { + alt_text: Some("An ad for a puppy".to_string()), + block_key: "abc123".into(), + callbacks: AdCallbacks { + click: Url::parse("https://example.com/click").unwrap(), + impression: Url::parse("https://example.com/impression").unwrap(), + report: Some(Url::parse("https://example.com/report").unwrap()), + }, + format: "billboard".to_string(), + image_url: "https://example.com/image.png".to_string(), + url: "https://example.com/ad".to_string(), + }], + )]), + }; + + let request_hash = RequestHash::from("abc123def456"); + response.add_request_hash_to_callbacks(&request_hash); + let callbacks = &response.data.values().next().unwrap()[0].callbacks; + + assert!(callbacks + .click + .query() + .unwrap_or("") + .contains("request_hash=abc123def456")); + assert!(callbacks + .impression + .query() + .unwrap_or("") + .contains("request_hash=abc123def456")); + } + + #[test] + fn test_pop_request_hash_from_url() { + let mut url_with_hash = + Url::parse("https://example.com/callback?request_hash=abc123def456&other=param") + .unwrap(); + let extracted = pop_request_hash_from_url(&mut url_with_hash); + assert_eq!(extracted, Some(RequestHash::from("abc123def456"))); + assert_eq!(url_with_hash.query(), Some("other=param")); + + let mut url_without_hash = Url::parse("https://example.com/callback?other=param").unwrap(); + let extracted_none = pop_request_hash_from_url(&mut url_without_hash); + assert_eq!(extracted_none, None); + assert_eq!(url_without_hash.query(), Some("other=param")); + + let mut url_no_query = Url::parse("https://example.com/callback").unwrap(); + let extracted_empty = pop_request_hash_from_url(&mut url_no_query); + assert_eq!(extracted_empty, None); + assert_eq!(url_no_query.query(), None); + } +} diff --git a/third_party/rust/ads-client/src/client/config.rs b/third_party/rust/ads-client/src/client/config.rs new file mode 100644 index 0000000000000..ad637b4bb5056 --- /dev/null +++ b/third_party/rust/ads-client/src/client/config.rs @@ -0,0 +1,75 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public +* 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/. +*/ + +use once_cell::sync::Lazy; +use url::Url; + +use crate::telemetry::Telemetry; + +static MARS_API_ENDPOINT_PROD: Lazy = + Lazy::new(|| Url::parse("https://ads.mozilla.org/v1/").expect("hardcoded URL must be valid")); + +#[cfg(feature = "dev")] +static MARS_API_ENDPOINT_STAGING: Lazy = + Lazy::new(|| Url::parse("https://ads.allizom.org/v1/").expect("hardcoded URL must be valid")); + +pub struct AdsClientConfig +where + T: Telemetry, +{ + pub environment: Environment, + pub cache_config: Option, + pub telemetry: T, +} + +#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] +pub enum Environment { + #[default] + Prod, + #[cfg(feature = "dev")] + Staging, + #[cfg(test)] + Test, +} + +impl Environment { + pub fn into_mars_url(self) -> Url { + match self { + Environment::Prod => MARS_API_ENDPOINT_PROD.clone(), + #[cfg(feature = "dev")] + Environment::Staging => MARS_API_ENDPOINT_STAGING.clone(), + #[cfg(test)] + Environment::Test => Url::parse(&mockito::server_url()).unwrap(), + } + } +} + +#[derive(Clone, Debug)] +pub struct AdsCacheConfig { + pub db_path: String, + pub default_cache_ttl_seconds: Option, + pub max_size_mib: Option, +} + +#[cfg(test)] +mod tests { + use url::Host; + + use super::*; + + #[test] + fn prod_endpoint_parses_and_is_expected() { + let url = Environment::Prod.into_mars_url(); + + assert_eq!(url.as_str(), "https://ads.mozilla.org/v1/"); + + assert_eq!(url.scheme(), "https"); + assert_eq!(url.host(), Some(Host::Domain("ads.mozilla.org"))); + assert_eq!(url.path(), "/v1/"); + + let url2 = Environment::Prod.into_mars_url(); + assert!(url == url2); + } +} diff --git a/third_party/rust/ads-client/src/error.rs b/third_party/rust/ads-client/src/error.rs new file mode 100644 index 0000000000000..a04128618624b --- /dev/null +++ b/third_party/rust/ads-client/src/error.rs @@ -0,0 +1,168 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public +* 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/. +*/ + +use error_support::error; +use viaduct::Response; + +#[derive(Debug, thiserror::Error)] +pub enum ComponentError { + #[error("Error requesting ads: {0}")] + RequestAds(#[from] RequestAdsError), + + #[error("Error recording a click for a placement: {0}")] + RecordClick(#[from] RecordClickError), + + #[error("Error recording an impressions for a placement: {0}")] + RecordImpression(#[from] RecordImpressionError), + + #[error("Error reporting an ad: {0}")] + ReportAd(#[from] ReportAdError), +} + +#[derive(Debug, thiserror::Error)] +pub enum RequestAdsError { + #[error("Error building ad requests from configs: {0}")] + BuildRequest(#[from] BuildRequestError), + + #[error(transparent)] + ContextId(#[from] context_id::ApiError), + + #[error("Error requesting ads from MARS: {0}")] + FetchAds(#[from] FetchAdsError), +} + +#[derive(Debug, thiserror::Error)] +pub enum BuildRequestError { + #[error("Could not build request with empty placement configs")] + EmptyConfig, + + #[error("Duplicate placement_id found: {placement_id}. Placement_ids must be unique.")] + DuplicatePlacementId { placement_id: String }, +} + +#[derive(Debug, thiserror::Error)] +pub enum FetchAdsError { + #[error("URL parse error: {0}")] + UrlParse(#[from] url::ParseError), + + #[error("Error sending request: {0}")] + Request(#[from] viaduct::ViaductError), + + #[error("JSON error: {0}")] + Json(#[from] serde_json::Error), + + #[error("Could not fetch ads, MARS responded with: {0}")] + HTTPError(#[from] HTTPError), +} + +#[derive(Debug, thiserror::Error)] +pub enum CallbackRequestError { + #[error("Could not fetch ads, MARS responded with: {0}")] + HTTPError(#[from] HTTPError), + + #[error("JSON error: {0}")] + Json(#[from] serde_json::Error), + + #[error("Invalid callback URL: {0}")] + InvalidUrl(#[from] url::ParseError), + + #[error("Error sending request: {0}")] + Request(#[from] viaduct::ViaductError), +} + +#[derive(Debug, thiserror::Error)] +pub enum RecordImpressionError { + #[error("Callback request to MARS failed: {0}")] + CallbackRequest(#[from] CallbackRequestError), +} + +#[derive(Debug, thiserror::Error)] +pub enum RecordClickError { + #[error("Callback request to MARS failed: {0}")] + CallbackRequest(#[from] CallbackRequestError), +} + +#[derive(Debug, thiserror::Error)] +pub enum ReportAdError { + #[error("Callback request to MARS failed: {0}")] + CallbackRequest(#[from] CallbackRequestError), +} + +#[derive(Debug, thiserror::Error)] +pub enum HTTPError { + #[error("Bad request ({code}): {message}")] + BadRequest { code: u16, message: String }, + + #[error("Server error ({code}): {message}")] + Server { code: u16, message: String }, + + #[error("Unexpected error ({code}): {message}")] + Unexpected { code: u16, message: String }, +} + +pub fn check_http_status_for_error(response: &Response) -> Result<(), HTTPError> { + let status = response.status; + + if status == 200 { + return Ok(()); + } + let error_message = response.text(); + let error = match status { + 400 => HTTPError::BadRequest { + code: status, + message: error_message.to_string(), + }, + 500..=599 => HTTPError::Server { + code: status, + message: error_message.to_string(), + }, + _ => HTTPError::Unexpected { + code: status, + message: error_message.to_string(), + }, + }; + Err(error) +} + +#[cfg(test)] +mod tests { + use super::*; + use url::Url; + + fn mock_response(status: u16, body: &str) -> Response { + Response { + request_method: viaduct::Method::Get, + url: Url::parse("https://example.com").unwrap(), + status, + headers: viaduct::Headers::new(), + body: body.as_bytes().to_vec(), + } + } + + #[test] + fn test_ok_status_returns_ok() { + let response = mock_response(200, "OK"); + let result = check_http_status_for_error(&response); + assert!(result.is_ok()); + } + + #[test] + fn test_bad_request_returns_http_error() { + let response = mock_response(400, "Bad input"); + let result = check_http_status_for_error(&response); + assert!( + matches!(result, Err(HTTPError::BadRequest { code, message }) if code == 400 && message == "Bad input") + ); + } + + #[test] + fn test_server_error_500() { + let response = mock_response(500, "Something broke"); + let result = check_http_status_for_error(&response); + assert!( + matches!(result, Err(HTTPError::Server { code, message }) if code == 500 && message == "Something broke") + ); + } +} diff --git a/third_party/rust/ads-client/src/ffi.rs b/third_party/rust/ads-client/src/ffi.rs new file mode 100644 index 0000000000000..992a50ab9825a --- /dev/null +++ b/third_party/rust/ads-client/src/ffi.rs @@ -0,0 +1,414 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public +* 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/. +*/ + +pub mod telemetry; + +use std::sync::Arc; + +use crate::client::ad_request::{AdContentCategory, AdPlacementRequest, IABContentTaxonomy}; +use crate::client::ad_response::{ + AdCallbacks, AdImage, AdSpoc, AdTile, SpocFrequencyCaps, SpocRanking, +}; +use crate::client::config::{AdsCacheConfig, AdsClientConfig, Environment}; +use crate::error::ComponentError; +use crate::ffi::telemetry::MozAdsTelemetryWrapper; +use crate::http_cache::{CacheMode, RequestCachePolicy}; +use error_support::{ErrorHandling, GetErrorHandling}; +use url::Url; + +pub type AdsClientApiResult = std::result::Result; + +pub use telemetry::MozAdsTelemetry; + +#[derive(Debug, thiserror::Error, uniffi::Error)] +pub enum MozAdsClientApiError { + #[error("Something unexpected occurred.")] + Other { reason: String }, +} + +impl From for MozAdsClientApiError { + fn from(err: context_id::ApiError) -> Self { + MozAdsClientApiError::Other { + reason: err.to_string(), + } + } +} + +impl GetErrorHandling for ComponentError { + type ExternalError = MozAdsClientApiError; + + fn get_error_handling(&self) -> ErrorHandling { + ErrorHandling::convert(MozAdsClientApiError::Other { + reason: self.to_string(), + }) + } +} + +#[derive(uniffi::Record)] +pub struct MozAdsRequestOptions { + pub cache_policy: Option, +} + +impl Default for MozAdsRequestOptions { + fn default() -> Self { + Self { + cache_policy: Some(MozAdsRequestCachePolicy { + mode: MozAdsCacheMode::default(), + ttl_seconds: None, + }), + } + } +} + +#[derive(Clone, Debug, PartialEq, uniffi::Record)] +pub struct MozAdsIABContent { + pub taxonomy: MozAdsIABContentTaxonomy, + pub category_ids: Vec, +} + +#[derive(Clone, Debug, PartialEq, uniffi::Record)] +pub struct MozAdsPlacementRequest { + pub placement_id: String, + pub iab_content: Option, +} + +#[derive(Clone, Debug, PartialEq, uniffi::Record)] +pub struct MozAdsPlacementRequestWithCount { + pub count: u32, + pub placement_id: String, + pub iab_content: Option, +} + +#[derive(Debug, PartialEq, uniffi::Record)] +pub struct MozAdsCallbacks { + pub click: Url, + pub impression: Url, + pub report: Option, +} + +#[derive(Default, uniffi::Record)] +pub struct MozAdsClientConfig { + pub environment: MozAdsEnvironment, + pub cache_config: Option, + pub telemetry: Option>, +} + +impl From for AdsClientConfig { + fn from(config: MozAdsClientConfig) -> Self { + let telemetry = config + .telemetry + .map(MozAdsTelemetryWrapper::new) + .unwrap_or_else(MozAdsTelemetryWrapper::noop); + Self { + environment: config.environment.into(), + cache_config: config.cache_config.map(Into::into), + telemetry, + } + } +} + +#[derive(Clone, Copy, Debug, Default, uniffi::Enum, Eq, PartialEq)] +pub enum MozAdsEnvironment { + #[default] + Prod, + #[cfg(feature = "dev")] + Staging, + #[cfg(test)] + Test, +} + +#[derive(uniffi::Record)] +pub struct MozAdsCacheConfig { + pub db_path: String, + pub default_cache_ttl_seconds: Option, + pub max_size_mib: Option, +} + +#[derive(Debug, PartialEq, uniffi::Record)] +pub struct MozAdsContentCategory { + pub taxonomy: MozAdsIABContentTaxonomy, + pub categories: Vec, +} + +#[derive(Clone, Copy, Debug, uniffi::Enum, PartialEq)] +pub enum MozAdsIABContentTaxonomy { + IAB1_0, + IAB2_0, + IAB2_1, + IAB2_2, + IAB3_0, +} + +#[derive(Clone, Copy, Debug, Default, uniffi::Record)] +pub struct MozAdsRequestCachePolicy { + pub mode: MozAdsCacheMode, + pub ttl_seconds: Option, +} + +#[derive(Clone, Copy, Debug, Default, uniffi::Enum)] +pub enum MozAdsCacheMode { + #[default] + CacheFirst, + NetworkFirst, +} + +#[derive(Debug, PartialEq, uniffi::Record)] +pub struct MozAdsImage { + pub alt_text: Option, + pub block_key: String, + pub callbacks: MozAdsCallbacks, + pub format: String, + pub image_url: String, + pub url: String, +} + +#[derive(Debug, PartialEq, uniffi::Record)] +pub struct MozAdsSpoc { + pub block_key: String, + pub callbacks: MozAdsCallbacks, + pub caps: MozAdsSpocFrequencyCaps, + pub domain: String, + pub excerpt: String, + pub format: String, + pub image_url: String, + pub ranking: MozAdsSpocRanking, + pub sponsor: String, + pub sponsored_by_override: Option, + pub title: String, + pub url: String, +} + +#[derive(Debug, PartialEq, uniffi::Record)] +pub struct MozAdsSpocFrequencyCaps { + pub cap_key: String, + pub day: u32, +} + +#[derive(Debug, PartialEq, uniffi::Record)] +pub struct MozAdsSpocRanking { + pub priority: u32, + pub personalization_models: std::collections::HashMap, + pub item_score: f64, +} + +#[derive(Debug, PartialEq, uniffi::Record)] +pub struct MozAdsTile { + pub block_key: String, + pub callbacks: MozAdsCallbacks, + pub format: String, + pub image_url: String, + pub name: String, + pub url: String, +} + +impl From for MozAdsCallbacks { + fn from(callbacks: AdCallbacks) -> Self { + Self { + click: callbacks.click, + impression: callbacks.impression, + report: callbacks.report, + } + } +} + +impl From for AdCallbacks { + fn from(callbacks: MozAdsCallbacks) -> Self { + Self { + click: callbacks.click, + impression: callbacks.impression, + report: callbacks.report, + } + } +} + +impl From for MozAdsSpocFrequencyCaps { + fn from(caps: SpocFrequencyCaps) -> Self { + Self { + cap_key: caps.cap_key, + day: caps.day, + } + } +} + +impl From for MozAdsSpocRanking { + fn from(ranking: SpocRanking) -> Self { + Self { + priority: ranking.priority, + personalization_models: ranking.personalization_models.unwrap_or_default(), + item_score: ranking.item_score, + } + } +} + +impl From for MozAdsImage { + fn from(img: AdImage) -> Self { + Self { + alt_text: img.alt_text, + block_key: img.block_key, + callbacks: img.callbacks.into(), + format: img.format, + image_url: img.image_url, + url: img.url, + } + } +} + +impl From for MozAdsSpoc { + fn from(spoc: AdSpoc) -> Self { + Self { + block_key: spoc.block_key, + callbacks: spoc.callbacks.into(), + caps: spoc.caps.into(), + domain: spoc.domain, + excerpt: spoc.excerpt, + format: spoc.format, + image_url: spoc.image_url, + ranking: spoc.ranking.into(), + sponsor: spoc.sponsor, + sponsored_by_override: spoc.sponsored_by_override, + title: spoc.title, + url: spoc.url, + } + } +} + +impl From for MozAdsTile { + fn from(tile: AdTile) -> Self { + Self { + block_key: tile.block_key, + callbacks: tile.callbacks.into(), + format: tile.format, + image_url: tile.image_url, + name: tile.name, + url: tile.url, + } + } +} + +impl From for MozAdsEnvironment { + fn from(env: Environment) -> Self { + match env { + Environment::Prod => MozAdsEnvironment::Prod, + #[cfg(feature = "dev")] + Environment::Staging => MozAdsEnvironment::Staging, + #[cfg(test)] + Environment::Test => MozAdsEnvironment::Test, + } + } +} + +impl From for Environment { + fn from(env: MozAdsEnvironment) -> Self { + match env { + MozAdsEnvironment::Prod => Environment::Prod, + #[cfg(feature = "dev")] + MozAdsEnvironment::Staging => Environment::Staging, + #[cfg(test)] + MozAdsEnvironment::Test => Environment::Test, + } + } +} + +impl From for MozAdsIABContentTaxonomy { + fn from(taxonomy: IABContentTaxonomy) -> Self { + match taxonomy { + IABContentTaxonomy::IAB1_0 => MozAdsIABContentTaxonomy::IAB1_0, + IABContentTaxonomy::IAB2_0 => MozAdsIABContentTaxonomy::IAB2_0, + IABContentTaxonomy::IAB2_1 => MozAdsIABContentTaxonomy::IAB2_1, + IABContentTaxonomy::IAB2_2 => MozAdsIABContentTaxonomy::IAB2_2, + IABContentTaxonomy::IAB3_0 => MozAdsIABContentTaxonomy::IAB3_0, + } + } +} + +impl From for IABContentTaxonomy { + fn from(taxonomy: MozAdsIABContentTaxonomy) -> Self { + match taxonomy { + MozAdsIABContentTaxonomy::IAB1_0 => IABContentTaxonomy::IAB1_0, + MozAdsIABContentTaxonomy::IAB2_0 => IABContentTaxonomy::IAB2_0, + MozAdsIABContentTaxonomy::IAB2_1 => IABContentTaxonomy::IAB2_1, + MozAdsIABContentTaxonomy::IAB2_2 => IABContentTaxonomy::IAB2_2, + MozAdsIABContentTaxonomy::IAB3_0 => IABContentTaxonomy::IAB3_0, + } + } +} + +impl From for RequestCachePolicy { + fn from(policy: MozAdsRequestCachePolicy) -> Self { + Self { + mode: policy.mode.into(), + ttl_seconds: policy.ttl_seconds, + } + } +} + +impl From for MozAdsCacheMode { + fn from(mode: CacheMode) -> Self { + match mode { + CacheMode::CacheFirst => MozAdsCacheMode::CacheFirst, + CacheMode::NetworkFirst => MozAdsCacheMode::NetworkFirst, + } + } +} + +impl From for CacheMode { + fn from(mode: MozAdsCacheMode) -> Self { + match mode { + MozAdsCacheMode::CacheFirst => CacheMode::CacheFirst, + MozAdsCacheMode::NetworkFirst => CacheMode::NetworkFirst, + } + } +} + +impl From<&MozAdsIABContent> for AdContentCategory { + fn from(content: &MozAdsIABContent) -> Self { + Self { + taxonomy: content.taxonomy.into(), + categories: content.category_ids.clone(), + } + } +} + +impl From for RequestCachePolicy { + fn from(options: MozAdsRequestOptions) -> Self { + options.cache_policy.map(Into::into).unwrap_or_default() + } +} + +impl From> for RequestCachePolicy { + fn from(options: Option) -> Self { + options.map(Into::into).unwrap_or_default() + } +} + +impl From for AdsCacheConfig { + fn from(config: MozAdsCacheConfig) -> Self { + Self { + db_path: config.db_path, + default_cache_ttl_seconds: config.default_cache_ttl_seconds, + max_size_mib: config.max_size_mib, + } + } +} + +impl From<&MozAdsPlacementRequest> for AdPlacementRequest { + fn from(request: &MozAdsPlacementRequest) -> Self { + Self { + placement: request.placement_id.clone(), + count: 1, + content: request.iab_content.as_ref().map(Into::into), + } + } +} + +impl From<&MozAdsPlacementRequestWithCount> for AdPlacementRequest { + fn from(request: &MozAdsPlacementRequestWithCount) -> Self { + Self { + placement: request.placement_id.clone(), + count: request.count, + content: request.iab_content.as_ref().map(Into::into), + } + } +} diff --git a/third_party/rust/ads-client/src/ffi/telemetry.rs b/third_party/rust/ads-client/src/ffi/telemetry.rs new file mode 100644 index 0000000000000..cf6b9af6ceda5 --- /dev/null +++ b/third_party/rust/ads-client/src/ffi/telemetry.rs @@ -0,0 +1,142 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public +* 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/. +*/ + +use std::any::Any; +use std::sync::Arc; + +use crate::client::ClientOperationEvent; +use crate::error::{RecordClickError, RecordImpressionError, ReportAdError, RequestAdsError}; +use crate::http_cache::{CacheOutcome, HttpCacheBuilderError}; +use crate::telemetry::Telemetry; + +#[uniffi::export(with_foreign)] +pub trait MozAdsTelemetry: Send + Sync { + fn record_build_cache_error(&self, label: String, value: String); + fn record_client_error(&self, label: String, value: String); + fn record_client_operation_total(&self, label: String); + fn record_deserialization_error(&self, label: String, value: String); + fn record_http_cache_outcome(&self, label: String, value: String); +} + +pub struct NoopMozAdsTelemetry; + +impl MozAdsTelemetry for NoopMozAdsTelemetry { + fn record_build_cache_error(&self, _label: String, _value: String) {} + fn record_client_error(&self, _label: String, _value: String) {} + fn record_client_operation_total(&self, _label: String) {} + fn record_deserialization_error(&self, _label: String, _value: String) {} + fn record_http_cache_outcome(&self, _label: String, _value: String) {} +} + +#[derive(Clone)] +pub struct MozAdsTelemetryWrapper { + inner: Arc, +} + +impl MozAdsTelemetryWrapper { + pub fn new(inner: Arc) -> Self { + Self { inner } + } + + pub fn noop() -> Self { + Self { + inner: Arc::new(NoopMozAdsTelemetry), + } + } +} + +impl Telemetry for MozAdsTelemetryWrapper { + fn record(&self, event: &dyn Any) { + if let Some(cache_outcome) = event.downcast_ref::() { + self.inner.record_http_cache_outcome( + match cache_outcome { + CacheOutcome::Hit => "hit".to_string(), + CacheOutcome::LookupFailed(_) => "lookup_failed".to_string(), + CacheOutcome::NoCache => "no_cache".to_string(), + CacheOutcome::MissNotCacheable => "miss_not_cacheable".to_string(), + CacheOutcome::MissStored => "miss_stored".to_string(), + CacheOutcome::StoreFailed(_) => "store_failed".to_string(), + CacheOutcome::CleanupFailed(_) => "cleanup_failed".to_string(), + }, + match cache_outcome { + CacheOutcome::LookupFailed(e) => e.to_string(), + CacheOutcome::StoreFailed(e) => e.to_string(), + CacheOutcome::CleanupFailed(e) => e.to_string(), + _ => "".to_string(), + }, + ); + return; + } + if let Some(client_op) = event.downcast_ref::() { + self.inner.record_client_operation_total(match client_op { + ClientOperationEvent::New => "new".to_string(), + ClientOperationEvent::RecordClick => "record_click".to_string(), + ClientOperationEvent::RecordImpression => "record_impression".to_string(), + ClientOperationEvent::ReportAd => "report_ad".to_string(), + ClientOperationEvent::RequestAds => "request_ads".to_string(), + }); + return; + } + if let Some(cache_builder_error) = event.downcast_ref::() { + self.inner.record_build_cache_error( + match cache_builder_error { + HttpCacheBuilderError::EmptyDbPath => "empty_db_path".to_string(), + HttpCacheBuilderError::Database(_) => "database_error".to_string(), + HttpCacheBuilderError::InvalidMaxSize { .. } => "invalid_max_size".to_string(), + HttpCacheBuilderError::InvalidTtl { .. } => "invalid_ttl".to_string(), + }, + format!("{}", cache_builder_error), + ); + return; + } + if let Some(record_click_error) = event.downcast_ref::() { + self.inner.record_client_error( + "record_click".to_string(), + format!("{}", record_click_error), + ); + return; + } + if let Some(record_impression_error) = event.downcast_ref::() { + self.inner.record_client_error( + "record_impression".to_string(), + format!("{}", record_impression_error), + ); + return; + } + if let Some(report_ad_error) = event.downcast_ref::() { + self.inner + .record_client_error("report_ad".to_string(), format!("{}", report_ad_error)); + return; + } + if let Some(request_ads_error) = event.downcast_ref::() { + self.inner + .record_client_error("request_ads".to_string(), format!("{}", request_ads_error)); + return; + } + if let Some(json_error) = event.downcast_ref::() { + self.inner.record_deserialization_error( + "invalid_ad_item".to_string(), + format!("{}", json_error), + ); + return; + } + eprintln!("Unsupported telemetry event type: {:?}", event.type_id()); + #[cfg(test)] + panic!("Unsupported telemetry event type: {:?}", event.type_id()); + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + #[should_panic] + fn test_panic_on_unsupported_event() { + struct UnsupportedEvent; + let telemetry = MozAdsTelemetryWrapper::noop(); + telemetry.record(&UnsupportedEvent); + } +} diff --git a/third_party/rust/ads-client/src/http_cache.rs b/third_party/rust/ads-client/src/http_cache.rs new file mode 100644 index 0000000000000..a38bea2db6435 --- /dev/null +++ b/third_party/rust/ads-client/src/http_cache.rs @@ -0,0 +1,540 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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 builder; +mod bytesize; +mod cache_control; +mod clock; +mod connection_initializer; +mod request_hash; +mod store; + +use self::{builder::HttpCacheBuilder, cache_control::CacheControl, store::HttpCacheStore}; + +use viaduct::{Request, Response}; + +pub use self::builder::HttpCacheBuilderError; +pub use self::bytesize::ByteSize; +pub use self::request_hash::RequestHash; +use std::cmp; +use std::path::Path; +use std::time::Duration; + +pub type HttpCacheSendResult = std::result::Result; + +#[derive(Clone, Copy, Debug, Default)] +pub struct RequestCachePolicy { + pub mode: CacheMode, + pub ttl_seconds: Option, // optional client-defined ttl override +} + +#[derive(Clone, Copy, Debug, Default)] +pub enum CacheMode { + #[default] + CacheFirst, + NetworkFirst, +} + +impl CacheMode { + pub fn execute( + &self, + cache: &HttpCache, + request: &Request, + ttl: &Duration, + ) -> HttpCacheSendResult { + match self { + CacheMode::CacheFirst => self.exec_cache_first(cache, request, ttl), + CacheMode::NetworkFirst => self.exec_network_first(cache, request, ttl), + } + } + + fn exec_cache_first( + &self, + cache: &HttpCache, + request: &Request, + ttl: &Duration, + ) -> HttpCacheSendResult { + match cache.store.lookup(request) { + Ok(Some((resp, _))) => Ok(SendOutcome { + response: resp, + cache_outcome: CacheOutcome::Hit, + }), + Ok(None) => cache.request_from_network_then_cache(request, ttl), + Err(e) => { + let response = request.clone().send()?; + Ok(SendOutcome { + response, + cache_outcome: CacheOutcome::LookupFailed(e), + }) + } + } + } + + fn exec_network_first( + &self, + cache: &HttpCache, + request: &Request, + ttl: &Duration, + ) -> HttpCacheSendResult { + cache.request_from_network_then_cache(request, ttl) + } +} + +#[derive(Debug, thiserror::Error)] +pub enum HttpCacheError { + #[error("Could not build cache: {0}")] + Builder(#[from] builder::HttpCacheBuilderError), + + #[error("SQLite operation failed: {0}")] + Sqlite(#[from] rusqlite::Error), +} + +#[derive(Debug)] +pub enum CacheOutcome { + Hit, + LookupFailed(rusqlite::Error), // cache miss path due to lookup error + NoCache, // send policy requested a cache bypass + MissNotCacheable, // policy says "don't store" + MissStored, // stored successfully + StoreFailed(HttpCacheError), // insert/upsert failed + CleanupFailed(HttpCacheError), // cleaning expired objects failed +} + +pub struct SendOutcome { + pub response: Response, + pub cache_outcome: CacheOutcome, +} + +pub struct HttpCache { + max_size: ByteSize, + store: HttpCacheStore, + default_ttl: Duration, +} + +impl HttpCache { + pub fn builder>(db_path: P) -> HttpCacheBuilder { + HttpCacheBuilder::new(db_path.as_ref()) + } + + pub fn clear(&self) -> Result<(), HttpCacheError> { + self.store.clear_all().map_err(HttpCacheError::from)?; + Ok(()) + } + + pub fn invalidate_by_hash(&self, request_hash: &RequestHash) -> Result<(), HttpCacheError> { + self.store + .invalidate_by_hash(request_hash) + .map_err(HttpCacheError::from)?; + Ok(()) + } + + pub fn send_with_policy( + &self, + request: &Request, + request_policy: &RequestCachePolicy, + ) -> HttpCacheSendResult { + let request_policy_ttl = match request_policy.ttl_seconds { + Some(s) => Duration::new(s, 0), + None => self.default_ttl, + }; + + request_policy + .mode + .execute(self, request, &request_policy_ttl) + } + + fn request_from_network_then_cache( + &self, + request: &Request, + request_policy_ttl: &Duration, + ) -> HttpCacheSendResult { + let response = request.clone().send()?; + if let Err(e) = self.store.delete_expired_entries() { + return Ok(SendOutcome { + response, + cache_outcome: CacheOutcome::CleanupFailed(e.into()), + }); + } + let cache_control = CacheControl::from(&response); + let cache_outcome = if cache_control.should_cache() { + let response_ttl = match cache_control.max_age { + Some(s) => Duration::new(s, 0), + None => self.default_ttl, + }; + + // We respect the smallest ttl between the policy, default client value, or header + let final_ttl = cmp::min( + cmp::min(*request_policy_ttl, self.default_ttl), + response_ttl, + ); + + if final_ttl.as_secs() == 0 { + return Ok(SendOutcome { + response, + cache_outcome: CacheOutcome::NoCache, + }); + } + + match self.cache_object(request, &response, &final_ttl) { + Ok(()) => CacheOutcome::MissStored, + Err(e) => CacheOutcome::StoreFailed(e), + } + } else { + CacheOutcome::MissNotCacheable + }; + + Ok(SendOutcome { + response, + cache_outcome, + }) + } + + fn cache_object( + &self, + request: &Request, + response: &Response, + ttl: &Duration, + ) -> Result<(), HttpCacheError> { + self.store.store_with_ttl(request, response, ttl)?; + self.store.trim_to_max_size(self.max_size.as_u64() as i64)?; + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use mockito::mock; + + use super::*; + + fn make_post_request() -> Request { + let url = format!("{}/ads", mockito::server_url()).parse().unwrap(); + Request::post(url).json(&serde_json::json!({"fake":"data"})) + } + + fn make_cache() -> HttpCache { + // Our store opens an in-memory cache for tests. So the name is irrelevant. + HttpCache::builder("ignored_in_tests.db") + .default_ttl(Duration::from_secs(60)) + .max_size(ByteSize::mib(1)) + .build() + .expect("cache build should succeed") + } + + fn make_cache_with_ttl(secs: u64) -> HttpCache { + // In tests our store uses an in-memory DB; filename is irrelevant. + HttpCache::builder("ignored_in_tests.db") + .default_ttl(Duration::from_secs(secs)) + .max_size(ByteSize::mib(4)) + .build_for_time_dependent_tests() + .expect("cache build should succeed") + } + + #[test] + fn test_http_cache_creation() { + // Test that HttpCache can be created successfully with test config + let cache = HttpCache::builder("test_cache.db").build(); + assert!(cache.is_ok()); + + // Test with custom config + let cache_with_config = HttpCache::builder("custom_test.db") + .max_size(ByteSize::mib(1)) + .default_ttl(Duration::from_secs(60)) + .build(); + assert!(cache_with_config.is_ok()); + } + + #[test] + fn test_clear_cache() { + let cache = HttpCache::builder("test_clear.db").build().unwrap(); + + // Create a test request and response + let request = viaduct::Request { + method: viaduct::Method::Get, + url: "https://example.com/test".parse().unwrap(), + headers: viaduct::Headers::new(), + body: None, + }; + + let response = viaduct::Response { + request_method: viaduct::Method::Get, + url: "https://example.com/test".parse().unwrap(), + status: 200, + headers: viaduct::Headers::new(), + body: b"test response".to_vec(), + }; + + // Store something in the cache + cache + .store + .store_with_ttl(&request, &response, &Duration::new(300, 0)) + .unwrap(); + + // Verify it's cached + let retrieved = cache.store.lookup(&request).unwrap(); + assert!(retrieved.is_some()); + + // Clear the cache + cache.clear().unwrap(); + + // Verify it's cleared + let retrieved_after_clear = cache.store.lookup(&request).unwrap(); + assert!(retrieved_after_clear.is_none()); + } + + #[test] + fn test_default_policy_miss_then_store_then_hit() { + viaduct_dev::init_backend_dev(); + + let body = r#"{"ok":true}"#; + let _m = mock("POST", "/ads") + .with_status(200) + .with_header("content-type", "application/json") + .with_body(body) + .expect(1) // only the first call should hit the network + .create(); + + let cache = make_cache(); + let req = make_post_request(); + + // First call: miss -> store + let o1 = cache + .send_with_policy(&req.clone(), &RequestCachePolicy::default()) + .unwrap(); + matches!(o1.cache_outcome, CacheOutcome::MissStored); + + // Second call: hit (no extra HTTP request due to expect(1)) + let o2 = cache + .send_with_policy(&req, &RequestCachePolicy::default()) + .unwrap(); + matches!(o2.cache_outcome, CacheOutcome::Hit); + assert_eq!(o2.response.status, 200); + } + + #[test] + fn test_refresh_policy_always_uses_network_then_caches() { + viaduct_dev::init_backend_dev(); + + let body1 = r#"{"ok":true,"n":1}"#; + let body2 = r#"{"ok":true,"n":2}"#; + // Two live responses expected on refresh + let _m1 = mock("POST", "/ads") + .with_status(200) + .with_header("content-type", "application/json") + .with_body(body1) + .create(); + let _m2 = mock("POST", "/ads") + .with_status(200) + .with_header("content-type", "application/json") + .with_body(body2) + .create(); + + let cache = make_cache(); + let req = make_post_request(); + + // First refresh: live -> MissStored + let o1 = cache + .send_with_policy( + &req.clone(), + &RequestCachePolicy { + mode: CacheMode::NetworkFirst, + ttl_seconds: None, + }, + ) + .unwrap(); + matches!(o1.cache_outcome, CacheOutcome::MissStored); + + // Second refresh: live again (different body), still MissStored + let o2 = cache + .send_with_policy( + &req, + &RequestCachePolicy { + mode: CacheMode::NetworkFirst, + ttl_seconds: None, + }, + ) + .unwrap(); + matches!(o2.cache_outcome, CacheOutcome::MissStored); + assert_eq!(o2.response.status, 200); + } + + #[test] + fn test_not_cacheable_no_store() { + viaduct_dev::init_backend_dev(); + + let _m = mock("POST", "/ads") + .with_status(200) + .with_header("content-type", "application/json") + .with_header("cache-control", "no-store") // should block caching + .with_body(r#"{"ok":true}"#) + .expect(1) + .create(); + + let cache = make_cache(); + let req = make_post_request(); + + let o = cache + .send_with_policy(&req.clone(), &RequestCachePolicy::default()) + .unwrap(); + matches!(o.cache_outcome, CacheOutcome::MissNotCacheable); + + // Next call should hit network again (since we didn't cache) + let _m2 = mock("POST", "/ads") + .with_status(200) + .with_header("content-type", "application/json") + .with_body(r#"{"ok":true}"#) + .expect(1) + .create(); + let o2 = cache + .send_with_policy(&req, &RequestCachePolicy::default()) + .unwrap(); + // Either MissStored (if headers differ) or MissNotCacheable if still no-store + assert!(matches!( + o2.cache_outcome, + CacheOutcome::MissStored | CacheOutcome::MissNotCacheable + )); + } + + #[test] + fn ttl_resolution_min_of_server_request_default() { + viaduct_dev::init_backend_dev(); + + let _m = mockito::mock("POST", "/ads") + .with_status(200) + .with_header("content-type", "application/json") + .with_header("cache-control", "max-age=1") // Set max age to 1 second + .with_body(r#"{"ok":true}"#) + .expect(1) + .create(); + + let cache = make_cache_with_ttl(300); + let req = make_post_request(); + let policy = RequestCachePolicy { + mode: CacheMode::CacheFirst, + ttl_seconds: Some(20), // 20 second ttl specified vs the cache's default of 300s + }; + + // Store ttl should resolve to 1s as specified by response headers + let out = cache.send_with_policy(&req, &policy).unwrap(); + assert!(matches!(out.cache_outcome, CacheOutcome::MissStored)); + + // After ~>1s, cleanup should remove it + cache.store.get_clock().advance(2); + + cache.store.delete_expired_entries().unwrap(); + + assert!(cache.store.lookup(&req).unwrap().is_none()); + } + + #[test] + fn ttl_resolution_request_overrides_default_when_smaller() { + viaduct_dev::init_backend_dev(); + + let _m = mockito::mock("POST", "/ads") + .with_status(200) + .with_header("content-type", "application/json") + .with_body(r#"{"ok":true}"#) + .expect(1) + .create(); + + let cache = make_cache_with_ttl(60); + let req = make_post_request(); + let policy = RequestCachePolicy { + mode: CacheMode::CacheFirst, + ttl_seconds: Some(2), + }; + + // Store with effective TTL = 2s + let out = cache.send_with_policy(&req, &policy).unwrap(); + assert!(matches!(out.cache_outcome, CacheOutcome::MissStored)); + + // Not expired yet at ~1s + cache.store.get_clock().advance(1); + cache.store.delete_expired_entries().unwrap(); + assert!(cache.store.lookup(&req).unwrap().is_some()); + + // Expired after ~2s + cache.store.get_clock().advance(2); + cache.store.delete_expired_entries().unwrap(); + assert!(cache.store.lookup(&req).unwrap().is_none()); + } + + #[test] + fn ttl_resolution_uses_default_when_no_server_and_no_request_override() { + viaduct_dev::init_backend_dev(); + + let _m = mockito::mock("POST", "/ads") + .with_status(200) + .with_header("content-type", "application/json") // No response policy ttl + .with_body(r#"{"ok":true}"#) + .expect(1) + .create(); + + let cache = make_cache_with_ttl(2); + let req = make_post_request(); + let policy = RequestCachePolicy::default(); // No request polity ttl + + // Store with effective TTL = 1s from client + let out = cache.send_with_policy(&req, &policy).unwrap(); + assert!(matches!(out.cache_outcome, CacheOutcome::MissStored)); + + // Not expired at ~1s + cache.store.get_clock().advance(1); + cache.store.delete_expired_entries().unwrap(); + assert!(cache.store.lookup(&req).unwrap().is_some()); + + // Expired after ~3s + cache.store.get_clock().advance(3); + cache.store.delete_expired_entries().unwrap(); + assert!(cache.store.lookup(&req).unwrap().is_none()); + } + + #[test] + fn test_invalidate_by_hash() { + use crate::http_cache::request_hash::RequestHash; + + let cache = HttpCache::builder("test_invalidate.db").build().unwrap(); + + let request1 = viaduct::Request { + method: viaduct::Method::Post, + url: "https://example.com/api1".parse().unwrap(), + headers: viaduct::Headers::new(), + body: Some(b"body1".to_vec()), + }; + + let request2 = viaduct::Request { + method: viaduct::Method::Post, + url: "https://example.com/api2".parse().unwrap(), + headers: viaduct::Headers::new(), + body: Some(b"body2".to_vec()), + }; + + let response = viaduct::Response { + request_method: viaduct::Method::Post, + url: "https://example.com/test".parse().unwrap(), + status: 200, + headers: viaduct::Headers::new(), + body: b"test response".to_vec(), + }; + + cache + .store + .store_with_ttl(&request1, &response, &Duration::new(300, 0)) + .unwrap(); + + cache + .store + .store_with_ttl(&request2, &response, &Duration::new(300, 0)) + .unwrap(); + + assert!(cache.store.lookup(&request1).unwrap().is_some()); + assert!(cache.store.lookup(&request2).unwrap().is_some()); + + let hash1 = RequestHash::from(&request1); + cache.invalidate_by_hash(&hash1).unwrap(); + + assert!(cache.store.lookup(&request1).unwrap().is_none()); + assert!(cache.store.lookup(&request2).unwrap().is_some()); + } +} diff --git a/third_party/rust/ads-client/src/http_cache/builder.rs b/third_party/rust/ads-client/src/http_cache/builder.rs new file mode 100644 index 0000000000000..9c6c8c9a8748d --- /dev/null +++ b/third_party/rust/ads-client/src/http_cache/builder.rs @@ -0,0 +1,263 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +use crate::http_cache::HttpCache; + +use super::bytesize::ByteSize; +use super::connection_initializer::HttpCacheConnectionInitializer; +use super::store::HttpCacheStore; +use rusqlite::Connection; +use sql_support::open_database; +use std::path::PathBuf; +use std::time::Duration; + +const DEFAULT_MAX_SIZE: ByteSize = ByteSize::mib(10); +const DEFAULT_TTL: Duration = Duration::from_secs(300); + +const MIN_CACHE_SIZE: ByteSize = ByteSize::kib(1); +const MAX_CACHE_SIZE: ByteSize = ByteSize::mib(100); +const MIN_TTL: Duration = Duration::from_secs(1); +const MAX_TTL: Duration = Duration::from_secs(60 * 60 * 24 * 7); // 7 days + +#[derive(Debug, thiserror::Error)] +pub enum HttpCacheBuilderError { + #[error("Database path cannot be empty")] + EmptyDbPath, + #[error("Database error: {0}")] + Database(#[from] open_database::Error), + #[error( + "Maximum cache size must be between {min_size} and {max_size}, got {size_bytes} bytes" + )] + InvalidMaxSize { + max_size: String, + min_size: String, + size_bytes: u64, + }, + #[error("TTL must be between {min_ttl} and {max_ttl}, got {ttl} seconds")] + InvalidTtl { + max_ttl: String, + min_ttl: String, + ttl: u64, + }, +} + +#[derive(Debug)] +pub struct HttpCacheBuilder { + db_path: PathBuf, + max_size: Option, + default_ttl: Option, +} + +impl HttpCacheBuilder { + pub fn new(db_path: impl Into) -> Self { + Self { + db_path: db_path.into(), + max_size: None, + default_ttl: None, + } + } + + #[cfg(test)] + pub fn new_for_tests(db_path: impl Into) -> Self { + Self { + db_path: db_path.into(), + max_size: None, + default_ttl: None, + } + } + + pub fn max_size(mut self, max_size: ByteSize) -> Self { + self.max_size = Some(max_size); + self + } + + pub fn default_ttl(mut self, ttl: Duration) -> Self { + self.default_ttl = Some(ttl); + self + } + + fn validate(&self) -> Result<(), HttpCacheBuilderError> { + if self.db_path.to_string_lossy().trim().is_empty() { + return Err(HttpCacheBuilderError::EmptyDbPath); + } + + if let Some(max_size) = self.max_size { + if max_size < MIN_CACHE_SIZE || max_size > MAX_CACHE_SIZE { + return Err(HttpCacheBuilderError::InvalidMaxSize { + size_bytes: max_size.as_u64(), + min_size: MIN_CACHE_SIZE.to_string(), + max_size: MAX_CACHE_SIZE.to_string(), + }); + } + } + + if let Some(ttl) = self.default_ttl { + if !(MIN_TTL..=MAX_TTL).contains(&ttl) { + return Err(HttpCacheBuilderError::InvalidTtl { + ttl: ttl.as_secs(), + min_ttl: format!("{} seconds", MIN_TTL.as_secs()), + max_ttl: format!("{} seconds", MAX_TTL.as_secs()), + }); + } + } + + Ok(()) + } + + fn open_connection(&self) -> Result { + let initializer = HttpCacheConnectionInitializer {}; + let conn = if cfg!(test) { + open_database::open_memory_database(&initializer)? + } else { + open_database::open_database(&self.db_path, &initializer)? + }; + Ok(conn) + } + + pub fn build(&self) -> Result { + self.validate()?; + + let conn = self.open_connection()?; + let max_size = self.max_size.unwrap_or(DEFAULT_MAX_SIZE); + let store = HttpCacheStore::new(conn); + let default_ttl = self.default_ttl.unwrap_or(DEFAULT_TTL); + + Ok(HttpCache { + max_size, + store, + default_ttl, + }) + } + + #[cfg(test)] + pub fn build_for_time_dependent_tests(&self) -> Result { + self.validate()?; + + let conn = self.open_connection()?; + let max_size = self.max_size.unwrap_or(DEFAULT_MAX_SIZE); + let store = HttpCacheStore::new_with_test_clock(conn); + let default_ttl = self.default_ttl.unwrap_or(DEFAULT_TTL); + + Ok(HttpCache { + max_size, + store, + default_ttl, + }) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_cache_builder_with_defaults() { + let builder = HttpCacheBuilder::new("test.db".to_string()); + assert_eq!(builder.db_path, PathBuf::from("test.db")); + assert_eq!(builder.max_size, None); + assert_eq!(builder.default_ttl, None); + assert!(builder.build().is_ok()); + } + + #[test] + fn test_cache_builder_valid_custom() { + let builder = HttpCacheBuilder::new("custom.db".to_string()) + .max_size(ByteSize::b(1024)) + .default_ttl(Duration::from_secs(60)); + + assert_eq!(builder.db_path, PathBuf::from("custom.db")); + assert_eq!(builder.max_size, Some(ByteSize::b(1024))); + assert_eq!(builder.default_ttl, Some(Duration::from_secs(60))); + assert!(builder.build().is_ok()); + } + + #[test] + fn test_validation_empty_db_path() { + let builder = HttpCacheBuilder::new(" ".to_string()); + + let result = builder.build(); + assert!(matches!(result, Err(HttpCacheBuilderError::EmptyDbPath))); + } + + #[test] + fn test_validation_max_size_too_small() { + let builder = HttpCacheBuilder::new("test.db".to_string()).max_size(ByteSize::b(512)); + + let result = builder.build(); + assert!(matches!( + result, + Err(HttpCacheBuilderError::InvalidMaxSize { + size_bytes: 512, + min_size: _, + max_size: _, + }) + )); + } + + #[test] + fn test_validation_max_size_too_large() { + let builder = HttpCacheBuilder::new("test.db".to_string()) + .max_size(ByteSize::b(2 * 1024 * 1024 * 1024)); + + let result = builder.build(); + assert!(matches!( + result, + Err(HttpCacheBuilderError::InvalidMaxSize { + size_bytes: 2147483648, + min_size: _, + max_size: _, + }) + )); + } + + #[test] + fn test_validation_max_size_boundaries() { + let builder_min = HttpCacheBuilder::new("test.db".to_string()).max_size(MIN_CACHE_SIZE); + assert!(builder_min.build().is_ok()); + + let builder_max = HttpCacheBuilder::new("test.db".to_string()).max_size(MAX_CACHE_SIZE); + assert!(builder_max.build().is_ok()); + } + + #[test] + fn test_validation_ttl_too_small() { + let builder = + HttpCacheBuilder::new("test.db".to_string()).default_ttl(Duration::from_secs(0)); + + let result = builder.build(); + assert!(matches!( + result, + Err(HttpCacheBuilderError::InvalidTtl { + ttl: 0, + min_ttl: _, + max_ttl: _, + }) + )); + } + + #[test] + fn test_validation_ttl_too_large() { + let builder = HttpCacheBuilder::new("test.db".to_string()) + .default_ttl(Duration::from_secs(8 * 24 * 60 * 60)); + + let result = builder.build(); + assert!(matches!( + result, + Err(HttpCacheBuilderError::InvalidTtl { + ttl: 691200, + min_ttl: _, + max_ttl: _, + }) + )); + } + + #[test] + fn test_validation_ttl_boundaries() { + let builder_min = HttpCacheBuilder::new("test.db".to_string()).default_ttl(MIN_TTL); + assert!(builder_min.build().is_ok()); + + let builder_max = HttpCacheBuilder::new("test.db".to_string()).default_ttl(MAX_TTL); + assert!(builder_max.build().is_ok()); + } +} diff --git a/third_party/rust/ads-client/src/http_cache/bytesize.rs b/third_party/rust/ads-client/src/http_cache/bytesize.rs new file mode 100644 index 0000000000000..8c29f8f381c78 --- /dev/null +++ b/third_party/rust/ads-client/src/http_cache/bytesize.rs @@ -0,0 +1,110 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +use std::fmt; +use std::ops; + +#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)] +pub struct ByteSize(u64); + +impl ByteSize { + pub const fn b(value: u64) -> Self { + Self(value) + } + + pub const fn kib(value: u64) -> Self { + Self(Self::b(1024).0.saturating_mul(value)) + } + + pub const fn mib(value: u64) -> Self { + Self(Self::kib(1024).0.saturating_mul(value)) + } + + pub const fn as_u64(&self) -> u64 { + self.0 + } +} + +impl ops::Mul for ByteSize { + type Output = Self; + + fn mul(self, rhs: u64) -> Self::Output { + Self(self.0.saturating_mul(rhs)) + } +} + +impl fmt::Display for ByteSize { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let bytes_u64 = self.0; + if bytes_u64 >= 1024 * 1024 { + write!(f, "{} MB", bytes_u64 / (1024 * 1024)) + } else if bytes_u64 >= 1024 { + write!(f, "{} KB", bytes_u64 / 1024) + } else { + write!(f, "{} bytes", bytes_u64) + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_byte_size_constructors() { + assert_eq!(ByteSize::b(1024).as_u64(), 1024); + assert_eq!(ByteSize::mib(1).as_u64(), 1024 * 1024); + assert_eq!(ByteSize::mib(10).as_u64(), 10 * 1024 * 1024); + } + + #[test] + fn test_byte_size_overflow() { + assert_eq!(ByteSize::mib(u64::MAX).as_u64(), u64::MAX); + } + + #[test] + fn test_byte_size_display() { + assert_eq!(ByteSize::b(512).to_string(), "512 bytes"); + assert_eq!(ByteSize::kib(1).to_string(), "1 KB"); + assert_eq!(ByteSize::kib(1024).to_string(), "1 MB"); + assert_eq!(ByteSize::mib(1).to_string(), "1 MB"); + assert_eq!(ByteSize::mib(100).to_string(), "100 MB"); + } + + #[test] + fn test_byte_size_comparison() { + let small = ByteSize::b(1024); + let medium = ByteSize::kib(1); + let large = ByteSize::mib(1); + + assert_eq!(small, medium); + assert!(small < large); + assert!(large > small); + assert!(small <= medium); + assert!(large >= small); + assert!(small != large); + } + + #[test] + fn test_byte_size_ordering() { + let sizes = vec![ + ByteSize::mib(10), + ByteSize::b(100), + ByteSize::kib(5), + ByteSize::mib(1), + ]; + let mut sorted = sizes.clone(); + sorted.sort(); + + assert_eq!( + sorted, + vec![ + ByteSize::b(100), + ByteSize::kib(5), + ByteSize::mib(1), + ByteSize::mib(10), + ] + ); + } +} diff --git a/third_party/rust/ads-client/src/http_cache/cache_control.rs b/third_party/rust/ads-client/src/http_cache/cache_control.rs new file mode 100644 index 0000000000000..c2f0fe7e85b48 --- /dev/null +++ b/third_party/rust/ads-client/src/http_cache/cache_control.rs @@ -0,0 +1,99 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +use serde::{Deserialize, Serialize}; +use viaduct::{header_names, Response}; + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct CacheControl { + pub max_age: Option, + pub must_revalidate: bool, + pub no_cache: bool, + pub no_store: bool, + pub private: bool, +} + +impl From<&Response> for CacheControl { + fn from(response: &Response) -> Self { + let mut cache_control = Self { + max_age: None, + must_revalidate: false, + no_cache: false, + no_store: false, + private: false, + }; + + if let Some(header) = response.headers.get(header_names::CACHE_CONTROL) { + for directive in header.split(',').map(|s| s.trim()) { + match directive { + "must-revalidate" => cache_control.must_revalidate = true, + "no-cache" => cache_control.no_cache = true, + "no-store" => cache_control.no_store = true, + "private" => cache_control.private = true, + s if s.starts_with("max-age=") => { + if let Some(age_str) = s.strip_prefix("max-age=") { + cache_control.max_age = age_str.parse().ok(); + } + } + _ => {} + } + } + } + + cache_control + } +} + +impl CacheControl { + pub fn should_cache(&self) -> bool { + !self.no_store + } +} + +#[cfg(test)] +mod tests { + use super::*; + use viaduct::{Headers, Method}; + + fn from_header(header: Option<&str>) -> CacheControl { + let mut headers = Headers::new(); + if let Some(header) = header { + headers.insert(header_names::CACHE_CONTROL, header).unwrap(); + } + CacheControl::from(&Response { + body: b"".to_vec(), + headers, + request_method: Method::Get, + status: 200, + url: "https://example.com".parse().unwrap(), + }) + } + + #[test] + fn test_cache_control_parsing() { + // Test max-age + let directives = from_header(Some("max-age=3600")); + assert_eq!(directives.max_age, Some(3600)); + assert!(!directives.no_cache); + assert!(!directives.no_store); + + // Test no-cache and no-store + let directives = from_header(Some("no-cache, no-store")); + assert!(directives.no_cache); + assert!(directives.no_store); + + // Test multiple directives + let directives = from_header(Some("max-age=1800, must-revalidate, private")); + assert_eq!(directives.max_age, Some(1800)); + assert!(directives.must_revalidate); + assert!(directives.private); + + // Test empty header + let directives = from_header(None); + assert_eq!(directives.max_age, None); + assert!(!directives.no_cache); + assert!(!directives.no_store); + assert!(directives.should_cache()); + } +} diff --git a/third_party/rust/ads-client/src/http_cache/clock.rs b/third_party/rust/ads-client/src/http_cache/clock.rs new file mode 100644 index 0000000000000..778a5ce7c96f0 --- /dev/null +++ b/third_party/rust/ads-client/src/http_cache/clock.rs @@ -0,0 +1,51 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +pub trait Clock: Send + Sync + 'static { + fn now_epoch_seconds(&self) -> i64; + #[cfg(test)] + fn advance(&self, secs: i64); +} + +pub struct CacheClock; + +impl Clock for CacheClock { + fn now_epoch_seconds(&self) -> i64 { + chrono::Utc::now().timestamp() + } + #[cfg(test)] + fn advance(&self, _secs: i64) { + panic!( + " + You cannot advance a non-test clock. + Be sure to build the cache or store with the test clock for time-dependent tests. + " + ) + } +} + +#[cfg(test)] +pub struct TestClock { + now: std::sync::atomic::AtomicI64, +} + +#[cfg(test)] +impl TestClock { + pub fn new(start: i64) -> Self { + Self { + now: std::sync::atomic::AtomicI64::new(start), + } + } +} + +#[cfg(test)] +impl Clock for TestClock { + fn now_epoch_seconds(&self) -> i64 { + self.now.load(std::sync::atomic::Ordering::Relaxed) + } + fn advance(&self, secs: i64) { + self.now + .fetch_add(secs, std::sync::atomic::Ordering::Relaxed); + } +} diff --git a/third_party/rust/ads-client/src/http_cache/connection_initializer.rs b/third_party/rust/ads-client/src/http_cache/connection_initializer.rs new file mode 100644 index 0000000000000..cc31242f6227e --- /dev/null +++ b/third_party/rust/ads-client/src/http_cache/connection_initializer.rs @@ -0,0 +1,55 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +use rusqlite::Connection; +use sql_support::open_database; +use std::time::Duration; + +pub struct HttpCacheConnectionInitializer {} + +impl open_database::ConnectionInitializer for HttpCacheConnectionInitializer { + const NAME: &'static str = "http_cache"; + const END_VERSION: u32 = 1; + + fn prepare(&self, conn: &Connection, _db_empty: bool) -> open_database::Result<()> { + conn.execute_batch("PRAGMA journal_mode=wal;")?; + conn.busy_timeout(Duration::from_secs(5))?; + Ok(()) + } + + fn init(&self, tx: &rusqlite::Transaction<'_>) -> open_database::Result<()> { + const SCHEMA: &str = " + CREATE TABLE IF NOT EXISTS http_cache ( + cached_at INTEGER NOT NULL, + expires_at INTEGER NOT NULL, + request_hash TEXT NOT NULL, + response_body BLOB NOT NULL, + response_headers BLOB, + response_status INTEGER NOT NULL, + size_bytes INTEGER NOT NULL, + ttl_seconds INTEGER NOT NULL, + PRIMARY KEY (request_hash) + ); + CREATE INDEX IF NOT EXISTS idx_http_cache_cached_at ON http_cache(cached_at); + CREATE INDEX IF NOT EXISTS idx_http_cache_expires_at ON http_cache(expires_at); + CREATE INDEX IF NOT EXISTS idx_http_cache_request_hash ON http_cache(request_hash); + "; + tx.execute_batch(SCHEMA)?; + Ok(()) + } + + fn upgrade_from( + &self, + conn: &rusqlite::Transaction<'_>, + version: u32, + ) -> open_database::Result<()> { + match version { + 0 => { + // Version 0 means we need to create the initial schema + self.init(conn) + } + _ => Err(open_database::Error::IncompatibleVersion(version)), + } + } +} diff --git a/third_party/rust/ads-client/src/http_cache/request_hash.rs b/third_party/rust/ads-client/src/http_cache/request_hash.rs new file mode 100644 index 0000000000000..7a47bfc940ddf --- /dev/null +++ b/third_party/rust/ads-client/src/http_cache/request_hash.rs @@ -0,0 +1,131 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +use std::collections::hash_map::DefaultHasher; +use std::hash::{Hash, Hasher}; +use viaduct::Request; + +#[derive(Clone, Debug, PartialEq)] +pub struct RequestHash(String); + +impl From<&Request> for RequestHash { + fn from(request: &Request) -> Self { + let mut hasher = DefaultHasher::new(); + request.method.hash(&mut hasher); + request.url.hash(&mut hasher); + + let mut headers: Vec<_> = request.headers.clone().into_iter().collect(); + headers.sort_by_key(|header| header.name.to_ascii_lowercase()); + for header in headers { + header.name.hash(&mut hasher); + header.value.hash(&mut hasher); + } + + request.body.hash(&mut hasher); + RequestHash(format!("{:x}", hasher.finish())) + } +} + +impl From<&str> for RequestHash { + fn from(s: &str) -> Self { + RequestHash(s.to_string()) + } +} + +impl From for RequestHash { + fn from(s: String) -> Self { + RequestHash(s) + } +} + +impl std::fmt::Display for RequestHash { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use viaduct::{Headers, Method, Request}; + + fn create_test_request(url: &str, body: &[u8]) -> Request { + Request { + method: Method::Get, + url: url.parse().unwrap(), + headers: Headers::new(), + body: Some(body.to_vec()), + } + } + + #[test] + fn test_request_hashing() { + let request1 = create_test_request("https://example.com/api1", b"body1"); + let request2 = create_test_request("https://example.com/api2", b"body2"); + let request3 = create_test_request("https://example.com/api", b"body"); + + let hash1 = RequestHash::from(&request1); + let hash2 = RequestHash::from(&request2); + let hash3 = RequestHash::from(&request3); + + assert_ne!(hash1.to_string(), hash2.to_string()); + assert_ne!(hash1.to_string(), hash3.to_string()); + assert_ne!(hash2.to_string(), hash3.to_string()); + + let same_request = create_test_request("https://example.com/api", b"body"); + let hash4 = RequestHash::from(&same_request); + assert_eq!(hash3.to_string(), hash4.to_string()); + } + + #[test] + fn test_request_hashing_header_order_and_case() { + let base_url = "https://example.com/api"; + let body = b"body"; + + let req_base = create_test_request(base_url, body); + let mut h1 = Headers::new(); + h1.insert("Accept", "text/plain").unwrap(); + h1.insert("X-Test", "1").unwrap(); + let req1 = Request { + headers: h1, + ..req_base.clone() + }; + + let req_base = create_test_request(base_url, body); + let mut h2 = Headers::new(); + h2.insert("X-Test", "1").unwrap(); + h2.insert("Accept", "text/plain").unwrap(); + let req2 = Request { + headers: h2, + ..req_base.clone() + }; + + let req_base = create_test_request(base_url, body); + let mut h3 = Headers::new(); + h3.insert("accept", "text/plain").unwrap(); + h3.insert("x-test", "1").unwrap(); + let req3 = Request { + headers: h3, + ..req_base + }; + + let h_req1 = RequestHash::from(&req1); + let h_req2 = RequestHash::from(&req2); + let h_req3 = RequestHash::from(&req3); + + assert_eq!(h_req1.to_string(), h_req2.to_string()); + assert_eq!(h_req1.to_string(), h_req3.to_string()); + } + + #[test] + fn test_request_hash_from_string() { + let hash_str = "abc123def456"; + let hash = RequestHash::from(hash_str); + assert_eq!(hash.to_string(), hash_str); + + let hash_string = String::from("xyz789"); + let hash2 = RequestHash::from(hash_string); + assert_eq!(hash2.to_string(), "xyz789"); + } +} diff --git a/third_party/rust/ads-client/src/http_cache/store.rs b/third_party/rust/ads-client/src/http_cache/store.rs new file mode 100644 index 0000000000000..585670a2f09bf --- /dev/null +++ b/third_party/rust/ads-client/src/http_cache/store.rs @@ -0,0 +1,609 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + +use std::{collections::HashMap, sync::Arc, time::Duration}; + +use crate::http_cache::{ + clock::{CacheClock, Clock}, + request_hash::RequestHash, + ByteSize, +}; +use parking_lot::Mutex; +use rusqlite::{params, Connection, OptionalExtension, Result as SqliteResult}; +use viaduct::{Header, Request, Response}; + +#[cfg(test)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum FaultKind { + None, + Lookup, + Store, + Trim, + Cleanup, +} + +pub struct HttpCacheStore { + conn: Mutex, + clock: Arc, + #[cfg(test)] + fault: parking_lot::Mutex, +} + +impl HttpCacheStore { + pub fn new(conn: Connection) -> Self { + Self { + conn: Mutex::new(conn), + clock: Arc::new(CacheClock), + #[cfg(test)] + fault: parking_lot::Mutex::new(FaultKind::None), + } + } + + #[cfg(test)] + pub fn new_with_test_clock(conn: Connection) -> Self { + use crate::http_cache::clock::TestClock; + + Self { + conn: Mutex::new(conn), + clock: Arc::new(TestClock::new(chrono::Utc::now().timestamp())), + #[cfg(test)] + fault: parking_lot::Mutex::new(FaultKind::None), + } + } + + #[cfg(test)] + pub fn get_clock(&self) -> &dyn Clock { + &*self.clock + } + + /// Removes all entries from cache. + pub fn clear_all(&self) -> SqliteResult { + let conn = self.conn.lock(); + conn.execute("DELETE FROM http_cache", []) + } + + /// Returns total size of the cache in bytes. + pub fn current_total_size_bytes(&self) -> SqliteResult { + let conn = self.conn.lock(); + let size_bytes = conn.query_row( + "SELECT COALESCE(SUM(size_bytes),0) FROM http_cache", + [], + |row| row.get(0), + )?; + Ok(ByteSize::b(size_bytes)) + } + + /// Removes all entries from the store who's expires_at is before the current time. + pub fn delete_expired_entries(&self) -> SqliteResult { + #[cfg(test)] + if *self.fault.lock() == FaultKind::Cleanup { + return Err(Self::forced_fault_error("forced cleanup failure")); + } + let conn = self.conn.lock(); + conn.execute( + "DELETE FROM http_cache WHERE expires_at < ?1", + params![self.clock.now_epoch_seconds()], + ) + } + + /// Lookup is agnostic to expiration. If it exists in the store, it will return the result. + pub fn lookup(&self, request: &Request) -> SqliteResult> { + #[cfg(test)] + if *self.fault.lock() == FaultKind::Lookup { + return Err(Self::forced_fault_error("forced lookup failure")); + } + let request_hash = RequestHash::from(request); + let conn = self.conn.lock(); + conn.query_row( + "SELECT response_body, response_headers, response_status FROM http_cache WHERE request_hash = ?1", + params![request_hash.to_string()], + |row| { + let response_body = row.get(0)?; + let response_headers: Vec = row.get(1)?; + let response_status: i64 = row.get(2)?; + let headers = serde_json::from_slice::>(&response_headers) + .map(|map| { + map.into_iter() + .filter_map(|(n, v)| Header::new(n, v).ok()) + .collect::>() + .into() + }) + .unwrap_or_else(|_| viaduct::Headers::new()); + + let response = Response { + body: response_body, + headers, + request_method: request.method, + status: response_status as u16, + url: request.url.clone(), + }; + Ok((response, request_hash)) + }, + ) + .optional() + } + + /// Upsert an object into the store with an expires_at defined by the given ttl_seconds. + /// Calling this method will always store an object regardless of headers or policy. + /// Logic to determine the correct ttl or cache/no-cache should happen before calling this. + pub fn store_with_ttl( + &self, + request: &Request, + response: &Response, + ttl: &Duration, + ) -> SqliteResult { + #[cfg(test)] + if *self.fault.lock() == FaultKind::Store { + return Err(Self::forced_fault_error("forced store failure")); + } + let request_hash = RequestHash::from(request); + let headers_map: HashMap = response.headers.clone().into(); + let response_headers = serde_json::to_vec(&headers_map).unwrap_or_default(); + let size_bytes = (response_headers.len() + response.body.len()) as i64; + let now = self.clock.now_epoch_seconds(); + let ttl_seconds = ttl.as_secs(); + let expires_at = now + ttl_seconds as i64; + + let conn = self.conn.lock(); + conn.execute( + "INSERT INTO http_cache ( + cached_at, + expires_at, + request_hash, + response_body, + response_headers, + response_status, + size_bytes, + ttl_seconds + ) + VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8) + ON CONFLICT(request_hash) DO UPDATE SET + cached_at=excluded.cached_at, + expires_at=excluded.expires_at, + response_body=excluded.response_body, + response_headers=excluded.response_headers, + response_status=excluded.response_status, + size_bytes=excluded.size_bytes, + ttl_seconds=excluded.ttl_seconds", + params![ + now, + expires_at, + request_hash.to_string(), + response.body, + response_headers, + response.status, + size_bytes, + ttl_seconds as i64, + ], + )?; + Ok(request_hash) + } + + pub fn invalidate_by_hash(&self, request_hash: &RequestHash) -> SqliteResult { + let conn = self.conn.lock(); + conn.execute( + "DELETE FROM http_cache WHERE request_hash = ?1", + params![request_hash.to_string()], + ) + } + + /// Trim cache to + pub fn trim_to_max_size(&self, max_size_bytes: i64) -> SqliteResult<()> { + #[cfg(test)] + if *self.fault.lock() == FaultKind::Trim { + return Err(Self::forced_fault_error("forced trim failure")); + } + loop { + let total = self.current_total_size_bytes()?; + if total.as_u64() <= max_size_bytes as u64 { + break; + } + let conn = self.conn.lock(); + conn.execute( + "DELETE FROM http_cache WHERE rowid IN ( + SELECT rowid FROM http_cache ORDER BY cached_at ASC LIMIT 1 + )", + [], + )?; + } + Ok(()) + } + + #[cfg(test)] + pub fn set_fault(&self, kind: FaultKind) { + *self.fault.lock() = kind; + } + + #[cfg(test)] + fn forced_fault_error(msg: &str) -> rusqlite::Error { + rusqlite::Error::SqliteFailure( + rusqlite::ffi::Error { + code: rusqlite::ErrorCode::InternalMalfunction, + extended_code: 0, + }, + Some(msg.to_string()), + ) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::http_cache::connection_initializer::HttpCacheConnectionInitializer; + use sql_support::open_database; + use std::time::Duration; + use viaduct::{header_names, Headers, Method, Response}; + + fn fetch_timestamps(store: &HttpCacheStore, req: &Request) -> (i64, i64, i64) { + let hash = RequestHash::from(req).to_string(); + let conn = store.conn.lock(); + conn.query_row( + "SELECT + cached_at, + expires_at, + COALESCE(ttl_seconds, -1) + FROM http_cache WHERE request_hash = ?1", + rusqlite::params![hash], + |row| { + let cached_at: i64 = row.get(0)?; + let expires_at: i64 = row.get(1)?; + let ttl: i64 = row.get(2)?; + Ok((cached_at, expires_at, ttl)) + }, + ) + .expect("row should exist") + } + + fn create_test_request(url: &str, body: &[u8]) -> Request { + Request { + method: Method::Get, + url: url.parse().unwrap(), + headers: Headers::new(), + body: Some(body.to_vec()), + } + } + + fn create_test_response(status: u16, body: &[u8]) -> Response { + let mut headers = Headers::new(); + headers + .insert(header_names::CONTENT_TYPE, "application/json") + .unwrap(); + + Response { + request_method: Method::Get, + url: "https://example.com/test".parse().unwrap(), + status, + headers, + body: body.to_vec(), + } + } + + fn create_test_store() -> HttpCacheStore { + let initializer = HttpCacheConnectionInitializer {}; + let conn = open_database::open_memory_database(&initializer) + .expect("failed to open memory cache db"); + HttpCacheStore::new_with_test_clock(conn) + } + + #[test] + fn test_lookup_fault_injection() { + let store = create_test_store(); + store.set_fault(FaultKind::Lookup); + + let req = create_test_request("https://example.com/api", b"body"); + let err = store.lookup(&req).unwrap_err(); + + match err { + rusqlite::Error::SqliteFailure(_, Some(msg)) => { + assert!(msg.contains("forced lookup failure")); + } + other => panic!("unexpected error: {other:?}"), + } + } + + #[test] + fn test_store_fault_injection() { + let store = create_test_store(); + store.set_fault(FaultKind::Store); + + let req = create_test_request("https://example.com/api", b"body"); + let resp = create_test_response(200, b"resp"); + + let err = store + .store_with_ttl(&req, &resp, &Duration::new(300, 0)) + .unwrap_err(); + match err { + rusqlite::Error::SqliteFailure(_, Some(msg)) => { + assert!(msg.contains("forced store failure")); + } + other => panic!("unexpected error: {other:?}"), + } + } + + #[test] + fn test_trim_fault_injection() { + let store = create_test_store(); + store.set_fault(FaultKind::Trim); + + let req = create_test_request("https://example.com/api", b""); + let resp = create_test_response(200, b"resp"); + store + .store_with_ttl(&req, &resp, &Duration::new(300, 0)) + .unwrap(); + + let err = store.trim_to_max_size(1).unwrap_err(); + match err { + rusqlite::Error::SqliteFailure(_, Some(msg)) => { + assert!(msg.contains("forced trim failure")); + } + other => panic!("unexpected error: {other:?}"), + } + } + + #[test] + fn test_cleanup_fault_injection() { + let store = create_test_store(); + store.set_fault(FaultKind::Cleanup); + + let err = store.delete_expired_entries().unwrap_err(); + match err { + rusqlite::Error::SqliteFailure(_, Some(msg)) => { + assert!(msg.contains("forced cleanup failure")); + } + other => panic!("unexpected error: {other:?}"), + } + } + + #[test] + fn test_store_with_ttl_sets_fields_consistently() { + let store = create_test_store(); + let req = create_test_request("https://example.com/a", b""); + let resp = create_test_response(200, b"X"); + + let ttl = Duration::new(5, 0); + store.store_with_ttl(&req, &resp, &ttl).unwrap(); + + let (cached_at, expires_at, ttl_seconds) = fetch_timestamps(&store, &req); + assert_eq!(ttl_seconds, ttl.as_secs() as i64); + // expires_at should be cached_at + ttl (allow 1s skew) + let diff = expires_at - cached_at; + let ttl_seconds = ttl.as_secs(); + assert!( + (diff == ttl_seconds as i64) + || (diff == ttl_seconds as i64 - 1) + || (diff == ttl_seconds as i64 + 1), + "unexpected expires_at diff: got {diff}, want ~{ttl_seconds}" + ); + } + + #[test] + fn test_upsert_refreshes_ttl_and_expiry() { + let store = create_test_store(); + let req = create_test_request("https://example.com/b", b""); + let resp = create_test_response(200, b"Y"); + + store + .store_with_ttl(&req, &resp, &Duration::new(300, 0)) + .unwrap(); + let (c1, e1, t1) = fetch_timestamps(&store, &req); + assert_eq!(t1, 300); + + store.get_clock().advance(3); + + store + .store_with_ttl(&req, &resp, &Duration::new(1, 0)) + .unwrap(); + let (c2, e2, t2) = fetch_timestamps(&store, &req); + assert_eq!(t2, 1); + // cached_at should be >= previous cached_at; expires_at should move accordingly + assert!(c2 > c1); + assert!(e2 < e1, "expires_at should move earlier when TTL shrinks"); + } + + #[test] + fn test_delete_expired_removes_only_expired() { + let store = create_test_store(); + let req_exp = create_test_request("https://example.com/expired", b""); + let req_fresh = create_test_request("https://example.com/fresh", b""); + let resp = create_test_response(200, b"Z"); + + // expired after ~1s, fresh after ~10s + store + .store_with_ttl(&req_exp, &resp, &Duration::new(1, 0)) + .unwrap(); + store + .store_with_ttl(&req_fresh, &resp, &Duration::new(10, 0)) + .unwrap(); + + // Both present now + assert!(store.lookup(&req_exp).unwrap().is_some()); + assert!(store.lookup(&req_fresh).unwrap().is_some()); + + // Let first one expire; then cleanup + store.clock.advance(2); + let removed = store.delete_expired_entries().unwrap(); + assert!( + removed >= 1, + "expected at least one expired row to be deleted" + ); + + // Expired is gone, fresh remains + assert!(store.lookup(&req_exp).unwrap().is_none()); + assert!(store.lookup(&req_fresh).unwrap().is_some()); + } + + #[test] + fn test_lookup_is_expired_agnostic() { + let store = create_test_store(); + let req = create_test_request("https://example.com/stale", b""); + let resp = create_test_response(200, b"W"); + + store + .store_with_ttl(&req, &resp, &Duration::new(1, 0)) + .unwrap(); + // Check that lookup still returns (store is policy-agnostic). + store.clock.advance(2); + assert!(store.lookup(&req).unwrap().is_some()); + + // Test cleanup still removes it + store.delete_expired_entries().unwrap(); + assert!(store.lookup(&req).unwrap().is_none()); + } + + #[test] + fn test_zero_ttl_expires_immediately_after_tick() { + // Because cleanup uses `expires_at < now`, a row with expires_at == now + // won’t be removed until the clock advances at least one second. + let store = create_test_store(); + let req = create_test_request("https://example.com/zero", b""); + let resp = create_test_response(200, b"0"); + + store + .store_with_ttl(&req, &resp, &Duration::new(0, 0)) + .unwrap(); + assert!(store.lookup(&req).unwrap().is_some()); + + // Advance a second so now > expires_at + store.clock.advance(2); + let removed = store.delete_expired_entries().unwrap(); + assert!(removed >= 1); + assert!(store.lookup(&req).unwrap().is_none()); + } + + #[test] + fn test_store_and_retrieve() { + let store = create_test_store(); + + let request = create_test_request("https://example.com/api", b"test body"); + let response = create_test_response(200, b"test response"); + + store + .store_with_ttl(&request, &response, &Duration::new(300, 0)) + .unwrap(); + + let retrieved = store.lookup(&request).unwrap().unwrap(); + assert_eq!(retrieved.0.status, 200); + assert_eq!(retrieved.0.body, b"test response"); + } + + #[test] + fn test_ttl_expiration() { + let store = create_test_store(); + + let request = create_test_request("https://example.com/api", b"test body"); + let response = create_test_response(200, b"test response"); + + store + .store_with_ttl(&request, &response, &Duration::new(300, 0)) + .unwrap(); + + let retrieved = store.lookup(&request).unwrap().unwrap(); + assert_eq!(retrieved.0.body, b"test response"); + + store.clock.advance(2); + + let retrieved_after_expiry = store.lookup(&request).unwrap(); + assert!(retrieved_after_expiry.is_some()); + } + + #[test] + fn test_max_size_eviction() { + let initializer = HttpCacheConnectionInitializer {}; + let conn = open_database::open_memory_database(&initializer) + .expect("failed to open memory cache db"); + let store = HttpCacheStore::new(conn); + + for i in 0..5 { + let request = create_test_request(&format!("https://example.com/api/{}", i), b""); + let large_body = vec![0u8; 300]; + let response = create_test_response(200, &large_body); + store + .store_with_ttl(&request, &response, &Duration::new(300, 0)) + .unwrap(); + } + + // Trim to max size of 1024 bytes + store.trim_to_max_size(1024).unwrap(); + + let total_size = store.current_total_size_bytes().unwrap(); + assert!(total_size.as_u64() <= 1024); + + let first_request = create_test_request("https://example.com/api/0", b""); + let first_cached = store.lookup(&first_request).unwrap(); + assert!(first_cached.is_none()); + } + + #[test] + fn test_no_store_directive() { + let store = create_test_store(); + let request = create_test_request("https://example.com/api", b"test body"); + + let mut response = create_test_response(200, b"test response"); + response + .headers + .insert("cache-control", "no-store") + .unwrap(); + + store + .store_with_ttl(&request, &response, &Duration::new(300, 0)) + .unwrap(); + let retrieved = store.lookup(&request).unwrap(); + assert!(retrieved.is_some()); + } + + #[test] + fn test_clear_all() { + let store = create_test_store(); + + let request1 = create_test_request("https://example.com/api1", b"test body 1"); + let response1 = create_test_response(200, b"test response 1"); + store + .store_with_ttl(&request1, &response1, &Duration::new(300, 0)) + .unwrap(); + + let request2 = create_test_request("https://example.com/api2", b"test body 2"); + let response2 = create_test_response(200, b"test response 2"); + store + .store_with_ttl(&request2, &response2, &Duration::new(300, 0)) + .unwrap(); + + // Verify both are cached + assert!(store.lookup(&request1).unwrap().is_some()); + assert!(store.lookup(&request2).unwrap().is_some()); + + // Clear all entries + let deleted_count = store.clear_all().unwrap(); + assert_eq!(deleted_count, 2); + + // Verify both are cleared + assert!(store.lookup(&request1).unwrap().is_none()); + assert!(store.lookup(&request2).unwrap().is_none()); + } + + #[test] + fn test_invalidate_by_hash() { + let store = create_test_store(); + + let request1 = create_test_request("https://example.com/api1", b"body1"); + let request2 = create_test_request("https://example.com/api2", b"body2"); + let resp = create_test_response(200, b"resp"); + + store + .store_with_ttl(&request1, &resp, &Duration::new(300, 0)) + .unwrap(); + store + .store_with_ttl(&request2, &resp, &Duration::new(300, 0)) + .unwrap(); + + assert!(store.lookup(&request1).unwrap().is_some()); + assert!(store.lookup(&request2).unwrap().is_some()); + + let hash1 = RequestHash::from(&request1); + let deleted = store.invalidate_by_hash(&hash1).unwrap(); + assert_eq!(deleted, 1); + + assert!(store.lookup(&request1).unwrap().is_none()); + assert!(store.lookup(&request2).unwrap().is_some()); + } +} diff --git a/third_party/rust/ads-client/src/lib.rs b/third_party/rust/ads-client/src/lib.rs new file mode 100644 index 0000000000000..06d5d07b7294c --- /dev/null +++ b/third_party/rust/ads-client/src/lib.rs @@ -0,0 +1,145 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public +* 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/. +*/ + +use std::collections::HashMap; + +use error::{CallbackRequestError, ComponentError}; +use error_support::handle_error; +use parking_lot::Mutex; +use url::Url as AdsClientUrl; + +use client::ad_request::AdPlacementRequest; +use client::AdsClient; +use http_cache::RequestCachePolicy; + +mod client; +mod error; +mod ffi; +pub mod http_cache; +mod mars; +pub mod telemetry; + +pub use ffi::*; + +use crate::client::config::AdsClientConfig; +use crate::ffi::telemetry::MozAdsTelemetryWrapper; + +#[cfg(test)] +mod test_utils; + +uniffi::setup_scaffolding!("ads_client"); + +uniffi::custom_type!(AdsClientUrl, String, { + remote, + try_lift: |val| Ok(AdsClientUrl::parse(&val)?), + lower: |obj| obj.as_str().to_string(), +}); + +#[derive(uniffi::Object)] +pub struct MozAdsClient { + inner: Mutex>, +} +#[uniffi::export] +impl MozAdsClient { + #[uniffi::constructor] + pub fn new(client_config: Option) -> Self { + let client_config = client_config.unwrap_or_default(); + let client_config: AdsClientConfig = client_config.into(); + let client = AdsClient::new(client_config); + Self { + inner: Mutex::new(client), + } + } + + #[handle_error(ComponentError)] + pub fn request_image_ads( + &self, + moz_ad_requests: Vec, + options: Option, + ) -> AdsClientApiResult> { + let inner = self.inner.lock(); + let requests: Vec = moz_ad_requests.iter().map(|r| r.into()).collect(); + let cache_policy: RequestCachePolicy = options.into(); + let response = inner + .request_image_ads(requests, Some(cache_policy)) + .map_err(ComponentError::RequestAds)?; + Ok(response.into_iter().map(|(k, v)| (k, v.into())).collect()) + } + + #[handle_error(ComponentError)] + pub fn request_spoc_ads( + &self, + moz_ad_requests: Vec, + options: Option, + ) -> AdsClientApiResult>> { + let inner = self.inner.lock(); + let requests: Vec = moz_ad_requests.iter().map(|r| r.into()).collect(); + let cache_policy: RequestCachePolicy = options.into(); + let response = inner + .request_spoc_ads(requests, Some(cache_policy)) + .map_err(ComponentError::RequestAds)?; + Ok(response + .into_iter() + .map(|(k, v)| (k, v.into_iter().map(|spoc| spoc.into()).collect())) + .collect()) + } + + #[handle_error(ComponentError)] + pub fn request_tile_ads( + &self, + moz_ad_requests: Vec, + options: Option, + ) -> AdsClientApiResult> { + let inner = self.inner.lock(); + let requests: Vec = moz_ad_requests.iter().map(|r| r.into()).collect(); + let cache_policy: RequestCachePolicy = options.into(); + let response = inner + .request_tile_ads(requests, Some(cache_policy)) + .map_err(ComponentError::RequestAds)?; + Ok(response.into_iter().map(|(k, v)| (k, v.into())).collect()) + } + + #[handle_error(ComponentError)] + pub fn record_impression(&self, impression_url: String) -> AdsClientApiResult<()> { + let url = AdsClientUrl::parse(&impression_url).map_err(|e| { + ComponentError::RecordImpression(CallbackRequestError::InvalidUrl(e).into()) + })?; + let inner = self.inner.lock(); + inner + .record_impression(url) + .map_err(ComponentError::RecordImpression) + } + + #[handle_error(ComponentError)] + pub fn record_click(&self, click_url: String) -> AdsClientApiResult<()> { + let url = AdsClientUrl::parse(&click_url) + .map_err(|e| ComponentError::RecordClick(CallbackRequestError::InvalidUrl(e).into()))?; + let inner = self.inner.lock(); + inner.record_click(url).map_err(ComponentError::RecordClick) + } + + #[handle_error(ComponentError)] + pub fn report_ad(&self, report_url: String) -> AdsClientApiResult<()> { + let url = AdsClientUrl::parse(&report_url) + .map_err(|e| ComponentError::ReportAd(CallbackRequestError::InvalidUrl(e).into()))?; + let inner = self.inner.lock(); + inner.report_ad(url).map_err(ComponentError::ReportAd) + } + + pub fn cycle_context_id(&self) -> AdsClientApiResult { + let mut inner = self.inner.lock(); + let previous_context_id = inner.cycle_context_id()?; + Ok(previous_context_id) + } + + pub fn clear_cache(&self) -> AdsClientApiResult<()> { + let inner = self.inner.lock(); + inner + .clear_cache() + .map_err(|_| MozAdsClientApiError::Other { + reason: "Failed to clear cache".to_string(), + }) + } +} diff --git a/third_party/rust/ads-client/src/mars.rs b/third_party/rust/ads-client/src/mars.rs new file mode 100644 index 0000000000000..c05ce033bebda --- /dev/null +++ b/third_party/rust/ads-client/src/mars.rs @@ -0,0 +1,268 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public +* 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/. +*/ + +use crate::{ + client::{ + ad_request::AdRequest, + ad_response::{AdResponse, AdResponseValue}, + config::Environment, + }, + error::{ + check_http_status_for_error, CallbackRequestError, FetchAdsError, RecordClickError, + RecordImpressionError, ReportAdError, + }, + http_cache::{HttpCache, HttpCacheError, RequestHash}, + telemetry::Telemetry, + RequestCachePolicy, +}; +use url::Url; +use viaduct::Request; + +pub struct MARSClient +where + T: Telemetry, +{ + endpoint: Url, + http_cache: Option, + telemetry: T, +} + +impl MARSClient +where + T: Telemetry, +{ + pub fn new(environment: Environment, http_cache: Option, telemetry: T) -> Self { + let endpoint = environment.into_mars_url().clone(); + + Self { + endpoint, + http_cache, + telemetry, + } + } + + fn make_callback_request(&self, callback: Url) -> Result<(), CallbackRequestError> { + let request = Request::get(callback); + let response = request.send()?; + check_http_status_for_error(&response).map_err(Into::into) + } + + pub fn get_mars_endpoint(&self) -> &Url { + &self.endpoint + } + + pub fn fetch_ads( + &self, + ad_request: &AdRequest, + cache_policy: &RequestCachePolicy, + ) -> Result<(AdResponse, RequestHash), FetchAdsError> + where + A: AdResponseValue, + { + let base = self.get_mars_endpoint(); + let url = base.join("ads")?; + let request = Request::post(url).json(ad_request); + let request_hash = RequestHash::from(&request); + + let response: AdResponse = if let Some(cache) = self.http_cache.as_ref() { + let outcome = cache.send_with_policy(&request, cache_policy)?; + self.telemetry.record(&outcome.cache_outcome); + check_http_status_for_error(&outcome.response)?; + AdResponse::::parse(outcome.response.json()?, &self.telemetry)? + } else { + let response = request.send()?; + check_http_status_for_error(&response)?; + AdResponse::::parse(response.json()?, &self.telemetry)? + }; + Ok((response, request_hash)) + } + + pub fn record_impression(&self, callback: Url) -> Result<(), RecordImpressionError> { + Ok(self.make_callback_request(callback)?) + } + + pub fn record_click(&self, callback: Url) -> Result<(), RecordClickError> { + Ok(self.make_callback_request(callback)?) + } + + pub fn invalidate_cache_by_hash( + &self, + request_hash: &crate::http_cache::RequestHash, + ) -> Result<(), HttpCacheError> { + if let Some(cache) = &self.http_cache { + cache.invalidate_by_hash(request_hash)?; + } + Ok(()) + } + + pub fn report_ad(&self, callback: Url) -> Result<(), ReportAdError> { + Ok(self.make_callback_request(callback)?) + } + + pub fn clear_cache(&self) -> Result<(), HttpCacheError> { + if let Some(cache) = &self.http_cache { + cache.clear()?; + } + Ok(()) + } +} + +#[cfg(test)] +mod tests { + + use super::*; + use crate::client::ad_response::AdImage; + use crate::ffi::telemetry::MozAdsTelemetryWrapper; + use crate::test_utils::{get_example_happy_image_response, make_happy_ad_request}; + use mockito::mock; + + #[test] + fn test_record_impression_with_valid_url_should_succeed() { + viaduct_dev::init_backend_dev(); + let _m = mock("GET", "/impression_callback_url") + .with_status(200) + .create(); + let client = MARSClient::new(Environment::Test, None, MozAdsTelemetryWrapper::noop()); + let url = Url::parse(&format!( + "{}/impression_callback_url", + &mockito::server_url() + )) + .unwrap(); + let result = client.record_impression(url); + assert!(result.is_ok()); + } + + #[test] + fn test_record_click_with_valid_url_should_succeed() { + viaduct_dev::init_backend_dev(); + let _m = mock("GET", "/click_callback_url").with_status(200).create(); + + let client = MARSClient::new(Environment::Test, None, MozAdsTelemetryWrapper::noop()); + let url = Url::parse(&format!("{}/click_callback_url", &mockito::server_url())).unwrap(); + let result = client.record_click(url); + assert!(result.is_ok()); + } + + #[test] + fn test_report_ad_with_valid_url_should_succeed() { + viaduct_dev::init_backend_dev(); + let _m = mock("GET", "/report_ad_callback_url") + .with_status(200) + .create(); + + let client = MARSClient::new(Environment::Test, None, MozAdsTelemetryWrapper::noop()); + let url = Url::parse(&format!( + "{}/report_ad_callback_url", + &mockito::server_url() + )) + .unwrap(); + let result = client.report_ad(url); + assert!(result.is_ok()); + } + + #[test] + fn test_fetch_ads_success() { + viaduct_dev::init_backend_dev(); + let expected_response = get_example_happy_image_response(); + + let _m = mock("POST", "/ads") + .match_header("content-type", "application/json") + .with_status(200) + .with_header("content-type", "application/json") + .with_body(serde_json::to_string(&expected_response.data).unwrap()) + .create(); + + let client = MARSClient::new(Environment::Test, None, MozAdsTelemetryWrapper::noop()); + + let ad_request = make_happy_ad_request(); + + let result = client.fetch_ads::(&ad_request, &RequestCachePolicy::default()); + assert!(result.is_ok()); + let (response, _request_hash) = result.unwrap(); + assert_eq!(expected_response, response); + } + + #[test] + fn test_fetch_ads_cache_hit_skips_network() { + viaduct_dev::init_backend_dev(); + let expected = get_example_happy_image_response(); + let _m = mock("POST", "/ads") + .with_status(200) + .with_header("content-type", "application/json") + .with_body(serde_json::to_string(&expected.data).unwrap()) + .expect(1) // only first request goes to network + .create(); + + let client = MARSClient::new(Environment::Test, None, MozAdsTelemetryWrapper::noop()); + let ad_request = make_happy_ad_request(); + + // First call should be a miss then warm the cache + let (response1, _request_hash1) = client + .fetch_ads::(&ad_request, &RequestCachePolicy::default()) + .unwrap(); + assert_eq!(response1, expected); + + // Second call should be a hit + let (response2, _request_hash2) = client + .fetch_ads::(&ad_request, &RequestCachePolicy::default()) + .unwrap(); + assert_eq!(response2, expected); + } + + #[test] + fn default_client_uses_prod_url() { + let client = MARSClient::new(Environment::Prod, None, MozAdsTelemetryWrapper::noop()); + assert_eq!( + client.get_mars_endpoint().as_str(), + "https://ads.mozilla.org/v1/" + ); + } + + #[test] + fn test_record_click_makes_callback_request() { + viaduct_dev::init_backend_dev(); + let cache = HttpCache::builder("test_record_click.db") + .default_ttl(std::time::Duration::from_secs(300)) + .max_size(crate::http_cache::ByteSize::mib(1)) + .build() + .unwrap(); + + let client = MARSClient::new( + Environment::Test, + Some(cache), + MozAdsTelemetryWrapper::noop(), + ); + + let callback_url = Url::parse(&format!("{}/click", mockito::server_url())).unwrap(); + + let _m = mock("GET", "/click").with_status(200).create(); + + let result = client.record_click(callback_url); + assert!(result.is_ok()); + } + + #[test] + fn test_record_impression_makes_callback_request() { + viaduct_dev::init_backend_dev(); + let cache = HttpCache::builder("test_record_impression.db") + .default_ttl(std::time::Duration::from_secs(300)) + .max_size(crate::http_cache::ByteSize::mib(1)) + .build() + .unwrap(); + + let client = MARSClient::new( + Environment::Test, + Some(cache), + MozAdsTelemetryWrapper::noop(), + ); + + let callback_url = Url::parse(&format!("{}/impression", mockito::server_url())).unwrap(); + + let _m = mock("GET", "/impression").with_status(200).create(); + + let result = client.record_impression(callback_url); + assert!(result.is_ok()); + } +} diff --git a/third_party/rust/ads-client/src/telemetry.rs b/third_party/rust/ads-client/src/telemetry.rs new file mode 100644 index 0000000000000..b4b9d49805add --- /dev/null +++ b/third_party/rust/ads-client/src/telemetry.rs @@ -0,0 +1,10 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public +* 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/. +*/ + +use std::any::Any; + +pub trait Telemetry { + fn record(&self, event: &dyn Any); +} diff --git a/third_party/rust/ads-client/src/test_utils.rs b/third_party/rust/ads-client/src/test_utils.rs new file mode 100644 index 0000000000000..a6aeaab5a8e9d --- /dev/null +++ b/third_party/rust/ads-client/src/test_utils.rs @@ -0,0 +1,228 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public +* 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/. +*/ + +use std::collections::HashMap; + +use url::Url; + +use crate::client::{ + ad_request::{AdContentCategory, AdPlacementRequest, AdRequest, IABContentTaxonomy}, + ad_response::{ + AdCallbacks, AdImage, AdResponse, AdSpoc, AdTile, SpocFrequencyCaps, SpocRanking, + }, +}; + +pub const TEST_CONTEXT_ID: &str = "00000000-0000-4000-8000-000000000001"; + +pub fn make_happy_placement_requests() -> Vec { + vec![ + AdPlacementRequest { + placement: "example_placement_1".to_string(), + count: 1, + content: Some(AdContentCategory { + taxonomy: IABContentTaxonomy::IAB2_1, + categories: vec!["entertainment".to_string()], + }), + }, + AdPlacementRequest { + placement: "example_placement_2".to_string(), + count: 1, + content: Some(AdContentCategory { + taxonomy: IABContentTaxonomy::IAB2_1, + categories: vec!["entertainment".to_string()], + }), + }, + ] +} + +pub fn make_happy_ad_request() -> AdRequest { + AdRequest { + context_id: TEST_CONTEXT_ID.to_string(), + placements: vec![ + AdPlacementRequest { + placement: "example_placement_1".to_string(), + count: 1, + content: None, + }, + AdPlacementRequest { + placement: "example_placement_2".to_string(), + count: 1, + content: None, + }, + ], + } +} + +pub fn get_example_happy_image_response() -> AdResponse { + let base_url = mockito::server_url(); + AdResponse { + data: HashMap::from([ + ( + "example_placement_1".to_string(), + vec![AdImage { + url: "https://ads.fakeexample.org/example_ad_1".to_string(), + image_url: "https://ads.fakeexample.org/example_image_1".to_string(), + format: "billboard".to_string(), + block_key: "abc123".into(), + alt_text: Some("An ad for a puppy".to_string()), + callbacks: AdCallbacks { + click: Url::parse(&format!("{}/click/example_ad_1", base_url)).unwrap(), + impression: Url::parse(&format!("{}/impression/example_ad_1", base_url)) + .unwrap(), + report: Some( + Url::parse(&format!("{}/report/example_ad_1", base_url)).unwrap(), + ), + }, + }], + ), + ( + "example_placement_2".to_string(), + vec![AdImage { + url: "https://ads.fakeexample.org/example_ad_2".to_string(), + image_url: "https://ads.fakeexample.org/example_image_2".to_string(), + format: "skyscraper".to_string(), + block_key: "abc123".into(), + alt_text: Some("An ad for a pet duck".to_string()), + callbacks: AdCallbacks { + click: Url::parse(&format!("{}/click/example_ad_2", base_url)).unwrap(), + impression: Url::parse(&format!("{}/impression/example_ad_2", base_url)) + .unwrap(), + report: Some( + Url::parse(&format!("{}/report/example_ad_2", base_url)).unwrap(), + ), + }, + }], + ), + ]), + } +} + +pub fn get_example_happy_spoc_response() -> AdResponse { + AdResponse { + data: HashMap::from([ + ( + "example_placement_1".to_string(), + vec![AdSpoc { + url: "https://ads.fakeexample.org/example_spoc_1".to_string(), + image_url: "https://ads.fakeexample.org/example_spoc_image_1".to_string(), + format: "spoc".to_string(), + block_key: "spoc123".into(), + title: "Example Spoc Title".to_string(), + excerpt: "This is an example spoc excerpt".to_string(), + domain: "example.com".to_string(), + sponsor: "Example Sponsor".to_string(), + sponsored_by_override: None, + caps: SpocFrequencyCaps { + cap_key: "spoc_cap_1".to_string(), + day: 7, + }, + ranking: SpocRanking { + priority: 1, + personalization_models: Some(HashMap::from([("model1".to_string(), 10)])), + item_score: 0.85, + }, + callbacks: AdCallbacks { + click: Url::parse("https://ads.fakeexample.org/click/example_spoc_1") + .unwrap(), + impression: Url::parse( + "https://ads.fakeexample.org/impression/example_spoc_1", + ) + .unwrap(), + report: Some( + Url::parse("https://ads.fakeexample.org/report/example_spoc_1") + .unwrap(), + ), + }, + }], + ), + ( + "example_placement_2".to_string(), + vec![AdSpoc { + url: "https://ads.fakeexample.org/example_spoc_2".to_string(), + image_url: "https://ads.fakeexample.org/example_spoc_image_2".to_string(), + format: "spoc".to_string(), + block_key: "spoc456".into(), + title: "Another Spoc Title".to_string(), + excerpt: "This is another example spoc excerpt".to_string(), + domain: "another-example.com".to_string(), + sponsor: "Another Sponsor".to_string(), + sponsored_by_override: Some("Override Sponsor".to_string()), + caps: SpocFrequencyCaps { + cap_key: "spoc_cap_2".to_string(), + day: 14, + }, + ranking: SpocRanking { + priority: 2, + personalization_models: None, + item_score: 0.75, + }, + callbacks: AdCallbacks { + click: Url::parse("https://ads.fakeexample.org/click/example_spoc_2") + .unwrap(), + impression: Url::parse( + "https://ads.fakeexample.org/impression/example_spoc_2", + ) + .unwrap(), + report: Some( + Url::parse("https://ads.fakeexample.org/report/example_spoc_2") + .unwrap(), + ), + }, + }], + ), + ]), + } +} + +pub fn get_example_happy_uatile_response() -> AdResponse { + AdResponse { + data: HashMap::from([ + ( + "example_placement_1".to_string(), + vec![AdTile { + url: "https://ads.fakeexample.org/example_uatile_1".to_string(), + image_url: "https://ads.fakeexample.org/example_uatile_image_1".to_string(), + format: "uatile".to_string(), + block_key: "uatile123".into(), + name: "Example UA Tile".to_string(), + callbacks: AdCallbacks { + click: Url::parse("https://ads.fakeexample.org/click/example_uatile_1") + .unwrap(), + impression: Url::parse( + "https://ads.fakeexample.org/impression/example_uatile_1", + ) + .unwrap(), + report: Some( + Url::parse("https://ads.fakeexample.org/report/example_uatile_1") + .unwrap(), + ), + }, + }], + ), + ( + "example_placement_2".to_string(), + vec![AdTile { + url: "https://ads.fakeexample.org/example_uatile_2".to_string(), + image_url: "https://ads.fakeexample.org/example_uatile_image_2".to_string(), + format: "uatile".to_string(), + block_key: "uatile456".into(), + name: "Another UA Tile".to_string(), + callbacks: AdCallbacks { + click: Url::parse("https://ads.fakeexample.org/click/example_uatile_2") + .unwrap(), + impression: Url::parse( + "https://ads.fakeexample.org/impression/example_uatile_2", + ) + .unwrap(), + report: Some( + Url::parse("https://ads.fakeexample.org/report/example_uatile_2") + .unwrap(), + ), + }, + }], + ), + ]), + } +} diff --git a/third_party/rust/ads-client/tests/integration_test.rs b/third_party/rust/ads-client/tests/integration_test.rs new file mode 100644 index 0000000000000..18a30d1c8126f --- /dev/null +++ b/third_party/rust/ads-client/tests/integration_test.rs @@ -0,0 +1,157 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public +* 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/. +*/ + +use std::time::Duration; + +use ads_client::{ + http_cache::{ByteSize, CacheOutcome, HttpCache, RequestCachePolicy}, + MozAdsClient, MozAdsPlacementRequest, MozAdsPlacementRequestWithCount, +}; +use url::Url; +use viaduct::Request; + +#[test] +#[ignore] +fn test_mock_pocket_billboard_1_placement() { + viaduct_dev::init_backend_dev(); + + let client = MozAdsClient::new(None); + + let placement_request = MozAdsPlacementRequest { + placement_id: "mock_pocket_billboard_1".to_string(), + iab_content: None, + }; + + let result = client.request_image_ads(vec![placement_request], None); + + assert!(result.is_ok(), "Failed to request ads: {:?}", result.err()); + + let placements = result.unwrap(); + + assert!( + placements.contains_key("mock_pocket_billboard_1"), + "Response should contain placement_id 'mock_pocket_billboard_1'" + ); + + placements + .get("mock_pocket_billboard_1") + .expect("Placement should exist"); +} + +#[test] +#[ignore] +fn test_newtab_spocs_placement() { + viaduct_dev::init_backend_dev(); + + let client = MozAdsClient::new(None); + + let count = 3; + let placement_request = MozAdsPlacementRequestWithCount { + placement_id: "newtab_spocs".to_string(), + count, + iab_content: None, + }; + + let result = client.request_spoc_ads(vec![placement_request], None); + + assert!(result.is_ok(), "Failed to request ads: {:?}", result.err()); + + let placements = result.unwrap(); + + assert!( + placements.contains_key("newtab_spocs"), + "Response should contain placement_id 'newtab_spocs'" + ); + + let spocs = placements + .get("newtab_spocs") + .expect("Placement should exist"); + + assert_eq!( + spocs.len(), + count as usize, + "Number of spocs should equal count parameter" + ); +} + +#[test] +#[ignore] +fn test_newtab_tile_1_placement() { + viaduct_dev::init_backend_dev(); + + let client = MozAdsClient::new(None); + + let placement_request = MozAdsPlacementRequest { + placement_id: "newtab_tile_1".to_string(), + iab_content: None, + }; + + let result = client.request_tile_ads(vec![placement_request], None); + + assert!(result.is_ok(), "Failed to request ads: {:?}", result.err()); + + let placements = result.unwrap(); + + assert!( + placements.contains_key("newtab_tile_1"), + "Response should contain placement_id 'newtab_tile_1'" + ); + + placements + .get("newtab_tile_1") + .expect("Placement should exist"); +} + +#[test] +#[ignore] +fn test_cache_works_using_real_timeouts() { + viaduct_dev::init_backend_dev(); + + let cache = HttpCache::builder("integration_tests.db") + .default_ttl(Duration::from_secs(60)) + .max_size(ByteSize::mib(1)) + .build() + .expect("cache build should succeed"); + + let url = Url::parse("https://ads.mozilla.org/v1/ads").unwrap(); + let req = Request::post(url).json(&serde_json::json!({ + "context_id": "12347fff-00b0-aaaa-0978-189231239808", + "placements": [ + { + "placement": "mock_pocket_billboard_1", + "count": 1, + } + ], + })); + + let test_ttl = 2; + + // First call: miss -> store + let o1 = cache + .send_with_policy( + &req.clone(), + &RequestCachePolicy { + mode: ads_client::http_cache::CacheMode::CacheFirst, + ttl_seconds: Some(test_ttl), + }, + ) + .unwrap(); + matches!(o1.cache_outcome, CacheOutcome::MissStored); + + // Second call: hit (no extra HTTP) but no refresh + let o2 = cache + .send_with_policy(&req, &RequestCachePolicy::default()) + .unwrap(); + matches!(o2.cache_outcome, CacheOutcome::Hit); + assert_eq!(o2.response.status, 200); + + // Third call: Miss due to timeout for the test_ttl duration + std::thread::sleep(Duration::from_secs(test_ttl)); + let o3 = cache + .send_with_policy(&req, &RequestCachePolicy::default()) + .unwrap(); + matches!(o3.cache_outcome, CacheOutcome::MissStored); + assert_eq!(o3.response.status, 200); +} diff --git a/third_party/rust/ads-client/uniffi.toml b/third_party/rust/ads-client/uniffi.toml new file mode 100644 index 0000000000000..974b55d72ad27 --- /dev/null +++ b/third_party/rust/ads-client/uniffi.toml @@ -0,0 +1,6 @@ +[bindings.kotlin] +package_name = "mozilla.appservices.ads_client" + +[bindings.swift] +ffi_module_name = "MozillaRustComponents" +ffi_module_filename = "ads_clientFFI" diff --git a/third_party/rust/logins/.cargo-checksum.json b/third_party/rust/logins/.cargo-checksum.json index 05fa03109f6e0..e655ab83cdd27 100644 --- a/third_party/rust/logins/.cargo-checksum.json +++ b/third_party/rust/logins/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"932aaba3c932b809da6c86cc2c808cbba983011b923545674e62dc3a164867eb","README.md":"2c25808f8371b5d9ceb58e51f71304a270d5b33dad5a280a6e95e06e606f4492","build.rs":"63ff52215682b7d516679e7aaeaaaf5d3ac98ebdf0c08361193c34c99506bfdf","metrics.yaml":"a875db3d9d759935f43131bd5c830307f8fe5d42df0e47768deb91e4568d0f6b","src/db.rs":"2bdc7ddc8ee6b342bdf9fb7d8f3dc105ff10fcd9383da368939b1adf99d12dc1","src/encryption.rs":"4208bdd76c5c216c9abd23b3c970f5ce811e047a75a5c720248944aa15f9e2f7","src/error.rs":"cf6fdbc0561989bdbc48944d3c6b1459cb36c11318236471c7a22ba17653a71b","src/lib.rs":"f9a56ad783794e23fa635ad38db62ccb8dfce5d9d44b0c58de3176c978291fe8","src/login.rs":"6685942f6047bd82bafc24af0c83411e5c12572921b6a5ac988426222a2d39ba","src/logins.udl":"92efe79861974a15e42a889e7ea2bc0d44f1089b78d23122f490fd2cf9020828","src/schema.rs":"804b1c23e4eb640e7b77f65d35204cec7dacf3c3d6a9c0928b06b7df9bf7ddc5","src/store.rs":"446b143b9cdd9fda5cec65fd7492a645713680bacff7ebcad2a9ed9eebe8075d","src/sync/engine.rs":"a3a78625f7ba79c8150f3321cbe3473312410e731b9ebfccf989a5f14d25eba1","src/sync/merge.rs":"6469f8bd582358c96bc35579ac228c95ad4bd64e84a29dda0cde0d87d2dcc5ed","src/sync/mod.rs":"00eb3bdd5fcac411fb314400a3d66aea874aa117db1003caf75ea43d385e372e","src/sync/payload.rs":"202f56cf0af9ffc3cc3d57c72ad61e4fa006bf5104386d9ef58a2611d539accb","src/sync/update_plan.rs":"c1d45f5972237785e274b1ecbd350cef7c1d7f530e66b9068d707eb1dfa1304e","src/util.rs":"1ced78e185164640e9859b0316f4798ccacd30bad9d6c549f9f650350a5f97b6","uniffi.toml":"1b1ea1a488fc051b9fe5a289e474462f7c676bcd02ca176713d885d280414bf6"},"package":null} \ No newline at end of file +{"files":{"Cargo.toml":"932aaba3c932b809da6c86cc2c808cbba983011b923545674e62dc3a164867eb","README.md":"2c25808f8371b5d9ceb58e51f71304a270d5b33dad5a280a6e95e06e606f4492","build.rs":"63ff52215682b7d516679e7aaeaaaf5d3ac98ebdf0c08361193c34c99506bfdf","metrics.yaml":"a875db3d9d759935f43131bd5c830307f8fe5d42df0e47768deb91e4568d0f6b","src/db.rs":"3f023ab6dc16fa593af9cb6d973e8e8dd28918b65b9f4993f4db1edeca7e67e5","src/encryption.rs":"4208bdd76c5c216c9abd23b3c970f5ce811e047a75a5c720248944aa15f9e2f7","src/error.rs":"ed3799d9ad49a7554613923313ff921b7fb71dbf7076b2b9198323d7eb2f4e68","src/lib.rs":"f9a56ad783794e23fa635ad38db62ccb8dfce5d9d44b0c58de3176c978291fe8","src/login.rs":"e427f19a5bb899a2f06eb613b3e249fd2febae84e46dba14bb1e59317ed420e6","src/logins.udl":"a6017f61fa3b28078b91bbef2fc71f28e33847468724cd4a4e59c67a2ef9e043","src/schema.rs":"384e10c123c6cc9fa5356a9718cc757eca157345047c5dc5c9df15dce8c19fe2","src/store.rs":"dcc09f3bdd162761b0c67b542ba448500be2b40a50f8ffb3dbbaa50c9b8795d5","src/sync/engine.rs":"ea96e598c3ab13b9c4d4373550580677713bc1066ab176e9e3f4666618929a1f","src/sync/merge.rs":"6fbfdd4239826098cf9c7cf6ee3d2d32251a03d92f013d7ba0be8cb459df1de4","src/sync/mod.rs":"00eb3bdd5fcac411fb314400a3d66aea874aa117db1003caf75ea43d385e372e","src/sync/payload.rs":"c116f627ffb5f9294e90988d879cc55e33a83984a090e36410e6cc40e25fbb95","src/sync/update_plan.rs":"2c0a3b926adee2fd68a6355332e7188277cd0f047342adbc83d6ce498cebe2b1","src/util.rs":"1ced78e185164640e9859b0316f4798ccacd30bad9d6c549f9f650350a5f97b6","uniffi.toml":"1b1ea1a488fc051b9fe5a289e474462f7c676bcd02ca176713d885d280414bf6"},"package":null} \ No newline at end of file diff --git a/third_party/rust/logins/src/db.rs b/third_party/rust/logins/src/db.rs index 8336bcdc45c6d..ba95dd774421e 100644 --- a/third_party/rust/logins/src/db.rs +++ b/third_party/rust/logins/src/db.rs @@ -306,6 +306,84 @@ impl LoginDb { Ok(()) } + pub fn record_breach(&self, id: &str, timestamp: i64) -> Result<()> { + let tx = self.unchecked_transaction()?; + self.ensure_local_overlay_exists(id)?; + self.mark_mirror_overridden(id)?; + self.execute_cached( + "UPDATE loginsL + SET timeOfLastBreach = :now_millis + WHERE guid = :guid", + named_params! { + ":now_millis": timestamp, + ":guid": id, + }, + )?; + tx.commit()?; + Ok(()) + } + + pub fn is_potentially_breached(&self, id: &str) -> Result { + let is_potentially_breached: bool = self.db.query_row( + "SELECT EXISTS(SELECT 1 FROM loginsL WHERE guid = :guid AND timeOfLastBreach IS NOT NULL AND timeOfLastBreach > timePasswordChanged)", + named_params! { ":guid": id }, + |row| row.get(0), + )?; + Ok(is_potentially_breached) + } + + pub fn reset_all_breaches(&self) -> Result<()> { + let tx = self.unchecked_transaction()?; + self.execute_cached( + "UPDATE loginsL + SET timeOfLastBreach = NULL + WHERE timeOfLastBreach IS NOT NULL", + [], + )?; + tx.commit()?; + Ok(()) + } + + pub fn is_breach_alert_dismissed(&self, id: &str) -> Result { + let is_breach_alert_dismissed: bool = self.db.query_row( + "SELECT EXISTS(SELECT 1 FROM loginsL WHERE guid = :guid AND timeOfLastBreach < timeLastBreachAlertDismissed)", + named_params! { ":guid": id }, + |row| row.get(0), + )?; + Ok(is_breach_alert_dismissed) + } + + /// Records that the user dismissed the breach alert for a login using the current time. + /// + /// For testing or when you need to specify a particular timestamp, use + /// [`record_breach_alert_dismissal_time`](Self::record_breach_alert_dismissal_time) instead. + pub fn record_breach_alert_dismissal(&self, id: &str) -> Result<()> { + let timestamp = util::system_time_ms_i64(SystemTime::now()); + self.record_breach_alert_dismissal_time(id, timestamp) + } + + /// Records that the user dismissed the breach alert for a login at a specific time. + /// + /// This is primarily useful for testing or when syncing dismissal times from other devices. + /// For normal usage, prefer [`record_breach_alert_dismissal`](Self::record_breach_alert_dismissal) + /// which automatically uses the current time. + pub fn record_breach_alert_dismissal_time(&self, id: &str, timestamp: i64) -> Result<()> { + let tx = self.unchecked_transaction()?; + self.ensure_local_overlay_exists(id)?; + self.mark_mirror_overridden(id)?; + self.execute_cached( + "UPDATE loginsL + SET timeLastBreachAlertDismissed = :now_millis + WHERE guid = :guid", + named_params! { + ":now_millis": timestamp, + ":guid": id, + }, + )?; + tx.commit()?; + Ok(()) + } + // The single place we insert new rows or update existing local rows. // just the SQL - no validation or anything. fn insert_new_login(&self, login: &EncryptedLogin) -> Result<()> { @@ -322,6 +400,8 @@ impl LoginDb { timeCreated, timeLastUsed, timePasswordChanged, + timeOfLastBreach, + timeLastBreachAlertDismissed, local_modified, is_deleted, sync_status @@ -337,6 +417,8 @@ impl LoginDb { :time_created, :time_last_used, :time_password_changed, + :time_of_last_breach, + :time_last_breach_alert_dismissed, :local_modified, 0, -- is_deleted {new} -- sync_status @@ -356,6 +438,8 @@ impl LoginDb { ":times_used": login.meta.times_used, ":time_last_used": login.meta.time_last_used, ":time_password_changed": login.meta.time_password_changed, + ":time_of_last_breach": login.fields.time_of_last_breach, + ":time_last_breach_alert_dismissed": login.fields.time_last_breach_alert_dismissed, ":local_modified": login.meta.time_created, ":sec_fields": login.sec_fields, ":guid": login.guid(), @@ -368,18 +452,18 @@ impl LoginDb { // assumes the "local overlay" exists, so the guid must too. let sql = format!( "UPDATE loginsL - SET local_modified = :now_millis, - timeLastUsed = :time_last_used, - timePasswordChanged = :time_password_changed, - httpRealm = :http_realm, - formActionOrigin = :form_action_origin, - usernameField = :username_field, - passwordField = :password_field, - timesUsed = :times_used, - secFields = :sec_fields, - origin = :origin, + SET local_modified = :now_millis, + timeLastUsed = :time_last_used, + timePasswordChanged = :time_password_changed, + httpRealm = :http_realm, + formActionOrigin = :form_action_origin, + usernameField = :username_field, + passwordField = :password_field, + timesUsed = :times_used, + secFields = :sec_fields, + origin = :origin, -- leave New records as they are, otherwise update them to `changed` - sync_status = max(sync_status, {changed}) + sync_status = max(sync_status, {changed}) WHERE guid = :guid", changed = SyncStatus::Changed as u8 ); @@ -459,6 +543,8 @@ impl LoginDb { http_realm: new_entry.http_realm, username_field: new_entry.username_field, password_field: new_entry.password_field, + time_of_last_breach: None, + time_last_breach_alert_dismissed: None, }, sec_fields, }; @@ -573,6 +659,8 @@ impl LoginDb { http_realm: entry.http_realm, username_field: entry.username_field, password_field: entry.password_field, + time_of_last_breach: None, + time_last_breach_alert_dismissed: None, }, sec_fields, }; @@ -1018,6 +1106,9 @@ pub mod test_utils { timePasswordChanged, timeCreated, + timeOfLastBreach, + timeLastBreachAlertDismissed, + guid ) VALUES ( :is_overridden, @@ -1035,6 +1126,9 @@ pub mod test_utils { :time_password_changed, :time_created, + :time_of_last_breach, + :time_last_breach_alert_dismissed, + :guid )"; let mut stmt = db.prepare_cached(sql)?; @@ -1052,6 +1146,8 @@ pub mod test_utils { ":time_last_used": login.meta.time_last_used, ":time_password_changed": login.meta.time_password_changed, ":time_created": login.meta.time_created, + ":time_of_last_breach": login.fields.time_of_last_breach, + ":time_last_breach_alert_dismissed": login.fields.time_last_breach_alert_dismissed, ":guid": login.guid_str(), })?; Ok(()) @@ -1678,6 +1774,155 @@ mod tests { assert_eq!(login2.meta.times_used, login.meta.times_used + 1); } + #[test] + fn test_breach_alerts() { + ensure_initialized(); + let db = LoginDb::open_in_memory(); + let login = db + .add( + LoginEntry { + origin: "https://www.example.com".into(), + http_realm: Some("https://www.example.com".into()), + username: "user1".into(), + password: "password1".into(), + ..Default::default() + }, + &*TEST_ENCDEC, + ) + .unwrap(); + // initial state + assert!(login.fields.time_of_last_breach.is_none()); + assert!(!db.is_potentially_breached(&login.meta.id).unwrap()); + assert!(login.fields.time_last_breach_alert_dismissed.is_none()); + + // Wait and use a time that's definitely after password was changed + thread::sleep(time::Duration::from_millis(50)); + let breach_time = util::system_time_ms_i64(SystemTime::now()); + db.record_breach(&login.meta.id, breach_time).unwrap(); + assert!(db.is_potentially_breached(&login.meta.id).unwrap()); + let login1 = db.get_by_id(&login.meta.id).unwrap().unwrap(); + assert!(login1.fields.time_of_last_breach.is_some()); + + // dismiss + db.record_breach_alert_dismissal(&login.meta.id).unwrap(); + let login2 = db.get_by_id(&login.meta.id).unwrap().unwrap(); + assert!(login2.fields.time_last_breach_alert_dismissed.is_some()); + + // reset + db.reset_all_breaches().unwrap(); + assert!(!db.is_potentially_breached(&login.meta.id).unwrap()); + let login3 = db.get_by_id(&login.meta.id).unwrap().unwrap(); + assert!(login3.fields.time_of_last_breach.is_none()); + + // Wait and use a time that's definitely after password was changed + thread::sleep(time::Duration::from_millis(50)); + let breach_time = util::system_time_ms_i64(SystemTime::now()); + db.record_breach(&login.meta.id, breach_time).unwrap(); + assert!(db.is_potentially_breached(&login.meta.id).unwrap()); + + // now change password + db.update( + &login.meta.id.clone(), + LoginEntry { + password: "changed-password".into(), + ..login.clone().decrypt(&*TEST_ENCDEC).unwrap().entry() + }, + &*TEST_ENCDEC, + ) + .unwrap(); + // not breached anymore + assert!(!db.is_potentially_breached(&login.meta.id).unwrap()); + } + + #[test] + fn test_breach_alert_fields_not_overwritten_by_update() { + ensure_initialized(); + let db = LoginDb::open_in_memory(); + let login = db + .add( + LoginEntry { + origin: "https://www.example.com".into(), + http_realm: Some("https://www.example.com".into()), + username: "user1".into(), + password: "password1".into(), + ..Default::default() + }, + &*TEST_ENCDEC, + ) + .unwrap(); + assert!(!db.is_potentially_breached(&login.meta.id).unwrap()); + + // Wait and use a time that's definitely after password was changed + thread::sleep(time::Duration::from_millis(50)); + let breach_time = util::system_time_ms_i64(SystemTime::now()); + db.record_breach(&login.meta.id, breach_time).unwrap(); + assert!(db.is_potentially_breached(&login.meta.id).unwrap()); + + // change some fields + db.update( + &login.meta.id.clone(), + LoginEntry { + username_field: "changed-username-field".into(), + ..login.clone().decrypt(&*TEST_ENCDEC).unwrap().entry() + }, + &*TEST_ENCDEC, + ) + .unwrap(); + + // breach still present + assert!(db.is_potentially_breached(&login.meta.id).unwrap()); + } + + #[test] + fn test_breach_alert_dismissal_with_specific_timestamp() { + ensure_initialized(); + let db = LoginDb::open_in_memory(); + let login = db + .add( + LoginEntry { + origin: "https://www.example.com".into(), + http_realm: Some("https://www.example.com".into()), + username: "user1".into(), + password: "password1".into(), + ..Default::default() + }, + &*TEST_ENCDEC, + ) + .unwrap(); + + // Record a breach that happened after password was created + // Use a timestamp that's definitely after the login's timePasswordChanged + let breach_time = login.meta.time_password_changed + 1000; + db.record_breach(&login.meta.id, breach_time).unwrap(); + assert!(db.is_potentially_breached(&login.meta.id).unwrap()); + + // Dismiss with a specific timestamp after the breach + let dismiss_time = breach_time + 500; + db.record_breach_alert_dismissal_time(&login.meta.id, dismiss_time) + .unwrap(); + + // Verify the exact timestamp was stored + let retrieved = db + .get_by_id(&login.meta.id) + .unwrap() + .unwrap() + .decrypt(&*TEST_ENCDEC) + .unwrap(); + assert_eq!( + retrieved.time_last_breach_alert_dismissed, + Some(dismiss_time) + ); + + // Verify the breach alert is considered dismissed + assert!(db.is_breach_alert_dismissed(&login.meta.id).unwrap()); + + // Test that dismissing before the breach time means it's not dismissed + let earlier_dismiss_time = breach_time - 100; + db.record_breach_alert_dismissal_time(&login.meta.id, earlier_dismiss_time) + .unwrap(); + assert!(!db.is_breach_alert_dismissed(&login.meta.id).unwrap()); + } + #[test] fn test_delete() { ensure_initialized(); diff --git a/third_party/rust/logins/src/error.rs b/third_party/rust/logins/src/error.rs index 0837a4c76dbb6..a08c20225ad35 100644 --- a/third_party/rust/logins/src/error.rs +++ b/third_party/rust/logins/src/error.rs @@ -113,6 +113,9 @@ pub enum Error { #[error("Migration Error: {0}")] MigrationError(String), + + #[error("IncompatibleVersion: {0}")] + IncompatibleVersion(i64), } /// Error::InvalidLogin subtypes diff --git a/third_party/rust/logins/src/login.rs b/third_party/rust/logins/src/login.rs index e3e150a722632..e486c0f0bfa7b 100644 --- a/third_party/rust/logins/src/login.rs +++ b/third_party/rust/logins/src/login.rs @@ -292,6 +292,8 @@ pub struct LoginFields { pub http_realm: Option, pub username_field: String, pub password_field: String, + pub time_of_last_breach: Option, + pub time_last_breach_alert_dismissed: Option, } /// LoginEntry fields that are stored encrypted @@ -355,6 +357,9 @@ pub struct LoginEntryWithMeta { } /// A bulk insert result entry, returned by `add_many` and `add_many_with_records` +/// Please note that although the success case is much larger than the error case, this is +/// negligible in real life, as we expect a very small success/error ratio. +#[allow(clippy::large_enum_variant)] pub enum BulkResultEntry { Success { login: Login }, Error { message: String }, @@ -465,6 +470,10 @@ pub struct Login { // secure fields pub username: String, pub password: String, + + // breach alerts + pub time_of_last_breach: Option, + pub time_last_breach_alert_dismissed: Option, } impl Login { @@ -484,6 +493,9 @@ impl Login { username: sec_fields.username, password: sec_fields.password, + + time_of_last_breach: fields.time_last_breach_alert_dismissed, + time_last_breach_alert_dismissed: fields.time_last_breach_alert_dismissed, } } @@ -525,6 +537,8 @@ impl Login { http_realm: self.http_realm, username_field: self.username_field, password_field: self.password_field, + time_of_last_breach: self.time_last_breach_alert_dismissed, + time_last_breach_alert_dismissed: self.time_last_breach_alert_dismissed, }, sec_fields, }) @@ -581,6 +595,10 @@ impl EncryptedLogin { username_field: string_or_default(row, "usernameField")?, password_field: string_or_default(row, "passwordField")?, + + time_of_last_breach: row.get::<_, Option>("timeOfLastBreach")?, + time_last_breach_alert_dismissed: row + .get::<_, Option>("timeLastBreachAlertDismissed")?, }, sec_fields: row.get("secFields")?, }; diff --git a/third_party/rust/logins/src/logins.udl b/third_party/rust/logins/src/logins.udl index 080489fb76ff5..5bae6d40d5779 100644 --- a/third_party/rust/logins/src/logins.udl +++ b/third_party/rust/logins/src/logins.udl @@ -22,7 +22,7 @@ namespace logins { /// Utility function to create a StaticKeyManager to be used for the time /// being until support lands for [trait implementation of an UniFFI /// interface](https://mozilla.github.io/uniffi-rs/next/proc_macro/index.html#structs-implementing-traits) - /// in UniFFI. + /// in UniFFI. KeyManager create_static_key_manager(string key); /// Similar to create_static_key_manager above, create a @@ -92,6 +92,15 @@ dictionary Login { // secure login fields string password; string username; + + // breach alert fields + /// These fields can be synced from Desktop and are NOT included in LoginEntry, + /// so update() will not modify them. Use the dedicated API methods to manipulate: + /// record_breach(), reset_all_breaches(), is_potentially_breached(), + /// record_breach_alert_dismissal(), record_breach_alert_dismissal_time(), + /// and is_breach_alert_dismissed(). + i64? time_of_last_breach; + i64? time_last_breach_alert_dismissed; }; /// Metrics tracking deletion of logins that cannot be decrypted, see `delete_undecryptable_records_for_remote_replacement` @@ -228,6 +237,31 @@ interface LoginStore { [Throws=LoginsApiError] void touch([ByRef] string id); + /// Determines whether a login’s password is potentially breached, based on the breach date and the time of the last password change. + [Throws=LoginsApiError] + boolean is_potentially_breached([ByRef] string id); + + /// Stores a known breach date for a login. + /// In Firefox Desktop this is updated once per session from Remote Settings. + [Throws=LoginsApiError] + void record_breach([ByRef] string id, i64 timestamp); + + /// Removes all recorded breaches for all logins (i.e. sets time_of_last_breach to null). + [Throws=LoginsApiError] + void reset_all_breaches(); + + /// Determines whether a breach alert has been dismissed, based on the breach date and the alert dismissal timestamp. + [Throws=LoginsApiError] + boolean is_breach_alert_dismissed([ByRef] string id); + + /// Stores that the user dismissed the breach alert for a login. + [Throws=LoginsApiError] + void record_breach_alert_dismissal([ByRef] string id); + + /// Stores the time at which the user dismissed the breach alert for a login. + [Throws=LoginsApiError] + void record_breach_alert_dismissal_time([ByRef] string id, i64 timestamp); + [Throws=LoginsApiError] boolean is_empty(); diff --git a/third_party/rust/logins/src/schema.rs b/third_party/rust/logins/src/schema.rs index 79376b01e0757..77b028a02c55e 100644 --- a/third_party/rust/logins/src/schema.rs +++ b/third_party/rust/logins/src/schema.rs @@ -95,7 +95,8 @@ use sql_support::ConnExt; /// Version 1: SQLCipher -> plaintext migration. /// Version 2: addition of `loginsM.enc_unknown_fields`. -pub(super) const VERSION: i64 = 2; +/// Version 3: addition of `timeOfLastBreach` and `timeLastBreachAlertDismissed`. +pub(super) const VERSION: i64 = 3; /// Every column shared by both tables except for `id` /// @@ -125,29 +126,34 @@ pub const COMMON_COLS: &str = " timeCreated, timeLastUsed, timePasswordChanged, - timesUsed + timesUsed, + timeOfLastBreach, + timeLastBreachAlertDismissed "; const COMMON_SQL: &str = " - id INTEGER PRIMARY KEY AUTOINCREMENT, - origin TEXT NOT NULL, + id INTEGER PRIMARY KEY AUTOINCREMENT, + origin TEXT NOT NULL, -- Exactly one of httpRealm or formActionOrigin should be set - httpRealm TEXT, - formActionOrigin TEXT, - usernameField TEXT, - passwordField TEXT, - timesUsed INTEGER NOT NULL DEFAULT 0, - timeCreated INTEGER NOT NULL, - timeLastUsed INTEGER, - timePasswordChanged INTEGER NOT NULL, - secFields TEXT, - guid TEXT NOT NULL UNIQUE + httpRealm TEXT, + formActionOrigin TEXT, + usernameField TEXT, + passwordField TEXT, + timesUsed INTEGER NOT NULL DEFAULT 0, + timeCreated INTEGER NOT NULL, + timeLastUsed INTEGER, + timePasswordChanged INTEGER NOT NULL, + timeOfLastBreach INTEGER, + timeLastBreachAlertDismissed INTEGER, + secFields TEXT, + guid TEXT NOT NULL UNIQUE "; lazy_static! { static ref CREATE_LOCAL_TABLE_SQL: String = format!( "CREATE TABLE IF NOT EXISTS loginsL ( {common_sql}, + -- Milliseconds, or NULL if never modified locally. local_modified INTEGER, @@ -220,26 +226,41 @@ pub(crate) fn init(db: &Connection) -> Result<()> { #[allow(clippy::unnecessary_wraps)] fn upgrade(db: &Connection, from: i64) -> Result<()> { debug!("Upgrading schema from {} to {}", from, VERSION); + if from == VERSION { return Ok(()); } - assert_ne!( - from, 0, - "Upgrading from user_version = 0 should already be handled (in `init`)" - ); - // Schema upgrades. - if from == 1 { - // Just one new nullable column makes this fairly easy - db.execute_batch("ALTER TABLE loginsM ADD enc_unknown_fields TEXT;")?; + for version in from..VERSION { + upgrade_from(db, version)?; } - // XXX - next migration, be sure to: - // from = 2; - // if from == 2 ... + db.execute_batch(&SET_VERSION_SQL)?; Ok(()) } +fn upgrade_from(db: &Connection, from: i64) -> Result<()> { + debug!("- running schema upgrade {}", from); + // Schema upgrades. + match from { + 0 => Err(Error::IncompatibleVersion(from)), + + // Just one new nullable column makes this fairly easy + 1 => Ok(db.execute_batch("ALTER TABLE loginsM ADD enc_unknown_fields TEXT;")?), + + // again, easy migratable nullable columns + 2 => Ok(db.execute_batch( + "ALTER TABLE loginsL ADD timeOfLastBreach INTEGER; + ALTER TABLE loginsM ADD timeOfLastBreach INTEGER; + ALTER TABLE loginsL ADD timeLastBreachAlertDismissed INTEGER; + ALTER TABLE loginsM ADD timeLastBreachAlertDismissed INTEGER;", + )?), + + // next migration, add here + _ => Err(Error::IncompatibleVersion(from)), + } +} + pub(crate) fn create(db: &Connection) -> Result<()> { debug!("Creating schema"); db.execute_all(&[ @@ -262,6 +283,46 @@ mod tests { use nss::ensure_initialized; use rusqlite::Connection; + // Snapshot of the schema in version 1. We use this to test that we can migrate from there to the + // current schema. + const SCHEMA_V1: &str = r#" +CREATE TABLE IF NOT EXISTS loginsL ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + origin TEXT NOT NULL, + httpRealm TEXT, + formActionOrigin TEXT, + usernameField TEXT, + passwordField TEXT, + timesUsed INTEGER NOT NULL DEFAULT 0, + timeCreated INTEGER NOT NULL, + timeLastUsed INTEGER, + timePasswordChanged INTEGER NOT NULL, + secFields TEXT, + + local_modified INTEGER, + + is_deleted TINYINT NOT NULL DEFAULT 0, + sync_status TINYINT NOT NULL DEFAULT 0 +); +CREATE TABLE IF NOT EXISTS loginsM ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + origin TEXT NOT NULL, + httpRealm TEXT, + formActionOrigin TEXT, + usernameField TEXT, + passwordField TEXT, + timesUsed INTEGER NOT NULL DEFAULT 0, + timeCreated INTEGER NOT NULL, + timeLastUsed INTEGER, + timePasswordChanged INTEGER NOT NULL, + secFields TEXT, + guid TEXT NOT NULL UNIQUE, + server_modified INTEGER NOT NULL, + is_overridden TINYINT NOT NULL DEFAULT 0 +); +PRAGMA user_version=1; + "#; + #[test] fn test_create_schema() { ensure_initialized(); @@ -271,51 +332,24 @@ mod tests { assert_eq!(version, VERSION); } + /// Test running all schema upgrades. + /// + /// If an upgrade fails, then this test will fail with a panic. #[test] - fn test_upgrade_v1() { + fn test_all_upgrades() { ensure_initialized(); // manually setup a V1 schema. let connection = Connection::open_in_memory().unwrap(); - connection - .execute_batch( - " - CREATE TABLE IF NOT EXISTS loginsM ( - -- this was common_sql as at v1 - id INTEGER PRIMARY KEY AUTOINCREMENT, - origin TEXT NOT NULL, - httpRealm TEXT, - formActionOrigin TEXT, - usernameField TEXT, - passwordField TEXT, - timesUsed INTEGER NOT NULL DEFAULT 0, - timeCreated INTEGER NOT NULL, - timeLastUsed INTEGER, - timePasswordChanged INTEGER NOT NULL, - secFields TEXT, - guid TEXT NOT NULL UNIQUE, - server_modified INTEGER NOT NULL, - is_overridden TINYINT NOT NULL DEFAULT 0 - -- note enc_unknown_fields missing - ); - ", - ) - .unwrap(); - // Call `create` to create the rest of the schema - the "if not exists" means loginsM - // will remain as v1. - create(&connection).unwrap(); - // but that set the version to VERSION - set it back to 1 so our upgrade code runs. - connection - .execute_batch("PRAGMA user_version = 1;") + connection.execute_batch(SCHEMA_V1).unwrap(); + let version = connection + .conn_ext_query_one::("PRAGMA user_version") .unwrap(); + assert_eq!(version, 1); // Now open the DB - it will create loginsL for us and migrate loginsM. let db = LoginDb::with_connection(connection, TEST_ENCDEC.clone()).unwrap(); // all migrations should have succeeded. let version = db.conn_ext_query_one::("PRAGMA user_version").unwrap(); assert_eq!(version, VERSION); - - // and ensure sql selecting the new column works. - db.execute_batch("SELECT enc_unknown_fields FROM loginsM") - .unwrap(); } } diff --git a/third_party/rust/logins/src/store.rs b/third_party/rust/logins/src/store.rs index 405c9b0efa686..4328463f96b5c 100644 --- a/third_party/rust/logins/src/store.rs +++ b/third_party/rust/logins/src/store.rs @@ -178,6 +178,37 @@ impl LoginStore { self.lock_db()?.touch(id) } + #[handle_error(Error)] + pub fn is_potentially_breached(&self, id: &str) -> ApiResult { + self.lock_db()?.is_potentially_breached(id) + } + + #[handle_error(Error)] + pub fn record_breach(&self, id: &str, timestamp: i64) -> ApiResult<()> { + self.lock_db()?.record_breach(id, timestamp) + } + + #[handle_error(Error)] + pub fn reset_all_breaches(&self) -> ApiResult<()> { + self.lock_db()?.reset_all_breaches() + } + + #[handle_error(Error)] + pub fn is_breach_alert_dismissed(&self, id: &str) -> ApiResult { + self.lock_db()?.is_breach_alert_dismissed(id) + } + + #[handle_error(Error)] + pub fn record_breach_alert_dismissal(&self, id: &str) -> ApiResult<()> { + self.lock_db()?.record_breach_alert_dismissal(id) + } + + #[handle_error(Error)] + pub fn record_breach_alert_dismissal_time(&self, id: &str, timestamp: i64) -> ApiResult<()> { + self.lock_db()? + .record_breach_alert_dismissal_time(id, timestamp) + } + #[handle_error(Error)] pub fn delete(&self, id: &str) -> ApiResult { self.lock_db()?.delete(id) diff --git a/third_party/rust/logins/src/sync/engine.rs b/third_party/rust/logins/src/sync/engine.rs index 1cb484e5c44be..0cde79e7b2a43 100644 --- a/third_party/rust/logins/src/sync/engine.rs +++ b/third_party/rust/logins/src/sync/engine.rs @@ -99,7 +99,7 @@ impl LoginsSyncEngine { let local_modified = UNIX_EPOCH + Duration::from_millis(dupe.meta.time_password_changed as u64); let local = LocalLogin::Alive { - login: dupe, + login: Box::new(dupe), local_modified, }; plan.plan_two_way_merge(local, (upstream, upstream_time)); diff --git a/third_party/rust/logins/src/sync/merge.rs b/third_party/rust/logins/src/sync/merge.rs index 2786d64e7f8d9..a64edf67a9071 100644 --- a/third_party/rust/logins/src/sync/merge.rs +++ b/third_party/rust/logins/src/sync/merge.rs @@ -40,7 +40,7 @@ pub(crate) enum LocalLogin { local_modified: SystemTime, }, Alive { - login: EncryptedLogin, + login: Box, local_modified: SystemTime, }, } @@ -72,7 +72,7 @@ impl LocalLogin { error_support::report_error!("logins-crypto", "empty ciphertext in the db",); } LocalLogin::Alive { - login, + login: Box::new(login), local_modified, } }) diff --git a/third_party/rust/logins/src/sync/payload.rs b/third_party/rust/logins/src/sync/payload.rs index a10a634b9450c..4901c16cb55b1 100644 --- a/third_party/rust/logins/src/sync/payload.rs +++ b/third_party/rust/logins/src/sync/payload.rs @@ -70,6 +70,8 @@ impl IncomingLogin { http_realm: p.http_realm, username_field: p.username_field, password_field: p.password_field, + time_of_last_breach: p.time_of_last_breach, + time_last_breach_alert_dismissed: p.time_last_breach_alert_dismissed, }; let original_sec_fields = SecureLoginFields { username: p.username, @@ -86,6 +88,8 @@ impl IncomingLogin { http_realm: login_entry.http_realm, username_field: login_entry.username_field, password_field: login_entry.password_field, + time_of_last_breach: None, + time_last_breach_alert_dismissed: None, }; let id = String::from(p.guid); let sec_fields = SecureLoginFields { @@ -169,6 +173,14 @@ pub struct LoginPayload { // Additional "unknown" round-tripped fields. #[serde(flatten)] unknown_fields: UnknownFields, + + #[serde(default)] + #[serde(deserialize_with = "deserialize_optional_timestamp")] + pub time_of_last_breach: Option, + + #[serde(default)] + #[serde(deserialize_with = "deserialize_optional_timestamp")] + pub time_last_breach_alert_dismissed: Option, } // These probably should be on the payload itself, but one refactor at a time! @@ -197,6 +209,8 @@ impl EncryptedLogin { time_password_changed: self.meta.time_password_changed, time_last_used: self.meta.time_last_used, times_used: self.meta.times_used, + time_of_last_breach: self.fields.time_of_last_breach, + time_last_breach_alert_dismissed: self.fields.time_last_breach_alert_dismissed, unknown_fields, }, )?) @@ -217,6 +231,18 @@ where Ok(i64::deserialize(deserializer).unwrap_or_default().max(0)) } +// Quiet clippy, since this function is passed to deserialiaze_with... +#[allow(clippy::unnecessary_wraps)] +fn deserialize_optional_timestamp<'de, D>( + deserializer: D, +) -> std::result::Result, D::Error> +where + D: serde::de::Deserializer<'de>, +{ + use serde::de::Deserialize; + Ok(i64::deserialize(deserializer).ok()) +} + #[cfg(not(feature = "keydb"))] #[cfg(test)] mod tests { diff --git a/third_party/rust/logins/src/sync/update_plan.rs b/third_party/rust/logins/src/sync/update_plan.rs index 122a2f7d40662..50a77583ccf60 100644 --- a/third_party/rust/logins/src/sync/update_plan.rs +++ b/third_party/rust/logins/src/sync/update_plan.rs @@ -449,7 +449,7 @@ mod tests { // And since the local age is 100, then the server should win. let server_record_timestamp = now.checked_sub(Duration::from_secs(1)).unwrap(); let local_login = LocalLogin::Alive { - login: login.clone(), + login: Box::new(login.clone()), local_modified, }; @@ -516,7 +516,7 @@ mod tests { // And since the local age is 1, the local record should win! let server_record_timestamp = now.checked_sub(Duration::from_secs(500)).unwrap(); let local_login = LocalLogin::Alive { - login: login.clone(), + login: Box::new(login.clone()), local_modified, }; let mirror_login = MirrorLogin { diff --git a/third_party/rust/nss/.cargo-checksum.json b/third_party/rust/nss/.cargo-checksum.json index aaa413e702ec5..1e2ed5458d894 100644 --- a/third_party/rust/nss/.cargo-checksum.json +++ b/third_party/rust/nss/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"a02789df36131f32a60b54968c08b6cb77b75735011d2d4a8932b4f538ddd139","README.md":"14dd59e435d179c21c3b4b880bbe3cc6e5999b9f9ac9431f3f9aa3f43902e3fa","fixtures/profile/.gitignore":"48343efff5004bb5907ff57074cf7bd3e7757661f1f0e8816388102848a41976","fixtures/profile/README.md":"a801e141cf954b809aed59d7a0f3a573dce23231035dbab95c6350117c346a75","fixtures/profile/key4.db":"4472e451ccf2e756181c36e94876849a35e044912a6c959fe2c057dd8f9e3708","fixtures/profile/logins.db":"561cbb773cf79d0d9934303d9ffc2f46dc690dfd87bcffa2df2f7e9009af2056","src/aes.rs":"bf3b115fecfc445fed978f43fed4076249c99d72db203acacd8297f418c347e5","src/cert.rs":"8195da7dc86bb9f60306106be08e622d0a116dabdbd31967e227435933ee50d0","src/ec.rs":"c495042a6f92254b7c9941ef0e253340922b0c1d1c43c7d3e725aa1068ae5d0b","src/ecdh.rs":"4acddfaebbc43f4e59c9dd0df56e582f5d0db65c4fd15dcc634c2e27d84efc2c","src/error.rs":"58a923bb8651160bb17c582cf876046792e79f3a190c8572f836b218f16cee74","src/lib.rs":"862ae2d8dbbe29f83579209286198b19bdccdcd81b99e55646d25de874a76d13","src/pbkdf2.rs":"40d5facfdc434571455283265823dd2b0334d2a8db0a09b50ee05d5b1f2a02d7","src/pk11/context.rs":"b4927fe401ed113d79f03aed1c0d9a007d3ce3b3706921ebc3e239e1f472dad6","src/pk11/mod.rs":"d78368654f9a8bc12f1403c4a096b63cf9834820ea6ed48418b9afaa0fc2299e","src/pk11/slot.rs":"99cb603b6d561b86d7655ca33da4aa0e4fb355d065f56d1bfc22b0778a745989","src/pk11/sym_key.rs":"b69b61844191f27e7efb2412a5a0aa7bfcd8ab70caae29a20d20694150ecf620","src/pk11/types.rs":"010e926224d29c9fe12d8804add17e2130f4c383bc8186ac1dad08d16678ae4e","src/pkixc.rs":"939fd8bd84be5eef57c6e9a970e1509e8cb94566ad42f1427a3beaaa214cc62b","src/secport.rs":"99a2c5112939bda2558dd7f0760f1092ab42052871448181083f92ce56f73f05","src/util.rs":"b92ebf5adde772dbc07142837a0196e5b2370e1d5582f11b9e88a385caaa352a"},"package":null} \ No newline at end of file +{"files":{"Cargo.toml":"a02789df36131f32a60b54968c08b6cb77b75735011d2d4a8932b4f538ddd139","README.md":"14dd59e435d179c21c3b4b880bbe3cc6e5999b9f9ac9431f3f9aa3f43902e3fa","fixtures/profile/.gitignore":"48343efff5004bb5907ff57074cf7bd3e7757661f1f0e8816388102848a41976","fixtures/profile/README.md":"a801e141cf954b809aed59d7a0f3a573dce23231035dbab95c6350117c346a75","fixtures/profile/key4.db":"4472e451ccf2e756181c36e94876849a35e044912a6c959fe2c057dd8f9e3708","fixtures/profile/logins.db":"29c6f202e1b9cd0741899ef0ec3f0e9dd76726076c0ee843aae4c36e0d050fa8","src/aes.rs":"bf3b115fecfc445fed978f43fed4076249c99d72db203acacd8297f418c347e5","src/cert.rs":"8195da7dc86bb9f60306106be08e622d0a116dabdbd31967e227435933ee50d0","src/ec.rs":"c495042a6f92254b7c9941ef0e253340922b0c1d1c43c7d3e725aa1068ae5d0b","src/ecdh.rs":"4acddfaebbc43f4e59c9dd0df56e582f5d0db65c4fd15dcc634c2e27d84efc2c","src/error.rs":"58a923bb8651160bb17c582cf876046792e79f3a190c8572f836b218f16cee74","src/lib.rs":"862ae2d8dbbe29f83579209286198b19bdccdcd81b99e55646d25de874a76d13","src/pbkdf2.rs":"40d5facfdc434571455283265823dd2b0334d2a8db0a09b50ee05d5b1f2a02d7","src/pk11/context.rs":"b4927fe401ed113d79f03aed1c0d9a007d3ce3b3706921ebc3e239e1f472dad6","src/pk11/mod.rs":"d78368654f9a8bc12f1403c4a096b63cf9834820ea6ed48418b9afaa0fc2299e","src/pk11/slot.rs":"99cb603b6d561b86d7655ca33da4aa0e4fb355d065f56d1bfc22b0778a745989","src/pk11/sym_key.rs":"b69b61844191f27e7efb2412a5a0aa7bfcd8ab70caae29a20d20694150ecf620","src/pk11/types.rs":"010e926224d29c9fe12d8804add17e2130f4c383bc8186ac1dad08d16678ae4e","src/pkixc.rs":"939fd8bd84be5eef57c6e9a970e1509e8cb94566ad42f1427a3beaaa214cc62b","src/secport.rs":"99a2c5112939bda2558dd7f0760f1092ab42052871448181083f92ce56f73f05","src/util.rs":"b92ebf5adde772dbc07142837a0196e5b2370e1d5582f11b9e88a385caaa352a"},"package":null} \ No newline at end of file diff --git a/third_party/rust/nss/fixtures/profile/logins.db b/third_party/rust/nss/fixtures/profile/logins.db index 93d7ce7517234..ebe1a36f4b2f2 100644 Binary files a/third_party/rust/nss/fixtures/profile/logins.db and b/third_party/rust/nss/fixtures/profile/logins.db differ diff --git a/third_party/rust/remote_settings/.cargo-checksum.json b/third_party/rust/remote_settings/.cargo-checksum.json index ebdf3b9494246..02bd6348d5249 100644 --- a/third_party/rust/remote_settings/.cargo-checksum.json +++ b/third_party/rust/remote_settings/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"19c95234033bcb34a4f179937308bd6075c8df6671d7b2f34b897fc3c33718e6","dumps/main/attachments/regions/world":"00b308033d44f61612b962f572765d14a3999586d92fc8b9fff2217a1ae070e8","dumps/main/attachments/regions/world-buffered":"1d3ed6954fac2a5b31302f5d3e8186c5fa08a20239afc0643ca5dfbb4d8a86fc","dumps/main/attachments/regions/world-buffered.meta.json":"914a71376a152036aceccb6877e079fbb9e3373c6219f24f00dd30e901a72cce","dumps/main/attachments/regions/world.meta.json":"2a47d77834997b98e563265d299723e7f7fd64c8c7a5731afc722862333d6fbd","dumps/main/attachments/search-config-icons/001500a9-1a6c-3f5a-ba15-a5f5a075d256":"fdadf15c6eae7933c3d254ae6311112e0bc8a422c38c758189dbe6a4d7f6b718","dumps/main/attachments/search-config-icons/001500a9-1a6c-3f5a-ba15-a5f5a075d256.meta.json":"6ed1e1c390a45360590e5a1e6d7823218e7b10860581646ddb5e368143aa72fc","dumps/main/attachments/search-config-icons/06cf7432-efd7-f244-927b-5e423005e1ea":"b75ef04a805325e303c4195833cdd077d3d406f360b25b72502fc55880b9150b","dumps/main/attachments/search-config-icons/06cf7432-efd7-f244-927b-5e423005e1ea.meta.json":"0d4cce0ed0dc6b2c46651bea32fc3cc2facfe8b341e1022b65f2cd2231f6b713","dumps/main/attachments/search-config-icons/0a57b0cf-34f0-4d09-96e4-dbd6e3355410":"a7493c6a9d70d60acccf73f62dcbc127a580469570aee60b7482cd42cdb59f69","dumps/main/attachments/search-config-icons/0a57b0cf-34f0-4d09-96e4-dbd6e3355410.meta.json":"d33a128c92b96af2e643158ed3b861d3726bd67a59907fed0795ab2210c82b96","dumps/main/attachments/search-config-icons/0d7668a8-c3f4-cfee-cbc8-536511528937":"7042293af6b04e421cb7b68dc599ac644b76939cdcf5970159e44f658dd6a0cc","dumps/main/attachments/search-config-icons/0d7668a8-c3f4-cfee-cbc8-536511528937.meta.json":"d6523508334a67b201326591606d7e225a04fc53fdce2c1b4d8afac1b41af6b0","dumps/main/attachments/search-config-icons/0eec5640-6fde-d6fe-322a-c72c6d5bd5a2":"64800e32b24b2c8c0582750e1657426d56abd74b65682e20e892f82710d120b6","dumps/main/attachments/search-config-icons/0eec5640-6fde-d6fe-322a-c72c6d5bd5a2.meta.json":"56fb61a078cc45abf7bc3b8fe89b60ef75f3b86ea61d63084749607c4662bbef","dumps/main/attachments/search-config-icons/101ce01d-2691-b729-7f16-9d389803384b":"62d2faa3a8322b1f643aab6e045837500ebe3049c5cb140cb44c4dfc7290337a","dumps/main/attachments/search-config-icons/101ce01d-2691-b729-7f16-9d389803384b.meta.json":"de134ed423a2bd92b4ad8cdf631aad6a83cc2c30f8df9ee251a435ee9f46f28f","dumps/main/attachments/search-config-icons/177aba42-9bed-4078-e36b-580e8794cd7f":"3b88f3ef3cbfaed127d679ec7e44a44fe8dcad688feb89a70a1a9447c1460d15","dumps/main/attachments/search-config-icons/177aba42-9bed-4078-e36b-580e8794cd7f.meta.json":"c35210da5afc11b3af156baf46c23fa523dafac7e8cb2738b4caef80ed48c72e","dumps/main/attachments/search-config-icons/25de0352-aabb-d31f-15f7-bf9299fb004c":"828c3ca82e9be483ae583e5a705dde57b24fd8431e192e3a2d0809871992afa5","dumps/main/attachments/search-config-icons/25de0352-aabb-d31f-15f7-bf9299fb004c.meta.json":"aa5483b5c65427c028a676b2fc13892f6fcaf602613183962744c43ca146d86a","dumps/main/attachments/search-config-icons/2bbe48f4-d3b8-c9e0-86e3-a54c37ec3335":"723ac3228124926537d5a61284d60e198a52895195f9f69b967c578ef7a012ad","dumps/main/attachments/search-config-icons/2bbe48f4-d3b8-c9e0-86e3-a54c37ec3335.meta.json":"d754b38d7e2f79e651d5fe110a7bb9855e0f7269e177be6d047453a36a52a4c5","dumps/main/attachments/search-config-icons/2e835b0e-9709-d1bb-9725-87f59f3445ca":"16ea89d4baa39529d7a84d5152867a4c6ed6867198c4dfa1648b1f43ce6a3f6f","dumps/main/attachments/search-config-icons/2e835b0e-9709-d1bb-9725-87f59f3445ca.meta.json":"7edb361a6610fdabb431a58bc170b7df3f179ca1fadebae6f2e98777b64b35c5","dumps/main/attachments/search-config-icons/2ecca3f8-c1ef-43cc-b053-886d1ae46c36":"774f0a7a613c6c5bea642e3628fa7436851de79e7da9713ad0c96d5db7f44300","dumps/main/attachments/search-config-icons/2ecca3f8-c1ef-43cc-b053-886d1ae46c36.meta.json":"194cb07dd29fd66121f05bbef38291e894291adcbc4c63c373b5f72f6f2e245e","dumps/main/attachments/search-config-icons/32d26d19-aeb0-5c01-32e8-f8970be9246f":"a64f553b79fbb8c45734310dac401ad253ccd05aeabfa58bb5541daa6d8caf70","dumps/main/attachments/search-config-icons/32d26d19-aeb0-5c01-32e8-f8970be9246f.meta.json":"6e56cf6a9470f575b283e40ed6a049e9dbffadcb59fa74a0f941b431c444d795","dumps/main/attachments/search-config-icons/39d0b17d-c020-4890-932f-83c0f6ed130b":"4f409c3ffc67cfa870b05e4089b6ffc3fc81448fa60afba447f0177cd1192b1e","dumps/main/attachments/search-config-icons/39d0b17d-c020-4890-932f-83c0f6ed130b.meta.json":"686c72d6cd220285d8b97af55474198027eab1b1af7ed89508c8935c9e00e7d4","dumps/main/attachments/search-config-icons/41135a88-093d-4077-873b-9de1ae133427":"c2718c5e416670426475dd8cc496f5464bf95224e8f8f0a72b695360ddc917c0","dumps/main/attachments/search-config-icons/41135a88-093d-4077-873b-9de1ae133427.meta.json":"a941fc27ca88b56eccbdec380ce2d3b911f4c62e4aba1f5399bc4498c6601d94","dumps/main/attachments/search-config-icons/41f0d805-3775-4988-8d8c-5ad8ccd86d1c":"755b8939c63b1fcc9acd05cd33ffed675397516d37b5bd8f3a03875e25d3fb43","dumps/main/attachments/search-config-icons/41f0d805-3775-4988-8d8c-5ad8ccd86d1c.meta.json":"25cafe7d629c6b006e15dee98987c26ef509f348ed0350a3ccf1f06838db86f3","dumps/main/attachments/search-config-icons/47da97b5-600f-c450-fd15-a52bb2169c11":"d7fdfd971d874f2ec6f209df6f6b8173d126cd3f7a25daacb94de4259efbcf16","dumps/main/attachments/search-config-icons/47da97b5-600f-c450-fd15-a52bb2169c11.meta.json":"e6b95ca29bf3e750819cf890ae8e879ac506d54b918c3c0ab065adc16a131188","dumps/main/attachments/search-config-icons/48c72361-cd67-412e-bd7f-f81a43c10791":"92da7ef030e1d3ed97235748156383e5d75fa6d2744bd124334ab47dc0b689a1","dumps/main/attachments/search-config-icons/48c72361-cd67-412e-bd7f-f81a43c10791.meta.json":"21d1320d60c981b9c9248b9b186fc49f9d95046a817d7a3145f48465236087e8","dumps/main/attachments/search-config-icons/4e271681-3e0f-91ac-9750-03f665efc171":"189ed3031a2cefd3150c9e5b37bee1ffbc1f7850f7ac0621e4b8d262f2c1048c","dumps/main/attachments/search-config-icons/4e271681-3e0f-91ac-9750-03f665efc171.meta.json":"0a401871b82f1c1cbca91232fd643be1cc1a76c07a48830eaa2a47cdfafb1f14","dumps/main/attachments/search-config-icons/50f6171f-8e7a-b41b-862e-f97397038fb2":"9140bd1b30953f41bc758d2c0ecc873f5163e4f51126c278991eccd38589c541","dumps/main/attachments/search-config-icons/50f6171f-8e7a-b41b-862e-f97397038fb2.meta.json":"805d8ce33bac4611ce12d1f84ef431313555d76bf996264736e401ceb6dabe98","dumps/main/attachments/search-config-icons/5203dd03-2c55-4b53-9c60-58258d587be1":"adb29f6fd95956401630d94967381ac473f57215d96a5bcf500a00e747731380","dumps/main/attachments/search-config-icons/5203dd03-2c55-4b53-9c60-58258d587be1.meta.json":"27a6f994c2c7653a33d380ac13c4cfbc00f543a92f229426aa71d85b1f968357","dumps/main/attachments/search-config-icons/5914932e-66ba-4126-8be5-d37beadd9532":"02f54211387baa59e4246356dc7344e48f39a412f2e5993d7f403aa538df7276","dumps/main/attachments/search-config-icons/5914932e-66ba-4126-8be5-d37beadd9532.meta.json":"2df77daeeef5892fdb7fdeecffb804638bd0d2f7da5b9e617f01303d786dcd09","dumps/main/attachments/search-config-icons/5ded611d-44b2-dc46-fd67-fb116888d75d":"877fb3aca13d2a7c656df1f94df3fa052afbb40b65c99ba5382392ff5499016e","dumps/main/attachments/search-config-icons/5ded611d-44b2-dc46-fd67-fb116888d75d.meta.json":"d1c75915fdc86461e755cd08e670b01da41cd3d76688afe692f841733a9b7ee0","dumps/main/attachments/search-config-icons/5e03d6f4-6ee9-8bc8-cf22-7a5f2cf55c41":"9cd3da38e3938549434d1c3cba6fed249ffa7d91d9a6d7ffb5f4184f527cac76","dumps/main/attachments/search-config-icons/5e03d6f4-6ee9-8bc8-cf22-7a5f2cf55c41.meta.json":"8506d9438825f2dc34875e04e0212e22a2652c5c43aa93e4d184d59ec765316f","dumps/main/attachments/search-config-icons/6644f26f-28ea-4222-929d-5d43a02dae05":"4f1bfbfec1441bd9a304ca7f3b8fd54130e94df185f7b28bb17c86ba517e13b7","dumps/main/attachments/search-config-icons/6644f26f-28ea-4222-929d-5d43a02dae05.meta.json":"f7d37f9c8b87480539cd981f463790c99ed15b2ffc5e3ff4786dd11c25228df4","dumps/main/attachments/search-config-icons/6d10d702-7bd6-1452-90a5-3df665a38f66":"f895a965b68d02e7391cc4504d9be75e1ba7f9b50a1dd59af77bb44a7769c08c","dumps/main/attachments/search-config-icons/6d10d702-7bd6-1452-90a5-3df665a38f66.meta.json":"d782d80f8187cf8051be89c6b8a1ef4700e0b84dcda006843d1fd2f266c4419b","dumps/main/attachments/search-config-icons/6e36a151-e4f4-4117-9067-1ca82c47d01a":"e9849089ffced59563896974afee0fceedac7fc8455bbeaa5bae230f54c933d9","dumps/main/attachments/search-config-icons/6e36a151-e4f4-4117-9067-1ca82c47d01a.meta.json":"0e5a64c06ea0ae875e8e0fdc850feddf5a8714b8290293dcd100d455de32ace0","dumps/main/attachments/search-config-icons/6f4da442-d31e-28f8-03af-797d16bbdd27":"dd5cab3711f778677859e86000a127ed07a6175e8e58aecb0fba71b825ce76d7","dumps/main/attachments/search-config-icons/6f4da442-d31e-28f8-03af-797d16bbdd27.meta.json":"0a947797180fdaf031a9c2d2f841b88243c90ff85f0af873f99ddd770fc59e8b","dumps/main/attachments/search-config-icons/7072564d-a573-4750-bf33-f0a07631c9eb":"0a653ea57472694ac05623d9b237e479232a0d65683d05f89661f996054e3276","dumps/main/attachments/search-config-icons/7072564d-a573-4750-bf33-f0a07631c9eb.meta.json":"bb8a256f72b37166fea2ecd4c3a59f49615854a7210e6963f2571f8dcb3d3a3f","dumps/main/attachments/search-config-icons/70fdd651-6c50-b7bb-09ec-7e85da259173":"31a793dad95b5ffd02d39ebf14fc40877596f418f5926247487265034181dc8f","dumps/main/attachments/search-config-icons/70fdd651-6c50-b7bb-09ec-7e85da259173.meta.json":"8c744e9d2f218256e63f1b1a2193f2fc4a7b980e72464e8d57fbe150446f2efc","dumps/main/attachments/search-config-icons/71f41a0c-5b70-4116-b30f-e62089083522":"5aad083bfcef256d433c1ffa571b814d16f61832bcd7565bf03909011f6a0bfc","dumps/main/attachments/search-config-icons/71f41a0c-5b70-4116-b30f-e62089083522.meta.json":"4a8f0c4e4ee643faa2f8d8cc4ddb8f87d14c740e8c9252223f826181c0117741","dumps/main/attachments/search-config-icons/74793ce1-a918-a5eb-d3c0-2aadaff3c88c":"ca8f102ac4f35189ebcb786d080843b603b234f89b8d8b1c0ef27a0ab7148182","dumps/main/attachments/search-config-icons/74793ce1-a918-a5eb-d3c0-2aadaff3c88c.meta.json":"60a7975cd79156623b0ca58be4110d152e50b6e9caaaa211dad1cd37eabb0345","dumps/main/attachments/search-config-icons/74f94dc2-caf6-4b90-b3d2-f3e2f7714d88":"3376e14529ed2e96c7dc491b3bf11914d7c8ff47a068311b2432c086c2ae0f28","dumps/main/attachments/search-config-icons/74f94dc2-caf6-4b90-b3d2-f3e2f7714d88.meta.json":"3a94a78a846f312c85c0609971b153aaba9819e2b657f25e3b0648a3956933d1","dumps/main/attachments/search-config-icons/764e3b14-fe16-4feb-8384-124c516a5afa":"71413ef23ac14ce2b7bb76f7f5d16b2df267239841a88ddab36b129481e00616","dumps/main/attachments/search-config-icons/764e3b14-fe16-4feb-8384-124c516a5afa.meta.json":"2f16dd51ade97a327d4e5f14d689f822a5c9061b9b27810bbccbf2f406a5e56f","dumps/main/attachments/search-config-icons/7bbe6c5c-fdb8-2845-a4f4-e1382e708a0e":"24daa27a3234d01b5add42e027b0a34000d0ab47c17fe3924c2ca267b7b61c19","dumps/main/attachments/search-config-icons/7bbe6c5c-fdb8-2845-a4f4-e1382e708a0e.meta.json":"308d345dbcfd7583e5f7460d34caf3b63d01b747a6e060a2b0971bf00ed2b22c","dumps/main/attachments/search-config-icons/7bf4ca37-e2b8-4d31-a1c3-979bc0e85131":"912d20feefcba57d43bffff5e245b8c1e3865155ed686d8ad253bbab71116e83","dumps/main/attachments/search-config-icons/7bf4ca37-e2b8-4d31-a1c3-979bc0e85131.meta.json":"3ec071b0a2940cd8892a72bd28d44237aecfd20d88303661348257ddb98aee43","dumps/main/attachments/search-config-icons/7c81cf98-7c11-4afd-8279-db89118a6dfb":"e988445d87afe0d285bea251705fc23eb70ac42426ab0d7a69d9276585c5573c","dumps/main/attachments/search-config-icons/7c81cf98-7c11-4afd-8279-db89118a6dfb.meta.json":"273dd09cad2a62459cc062e3b39b835d55a06b10cb7d5149aad77dd55451821f","dumps/main/attachments/search-config-icons/7cb4d88a-d4df-45b2-87e4-f896eaf1bbdb":"8dc2e75e6792b8374b20621fa2151ac24b4626e5c1f6a1abec4f912746441859","dumps/main/attachments/search-config-icons/7cb4d88a-d4df-45b2-87e4-f896eaf1bbdb.meta.json":"21d2522ab4e47477e72da3a2d2223e50e55fef442e2ba736d56df1e09593d76f","dumps/main/attachments/search-config-icons/7edaf4fe-a8a0-432b-86d2-bf75ebe80851":"27541cb376bdda829a6cf9cefd13da112728881e3daa4ac3c1178d4ce15f1e8b","dumps/main/attachments/search-config-icons/7edaf4fe-a8a0-432b-86d2-bf75ebe80851.meta.json":"3aea5d0652172940ac33e32628dcc6a03b79fe686c6de752482c8e3ae5cd70eb","dumps/main/attachments/search-config-icons/7efbed51-813c-581d-d8d3-f8758434e451":"b0c6d1850265e3c946917232ca6c6ace3dad23347bfab4f81351eac569326d34","dumps/main/attachments/search-config-icons/7efbed51-813c-581d-d8d3-f8758434e451.meta.json":"5a723c8f04bffa33a69a7054d30a4816caf1a3924081c85e1d9770126f761a96","dumps/main/attachments/search-config-icons/84bb4962-e571-227a-9ef6-2ac5f2aac361":"a1fd5d127a5f2590ddcd439b7a2abb3456b48217ea11daf0345b26e108f520e6","dumps/main/attachments/search-config-icons/84bb4962-e571-227a-9ef6-2ac5f2aac361.meta.json":"5cb0ebdde367b9754ddf6cbd01150414d27977b2d4c5f65cd6bbb89989388f3b","dumps/main/attachments/search-config-icons/87ac4cde-f581-398b-1e32-eb4079183b36":"33ca72f1eac56793d1fd811189cedef98004a067c85b1143083b564814a4b0db","dumps/main/attachments/search-config-icons/87ac4cde-f581-398b-1e32-eb4079183b36.meta.json":"d97eca8063cc17b99c81c55d4ff121d765c793e006ed252fec5f9539bd0fc339","dumps/main/attachments/search-config-icons/8831ce10-b1e4-6eb4-4975-83c67457288e":"ca3cc8786977f6ffeb0546ff8f3bb2b7fd240d1956fbf86777dbf0e8bec9c03b","dumps/main/attachments/search-config-icons/8831ce10-b1e4-6eb4-4975-83c67457288e.meta.json":"45274d848d1f6d398563bb46a2bfa3eee40ff16a5dbf0bbc8904db442f80702c","dumps/main/attachments/search-config-icons/890de5c4-0941-a116-473a-5d240e79497a":"6ba1f0fd1d12014cab32f74daab24dfa16fb26613ace20a1e595267621038a07","dumps/main/attachments/search-config-icons/890de5c4-0941-a116-473a-5d240e79497a.meta.json":"107547059360c3658dcf187a546ffb52bb23fa385e1338151043bebe82bbf640","dumps/main/attachments/search-config-icons/8abb10a7-212f-46b5-a7b4-244f414e3810":"f8780adb4d7b28f2f881db4ca7b697d8fc916cd9fa834ccc445fe7d4b72a6cc7","dumps/main/attachments/search-config-icons/8abb10a7-212f-46b5-a7b4-244f414e3810.meta.json":"5401603c7abbc6ca5bdddb8f9cca7eee2e26e5721cc73f23d95f600d5421d431","dumps/main/attachments/search-config-icons/91a9672d-e945-8e1e-0996-aefdb0190716":"5d53ef1866a08cc29011f5f2a9ce99bbf37cf42e80de7f0e8cc30d13337e8187","dumps/main/attachments/search-config-icons/91a9672d-e945-8e1e-0996-aefdb0190716.meta.json":"4e8ea36e3d659eb22ac7c86498003ca8885bab9c40685bb8ca7796a8230201da","dumps/main/attachments/search-config-icons/94a84724-c30f-4767-ba42-01cc37fc31a4":"98dca7e24cad0a1be96ef2c323e9759beb63c72440756f887e2482d9ce8e8969","dumps/main/attachments/search-config-icons/94a84724-c30f-4767-ba42-01cc37fc31a4.meta.json":"1070966901fe9db82b71bfa74ddeedd4f23ab2ed1eddaf201634e06a604e6006","dumps/main/attachments/search-config-icons/95ed201d-4ab8-4cb8-831d-454f53cab0f8":"3426b5100a6bdb45f8039f0c71a6b68193750ba7bae5b36e5ed31b2b7f372cda","dumps/main/attachments/search-config-icons/95ed201d-4ab8-4cb8-831d-454f53cab0f8.meta.json":"3447cd050619c1d2e5859147ab894a43da75235a580219306d8629e28a7a3eb5","dumps/main/attachments/search-config-icons/96327a73-c433-5eb4-a16d-b090cadfb80b":"ca6e972004f62355c1ea97656bc2328e1643971bdecab9c6b563d45593b8122e","dumps/main/attachments/search-config-icons/96327a73-c433-5eb4-a16d-b090cadfb80b.meta.json":"c4e3c9e6426e6f35410c287eef95b3e2134e54409e462f02dd440876c06b1bb4","dumps/main/attachments/search-config-icons/9802e63d-05ec-48ba-93f9-746e0981ad98":"6b1b073183eb0012daea0dce351a94d395c8a0b531b610e56eac52b3d1d1da0e","dumps/main/attachments/search-config-icons/9802e63d-05ec-48ba-93f9-746e0981ad98.meta.json":"cceb55c68db8dddd23d064364a281e982069bfe2bb55eba7d282fffcec2aa89f","dumps/main/attachments/search-config-icons/9d96547d-7575-49ca-8908-1e046b8ea90e":"6a743574353de0ec7c85b49f46b2b554caa0fc1d064b90544c5dea0fea2b8901","dumps/main/attachments/search-config-icons/9d96547d-7575-49ca-8908-1e046b8ea90e.meta.json":"10897754c5aafe0b84413afee5e9948fd799262a26aa07bca85fe6fb369beac4","dumps/main/attachments/search-config-icons/a06db97d-1210-ea2e-5474-0e2f7d295bfd":"617dec5d635efb0a12d0de935c6999ef0249f4a63c62bdcb96551518bc3d1812","dumps/main/attachments/search-config-icons/a06db97d-1210-ea2e-5474-0e2f7d295bfd.meta.json":"06cf576ca882bd7c2d54c18329e21e5b1a9cb7732d4954b52cbfa52979a67765","dumps/main/attachments/search-config-icons/a06dc3fd-4bdb-41f3-2ebc-4cbed06a9bd3":"d994f806b1e4225b50be5ab681b2cecf845cc216a19a432d878cea3cb815bafd","dumps/main/attachments/search-config-icons/a06dc3fd-4bdb-41f3-2ebc-4cbed06a9bd3.meta.json":"67524e18799023a017c7d9db1b9ba5c9cc3090d20f8154449a8f44ba22719104","dumps/main/attachments/search-config-icons/a2c7d4e9-f770-51e1-0963-3c2c8401631d":"1bf68aca7bfc75ca8485c3dac9a1daa13c1a3eb480688c32262096af6076adfa","dumps/main/attachments/search-config-icons/a2c7d4e9-f770-51e1-0963-3c2c8401631d.meta.json":"4ab103bba0f8fde581c3950c6c08cfcf6786104d8cbcba240499308f26958d04","dumps/main/attachments/search-config-icons/a83f24e4-602c-47bd-930c-ad0947ee1adf":"66612f999921d892645c8a2b37aa5dad17b134e7fdaed375a683baec7fc10697","dumps/main/attachments/search-config-icons/a83f24e4-602c-47bd-930c-ad0947ee1adf.meta.json":"f985ffbde6cf6ef972b6798c9336922dcfa29ca9a31e3aa4fae1962e069bdb0c","dumps/main/attachments/search-config-icons/b64f09fd-52d1-c48e-af23-4ce918e7bf3b":"c3e8300801c5c585662f14fd8e819d635efd9830783dc3c631212927866e9898","dumps/main/attachments/search-config-icons/b64f09fd-52d1-c48e-af23-4ce918e7bf3b.meta.json":"f7fd846d6717131e75865f8f5ed562e88f40be3dcf1603f2660b425dedabc7d1","dumps/main/attachments/search-config-icons/b882b24d-1776-4ef9-9016-0bdbd935eda3":"076352591c7077af4af5771918f80b5da9c6bf479327cc68390abdb158f3ec03","dumps/main/attachments/search-config-icons/b882b24d-1776-4ef9-9016-0bdbd935eda3.meta.json":"229139bca53bc63bd59b8f261f36c11fbe76b2b45dfeac2580261cf290c41365","dumps/main/attachments/search-config-icons/b8ca5a94-8fff-27ad-6e00-96e244a32e21":"1474c93e49c209aca2a2df2acb61b64574805106bead6edebd67287de21920e0","dumps/main/attachments/search-config-icons/b8ca5a94-8fff-27ad-6e00-96e244a32e21.meta.json":"6fd72c11afb4249d0166d8d98c552ee02d73c0e07f0578bfd3d7e67d70bcaee3","dumps/main/attachments/search-config-icons/b9424309-f601-4a69-98ca-ca68e65633e6":"601d72e7abde5ec864b3d8ca0031896f769107670b84c66053062481a56d8665","dumps/main/attachments/search-config-icons/b9424309-f601-4a69-98ca-ca68e65633e6.meta.json":"f299a7d56c5552fc592c66073d3e1e1d16ce4a99e935dcc0cad7dafcad6b9e3b","dumps/main/attachments/search-config-icons/c411adc1-9661-4fb5-a4c1-8cfe74911943":"150765e8e9b985ba5b820ac9b8e7623023d5a0e24f94663d5e9203d8d7598059","dumps/main/attachments/search-config-icons/c411adc1-9661-4fb5-a4c1-8cfe74911943.meta.json":"c5cc89d5f24ef1fa40b1c47c2e97eaeb01439b8d3b186b9c2fe716c94ead30f2","dumps/main/attachments/search-config-icons/cbf9e891-d079-2b28-5617-283450d463dd":"5b2c34b3c4e8dd898b664dba6c3786e2ff9869eff55d673aa48361f11325ed07","dumps/main/attachments/search-config-icons/cbf9e891-d079-2b28-5617-283450d463dd.meta.json":"b757806fd1b922d81bbecab94c73d3db98cfc2aa2791a4d5137112f795a732ee","dumps/main/attachments/search-config-icons/d87f251c-3e12-a8bf-e2d0-afd43d36c5f9":"865d76c8175a8f11dedc93f0bc212242a97a8a76adac870e8249368cecc81402","dumps/main/attachments/search-config-icons/d87f251c-3e12-a8bf-e2d0-afd43d36c5f9.meta.json":"22594c8870cbabe5fc5d2637509235202502661b466e9e37c5878716f323a34f","dumps/main/attachments/search-config-icons/db0e1627-ae89-4c25-8944-a9481d8512d9":"97a68f0b948b68bbf389a9ef43e2fe6c31ff8dc7889c939fdfdea79378576c67","dumps/main/attachments/search-config-icons/db0e1627-ae89-4c25-8944-a9481d8512d9.meta.json":"1eccc999dcd377af84cf63ed60b7ef23d5d4b936a1e465d12349a5366b1b012d","dumps/main/attachments/search-config-icons/e02f23df-8d48-2b1b-3b5c-6dd27302c61c":"247aa26993083705ce99a8e5612cdf262aca98cde86ba19afc964329ba95986a","dumps/main/attachments/search-config-icons/e02f23df-8d48-2b1b-3b5c-6dd27302c61c.meta.json":"06fc893d29cf406519611da9d1993a13bd9134192940c12bf64536ea571db4f0","dumps/main/attachments/search-config-icons/e718e983-09aa-e8f6-b25f-cd4b395d4785":"809697f48848e7c3638d5f3e0b224ea60b3800504e7bd8417854d55989b85196","dumps/main/attachments/search-config-icons/e718e983-09aa-e8f6-b25f-cd4b395d4785.meta.json":"0d9baef39747776500e5b83e72cd9d901fc09ac08247368dd2117bb4ec011f54","dumps/main/attachments/search-config-icons/e7547f62-187b-b641-d462-e54a3f813d9a":"c971ee33b8c0a57349669d957bf73070b0632b128c94748e845b57d5e15221a4","dumps/main/attachments/search-config-icons/e7547f62-187b-b641-d462-e54a3f813d9a.meta.json":"8ec4f6a7826966f2ff82632ef527366db3452ebc40c90a557602111f0ea956c9","dumps/main/attachments/search-config-icons/eb62e768-151b-45d1-9fe5-9e1d2a5991c5":"aa46b3d1ed8557e5bc7e71988cc6c46b00363b890d2a781973f9dc9073f8dd31","dumps/main/attachments/search-config-icons/eb62e768-151b-45d1-9fe5-9e1d2a5991c5.meta.json":"a06682b589df8dd63b1f25c01630ead55a89217f72c0bc04b391829af3fef59f","dumps/main/attachments/search-config-icons/f312610a-ebfb-a106-ea92-fd643c5d3636":"91d17ba44192a6430ffdb447ff3a11533ef964628f67c13480cc9470212d3d65","dumps/main/attachments/search-config-icons/f312610a-ebfb-a106-ea92-fd643c5d3636.meta.json":"ce26ab2382a7a67a55688330dd74127b4a980610f4030bde8eaaa20b81306559","dumps/main/attachments/search-config-icons/f943d7bc-872e-4a81-810f-94d26465da69":"69e0131f3e85657f827eb4ad3f01c25cf17540fe2db15c7e756f4dcfc1853dd2","dumps/main/attachments/search-config-icons/f943d7bc-872e-4a81-810f-94d26465da69.meta.json":"2e29a77bc8758ac3674f3a94b42fb871171fc53ae45bcb1fec6527c787758a23","dumps/main/attachments/search-config-icons/fa0fc42c-d91d-fca7-34eb-806ff46062dc":"6da5620880159634213e197fafca1dde0272153be3e4590818533fab8d040770","dumps/main/attachments/search-config-icons/fa0fc42c-d91d-fca7-34eb-806ff46062dc.meta.json":"0c3c0eb832be884f25186395b8bf08cdbe0a6e2845b9e55e7cbea5d0f183ed7d","dumps/main/attachments/search-config-icons/fca3e3ee-56cd-f474-dc31-307fd24a891d":"c4d88cfa5262f6d2cf76b167281d25821c9e1770684b739ed6ad3cf7277a121b","dumps/main/attachments/search-config-icons/fca3e3ee-56cd-f474-dc31-307fd24a891d.meta.json":"a40c37a5150e3745849f67305fe2fe1e06ef1c3901f6dc604a8e3f6c94e7b624","dumps/main/attachments/search-config-icons/fe75ce3f-1545-400c-b28c-ad771054e69f":"3a9d06951c7c9d2c19cd00533a760b0f8755b1e2e718af81c710297d030fbe44","dumps/main/attachments/search-config-icons/fe75ce3f-1545-400c-b28c-ad771054e69f.meta.json":"3f353e083d7a885f6d59d36c9276a2d325686a533cf8c502cd41a10172e763ea","dumps/main/attachments/search-config-icons/fed4f021-ff3e-942a-010e-afa43fda2136":"d7fdfd971d874f2ec6f209df6f6b8173d126cd3f7a25daacb94de4259efbcf16","dumps/main/attachments/search-config-icons/fed4f021-ff3e-942a-010e-afa43fda2136.meta.json":"740f77dcc93ece89fd55557baf399a4464373c81154b0a9758b8622f6c458253","dumps/main/attachments/translations-wasm/4fd32605-9889-4dd9-9fc7-577ad1136746":"a3a89d9ad0a4ed8f27bf3e403701b23f5709816f6376438503f2fa5b0182c2dc","dumps/main/attachments/translations-wasm/4fd32605-9889-4dd9-9fc7-577ad1136746.meta.json":"443145b56a534c87db789181355536a2a60062b74ef6de9aa7bdb38bc33c328e","dumps/main/regions.json":"e8990158373f82d3f89fed5089cf29e4177cc85904479128728e05025e9a0c0c","dumps/main/search-config-icons.json":"53cfd9548f2e8299fe976b628f32af90ddbec0ff9579483d051c7426b634f2bf","dumps/main/search-config-v2.json":"4a409b410fbb5cf72443cae17c76181ef5852b75d219e90db2af8a7141aa9ed3","dumps/main/search-telemetry-v2.json":"405b6a0e198f5cc2d2a4e484a5ccd2ca269bd5e08d03857cdc8e102c35f58708","dumps/main/summarizer-models-config.json":"2785f498567aebcc2c3157b360a06970b8174815506a6e018c4cf9130d150002","dumps/main/translations-models.json":"2445d5664eab4b3719094532cc36b1c22fa11a64a010d82158cbd9f477e16125","dumps/main/translations-wasm.json":"08f51644de84bb00ad059d131bef1621028ff802d5014a5c1c63c42c70e18fd3","src/cache.rs":"c6179802017b43885136e7d64004890cc13e8c2d4742e04073cf404b578f63db","src/client.rs":"323327aecef953b2ca5c3417d127b50b7cb1126203b192f588f500c5e0589c08","src/config.rs":"3e322bdab94855e17427187ffe92a59c1a64c9175d5e1f8605df2f6409a3c93f","src/context.rs":"43bab81026b6f1a2509d129e806fffd09ba80110d656798a02589985017a3c21","src/error.rs":"7f56c3ae167811c5a8413b73a7e6abcec2377c67cf48e7520929e15532678eef","src/jexl_filter.rs":"48a9d960e05dae444421f7c4ceeb45eab656f03f1e7071215c8e8d39aab56b54","src/lib.rs":"3e1cb064a01dd566b2359aaf25ede52251f033f05ea43afdd38fd62631b991c1","src/macros.rs":"6b06d0ba42ee95235bfd71bac1a0eed02f60c894775ebee64165648b10e932c4","src/schema.rs":"348e0d5ad1840aaae796b537d21381ef91bd75be262138bfec376d9f88d205b3","src/service.rs":"e917b3f0e9bfa53c7f8ca9c87fb8ca1d868800611955c216bf188d4cbf321bb4","src/signatures.rs":"5dc590aac827b03b144e0d98b8ed71998651aaf6bd09d29c9aef1d4c82cba23c","src/storage.rs":"c33dd92914770e96d3d44dbb9e95f512ce54261710a42c7cf4a896be348c529e","uniffi.toml":"bd7cc0e7c1981f53938f429c4f2541ac454ed4160a8a0b4670659e38acd23ee5"},"package":null} \ No newline at end of file +{"files":{"Cargo.toml":"19c95234033bcb34a4f179937308bd6075c8df6671d7b2f34b897fc3c33718e6","dumps/main/attachments/regions/world":"00b308033d44f61612b962f572765d14a3999586d92fc8b9fff2217a1ae070e8","dumps/main/attachments/regions/world-buffered":"1d3ed6954fac2a5b31302f5d3e8186c5fa08a20239afc0643ca5dfbb4d8a86fc","dumps/main/attachments/regions/world-buffered.meta.json":"914a71376a152036aceccb6877e079fbb9e3373c6219f24f00dd30e901a72cce","dumps/main/attachments/regions/world.meta.json":"2a47d77834997b98e563265d299723e7f7fd64c8c7a5731afc722862333d6fbd","dumps/main/attachments/search-config-icons/001500a9-1a6c-3f5a-ba15-a5f5a075d256":"fdadf15c6eae7933c3d254ae6311112e0bc8a422c38c758189dbe6a4d7f6b718","dumps/main/attachments/search-config-icons/001500a9-1a6c-3f5a-ba15-a5f5a075d256.meta.json":"6ed1e1c390a45360590e5a1e6d7823218e7b10860581646ddb5e368143aa72fc","dumps/main/attachments/search-config-icons/06cf7432-efd7-f244-927b-5e423005e1ea":"b75ef04a805325e303c4195833cdd077d3d406f360b25b72502fc55880b9150b","dumps/main/attachments/search-config-icons/06cf7432-efd7-f244-927b-5e423005e1ea.meta.json":"0d4cce0ed0dc6b2c46651bea32fc3cc2facfe8b341e1022b65f2cd2231f6b713","dumps/main/attachments/search-config-icons/0a57b0cf-34f0-4d09-96e4-dbd6e3355410":"a7493c6a9d70d60acccf73f62dcbc127a580469570aee60b7482cd42cdb59f69","dumps/main/attachments/search-config-icons/0a57b0cf-34f0-4d09-96e4-dbd6e3355410.meta.json":"d33a128c92b96af2e643158ed3b861d3726bd67a59907fed0795ab2210c82b96","dumps/main/attachments/search-config-icons/0d7668a8-c3f4-cfee-cbc8-536511528937":"7042293af6b04e421cb7b68dc599ac644b76939cdcf5970159e44f658dd6a0cc","dumps/main/attachments/search-config-icons/0d7668a8-c3f4-cfee-cbc8-536511528937.meta.json":"d6523508334a67b201326591606d7e225a04fc53fdce2c1b4d8afac1b41af6b0","dumps/main/attachments/search-config-icons/0eec5640-6fde-d6fe-322a-c72c6d5bd5a2":"64800e32b24b2c8c0582750e1657426d56abd74b65682e20e892f82710d120b6","dumps/main/attachments/search-config-icons/0eec5640-6fde-d6fe-322a-c72c6d5bd5a2.meta.json":"56fb61a078cc45abf7bc3b8fe89b60ef75f3b86ea61d63084749607c4662bbef","dumps/main/attachments/search-config-icons/101ce01d-2691-b729-7f16-9d389803384b":"62d2faa3a8322b1f643aab6e045837500ebe3049c5cb140cb44c4dfc7290337a","dumps/main/attachments/search-config-icons/101ce01d-2691-b729-7f16-9d389803384b.meta.json":"de134ed423a2bd92b4ad8cdf631aad6a83cc2c30f8df9ee251a435ee9f46f28f","dumps/main/attachments/search-config-icons/177aba42-9bed-4078-e36b-580e8794cd7f":"3b88f3ef3cbfaed127d679ec7e44a44fe8dcad688feb89a70a1a9447c1460d15","dumps/main/attachments/search-config-icons/177aba42-9bed-4078-e36b-580e8794cd7f.meta.json":"c35210da5afc11b3af156baf46c23fa523dafac7e8cb2738b4caef80ed48c72e","dumps/main/attachments/search-config-icons/25de0352-aabb-d31f-15f7-bf9299fb004c":"828c3ca82e9be483ae583e5a705dde57b24fd8431e192e3a2d0809871992afa5","dumps/main/attachments/search-config-icons/25de0352-aabb-d31f-15f7-bf9299fb004c.meta.json":"aa5483b5c65427c028a676b2fc13892f6fcaf602613183962744c43ca146d86a","dumps/main/attachments/search-config-icons/2bbe48f4-d3b8-c9e0-86e3-a54c37ec3335":"723ac3228124926537d5a61284d60e198a52895195f9f69b967c578ef7a012ad","dumps/main/attachments/search-config-icons/2bbe48f4-d3b8-c9e0-86e3-a54c37ec3335.meta.json":"d754b38d7e2f79e651d5fe110a7bb9855e0f7269e177be6d047453a36a52a4c5","dumps/main/attachments/search-config-icons/2e835b0e-9709-d1bb-9725-87f59f3445ca":"16ea89d4baa39529d7a84d5152867a4c6ed6867198c4dfa1648b1f43ce6a3f6f","dumps/main/attachments/search-config-icons/2e835b0e-9709-d1bb-9725-87f59f3445ca.meta.json":"7edb361a6610fdabb431a58bc170b7df3f179ca1fadebae6f2e98777b64b35c5","dumps/main/attachments/search-config-icons/2ecca3f8-c1ef-43cc-b053-886d1ae46c36":"774f0a7a613c6c5bea642e3628fa7436851de79e7da9713ad0c96d5db7f44300","dumps/main/attachments/search-config-icons/2ecca3f8-c1ef-43cc-b053-886d1ae46c36.meta.json":"194cb07dd29fd66121f05bbef38291e894291adcbc4c63c373b5f72f6f2e245e","dumps/main/attachments/search-config-icons/32d26d19-aeb0-5c01-32e8-f8970be9246f":"a64f553b79fbb8c45734310dac401ad253ccd05aeabfa58bb5541daa6d8caf70","dumps/main/attachments/search-config-icons/32d26d19-aeb0-5c01-32e8-f8970be9246f.meta.json":"6e56cf6a9470f575b283e40ed6a049e9dbffadcb59fa74a0f941b431c444d795","dumps/main/attachments/search-config-icons/39d0b17d-c020-4890-932f-83c0f6ed130b":"4f409c3ffc67cfa870b05e4089b6ffc3fc81448fa60afba447f0177cd1192b1e","dumps/main/attachments/search-config-icons/39d0b17d-c020-4890-932f-83c0f6ed130b.meta.json":"686c72d6cd220285d8b97af55474198027eab1b1af7ed89508c8935c9e00e7d4","dumps/main/attachments/search-config-icons/41135a88-093d-4077-873b-9de1ae133427":"c2718c5e416670426475dd8cc496f5464bf95224e8f8f0a72b695360ddc917c0","dumps/main/attachments/search-config-icons/41135a88-093d-4077-873b-9de1ae133427.meta.json":"a941fc27ca88b56eccbdec380ce2d3b911f4c62e4aba1f5399bc4498c6601d94","dumps/main/attachments/search-config-icons/41f0d805-3775-4988-8d8c-5ad8ccd86d1c":"755b8939c63b1fcc9acd05cd33ffed675397516d37b5bd8f3a03875e25d3fb43","dumps/main/attachments/search-config-icons/41f0d805-3775-4988-8d8c-5ad8ccd86d1c.meta.json":"25cafe7d629c6b006e15dee98987c26ef509f348ed0350a3ccf1f06838db86f3","dumps/main/attachments/search-config-icons/47da97b5-600f-c450-fd15-a52bb2169c11":"d7fdfd971d874f2ec6f209df6f6b8173d126cd3f7a25daacb94de4259efbcf16","dumps/main/attachments/search-config-icons/47da97b5-600f-c450-fd15-a52bb2169c11.meta.json":"e6b95ca29bf3e750819cf890ae8e879ac506d54b918c3c0ab065adc16a131188","dumps/main/attachments/search-config-icons/48c72361-cd67-412e-bd7f-f81a43c10791":"92da7ef030e1d3ed97235748156383e5d75fa6d2744bd124334ab47dc0b689a1","dumps/main/attachments/search-config-icons/48c72361-cd67-412e-bd7f-f81a43c10791.meta.json":"21d1320d60c981b9c9248b9b186fc49f9d95046a817d7a3145f48465236087e8","dumps/main/attachments/search-config-icons/4e271681-3e0f-91ac-9750-03f665efc171":"189ed3031a2cefd3150c9e5b37bee1ffbc1f7850f7ac0621e4b8d262f2c1048c","dumps/main/attachments/search-config-icons/4e271681-3e0f-91ac-9750-03f665efc171.meta.json":"0a401871b82f1c1cbca91232fd643be1cc1a76c07a48830eaa2a47cdfafb1f14","dumps/main/attachments/search-config-icons/50f6171f-8e7a-b41b-862e-f97397038fb2":"9140bd1b30953f41bc758d2c0ecc873f5163e4f51126c278991eccd38589c541","dumps/main/attachments/search-config-icons/50f6171f-8e7a-b41b-862e-f97397038fb2.meta.json":"805d8ce33bac4611ce12d1f84ef431313555d76bf996264736e401ceb6dabe98","dumps/main/attachments/search-config-icons/5203dd03-2c55-4b53-9c60-58258d587be1":"adb29f6fd95956401630d94967381ac473f57215d96a5bcf500a00e747731380","dumps/main/attachments/search-config-icons/5203dd03-2c55-4b53-9c60-58258d587be1.meta.json":"27a6f994c2c7653a33d380ac13c4cfbc00f543a92f229426aa71d85b1f968357","dumps/main/attachments/search-config-icons/5914932e-66ba-4126-8be5-d37beadd9532":"02f54211387baa59e4246356dc7344e48f39a412f2e5993d7f403aa538df7276","dumps/main/attachments/search-config-icons/5914932e-66ba-4126-8be5-d37beadd9532.meta.json":"2df77daeeef5892fdb7fdeecffb804638bd0d2f7da5b9e617f01303d786dcd09","dumps/main/attachments/search-config-icons/5ded611d-44b2-dc46-fd67-fb116888d75d":"877fb3aca13d2a7c656df1f94df3fa052afbb40b65c99ba5382392ff5499016e","dumps/main/attachments/search-config-icons/5ded611d-44b2-dc46-fd67-fb116888d75d.meta.json":"d1c75915fdc86461e755cd08e670b01da41cd3d76688afe692f841733a9b7ee0","dumps/main/attachments/search-config-icons/5e03d6f4-6ee9-8bc8-cf22-7a5f2cf55c41":"9cd3da38e3938549434d1c3cba6fed249ffa7d91d9a6d7ffb5f4184f527cac76","dumps/main/attachments/search-config-icons/5e03d6f4-6ee9-8bc8-cf22-7a5f2cf55c41.meta.json":"8506d9438825f2dc34875e04e0212e22a2652c5c43aa93e4d184d59ec765316f","dumps/main/attachments/search-config-icons/6644f26f-28ea-4222-929d-5d43a02dae05":"4f1bfbfec1441bd9a304ca7f3b8fd54130e94df185f7b28bb17c86ba517e13b7","dumps/main/attachments/search-config-icons/6644f26f-28ea-4222-929d-5d43a02dae05.meta.json":"f7d37f9c8b87480539cd981f463790c99ed15b2ffc5e3ff4786dd11c25228df4","dumps/main/attachments/search-config-icons/6d10d702-7bd6-1452-90a5-3df665a38f66":"f895a965b68d02e7391cc4504d9be75e1ba7f9b50a1dd59af77bb44a7769c08c","dumps/main/attachments/search-config-icons/6d10d702-7bd6-1452-90a5-3df665a38f66.meta.json":"d782d80f8187cf8051be89c6b8a1ef4700e0b84dcda006843d1fd2f266c4419b","dumps/main/attachments/search-config-icons/6e36a151-e4f4-4117-9067-1ca82c47d01a":"e9849089ffced59563896974afee0fceedac7fc8455bbeaa5bae230f54c933d9","dumps/main/attachments/search-config-icons/6e36a151-e4f4-4117-9067-1ca82c47d01a.meta.json":"0e5a64c06ea0ae875e8e0fdc850feddf5a8714b8290293dcd100d455de32ace0","dumps/main/attachments/search-config-icons/6f4da442-d31e-28f8-03af-797d16bbdd27":"dd5cab3711f778677859e86000a127ed07a6175e8e58aecb0fba71b825ce76d7","dumps/main/attachments/search-config-icons/6f4da442-d31e-28f8-03af-797d16bbdd27.meta.json":"0a947797180fdaf031a9c2d2f841b88243c90ff85f0af873f99ddd770fc59e8b","dumps/main/attachments/search-config-icons/7072564d-a573-4750-bf33-f0a07631c9eb":"0a653ea57472694ac05623d9b237e479232a0d65683d05f89661f996054e3276","dumps/main/attachments/search-config-icons/7072564d-a573-4750-bf33-f0a07631c9eb.meta.json":"bb8a256f72b37166fea2ecd4c3a59f49615854a7210e6963f2571f8dcb3d3a3f","dumps/main/attachments/search-config-icons/70fdd651-6c50-b7bb-09ec-7e85da259173":"31a793dad95b5ffd02d39ebf14fc40877596f418f5926247487265034181dc8f","dumps/main/attachments/search-config-icons/70fdd651-6c50-b7bb-09ec-7e85da259173.meta.json":"8c744e9d2f218256e63f1b1a2193f2fc4a7b980e72464e8d57fbe150446f2efc","dumps/main/attachments/search-config-icons/71f41a0c-5b70-4116-b30f-e62089083522":"5aad083bfcef256d433c1ffa571b814d16f61832bcd7565bf03909011f6a0bfc","dumps/main/attachments/search-config-icons/71f41a0c-5b70-4116-b30f-e62089083522.meta.json":"4a8f0c4e4ee643faa2f8d8cc4ddb8f87d14c740e8c9252223f826181c0117741","dumps/main/attachments/search-config-icons/74793ce1-a918-a5eb-d3c0-2aadaff3c88c":"ca8f102ac4f35189ebcb786d080843b603b234f89b8d8b1c0ef27a0ab7148182","dumps/main/attachments/search-config-icons/74793ce1-a918-a5eb-d3c0-2aadaff3c88c.meta.json":"60a7975cd79156623b0ca58be4110d152e50b6e9caaaa211dad1cd37eabb0345","dumps/main/attachments/search-config-icons/74f94dc2-caf6-4b90-b3d2-f3e2f7714d88":"3376e14529ed2e96c7dc491b3bf11914d7c8ff47a068311b2432c086c2ae0f28","dumps/main/attachments/search-config-icons/74f94dc2-caf6-4b90-b3d2-f3e2f7714d88.meta.json":"3a94a78a846f312c85c0609971b153aaba9819e2b657f25e3b0648a3956933d1","dumps/main/attachments/search-config-icons/764e3b14-fe16-4feb-8384-124c516a5afa":"71413ef23ac14ce2b7bb76f7f5d16b2df267239841a88ddab36b129481e00616","dumps/main/attachments/search-config-icons/764e3b14-fe16-4feb-8384-124c516a5afa.meta.json":"2f16dd51ade97a327d4e5f14d689f822a5c9061b9b27810bbccbf2f406a5e56f","dumps/main/attachments/search-config-icons/7bf4ca37-e2b8-4d31-a1c3-979bc0e85131":"912d20feefcba57d43bffff5e245b8c1e3865155ed686d8ad253bbab71116e83","dumps/main/attachments/search-config-icons/7bf4ca37-e2b8-4d31-a1c3-979bc0e85131.meta.json":"3ec071b0a2940cd8892a72bd28d44237aecfd20d88303661348257ddb98aee43","dumps/main/attachments/search-config-icons/7c81cf98-7c11-4afd-8279-db89118a6dfb":"e988445d87afe0d285bea251705fc23eb70ac42426ab0d7a69d9276585c5573c","dumps/main/attachments/search-config-icons/7c81cf98-7c11-4afd-8279-db89118a6dfb.meta.json":"273dd09cad2a62459cc062e3b39b835d55a06b10cb7d5149aad77dd55451821f","dumps/main/attachments/search-config-icons/7cb4d88a-d4df-45b2-87e4-f896eaf1bbdb":"8dc2e75e6792b8374b20621fa2151ac24b4626e5c1f6a1abec4f912746441859","dumps/main/attachments/search-config-icons/7cb4d88a-d4df-45b2-87e4-f896eaf1bbdb.meta.json":"21d2522ab4e47477e72da3a2d2223e50e55fef442e2ba736d56df1e09593d76f","dumps/main/attachments/search-config-icons/7edaf4fe-a8a0-432b-86d2-bf75ebe80851":"27541cb376bdda829a6cf9cefd13da112728881e3daa4ac3c1178d4ce15f1e8b","dumps/main/attachments/search-config-icons/7edaf4fe-a8a0-432b-86d2-bf75ebe80851.meta.json":"3aea5d0652172940ac33e32628dcc6a03b79fe686c6de752482c8e3ae5cd70eb","dumps/main/attachments/search-config-icons/7efbed51-813c-581d-d8d3-f8758434e451":"b0c6d1850265e3c946917232ca6c6ace3dad23347bfab4f81351eac569326d34","dumps/main/attachments/search-config-icons/7efbed51-813c-581d-d8d3-f8758434e451.meta.json":"5a723c8f04bffa33a69a7054d30a4816caf1a3924081c85e1d9770126f761a96","dumps/main/attachments/search-config-icons/84bb4962-e571-227a-9ef6-2ac5f2aac361":"a1fd5d127a5f2590ddcd439b7a2abb3456b48217ea11daf0345b26e108f520e6","dumps/main/attachments/search-config-icons/84bb4962-e571-227a-9ef6-2ac5f2aac361.meta.json":"5cb0ebdde367b9754ddf6cbd01150414d27977b2d4c5f65cd6bbb89989388f3b","dumps/main/attachments/search-config-icons/87ac4cde-f581-398b-1e32-eb4079183b36":"33ca72f1eac56793d1fd811189cedef98004a067c85b1143083b564814a4b0db","dumps/main/attachments/search-config-icons/87ac4cde-f581-398b-1e32-eb4079183b36.meta.json":"d97eca8063cc17b99c81c55d4ff121d765c793e006ed252fec5f9539bd0fc339","dumps/main/attachments/search-config-icons/8831ce10-b1e4-6eb4-4975-83c67457288e":"ca3cc8786977f6ffeb0546ff8f3bb2b7fd240d1956fbf86777dbf0e8bec9c03b","dumps/main/attachments/search-config-icons/8831ce10-b1e4-6eb4-4975-83c67457288e.meta.json":"45274d848d1f6d398563bb46a2bfa3eee40ff16a5dbf0bbc8904db442f80702c","dumps/main/attachments/search-config-icons/890de5c4-0941-a116-473a-5d240e79497a":"6ba1f0fd1d12014cab32f74daab24dfa16fb26613ace20a1e595267621038a07","dumps/main/attachments/search-config-icons/890de5c4-0941-a116-473a-5d240e79497a.meta.json":"107547059360c3658dcf187a546ffb52bb23fa385e1338151043bebe82bbf640","dumps/main/attachments/search-config-icons/8abb10a7-212f-46b5-a7b4-244f414e3810":"f8780adb4d7b28f2f881db4ca7b697d8fc916cd9fa834ccc445fe7d4b72a6cc7","dumps/main/attachments/search-config-icons/8abb10a7-212f-46b5-a7b4-244f414e3810.meta.json":"5401603c7abbc6ca5bdddb8f9cca7eee2e26e5721cc73f23d95f600d5421d431","dumps/main/attachments/search-config-icons/91a9672d-e945-8e1e-0996-aefdb0190716":"5d53ef1866a08cc29011f5f2a9ce99bbf37cf42e80de7f0e8cc30d13337e8187","dumps/main/attachments/search-config-icons/91a9672d-e945-8e1e-0996-aefdb0190716.meta.json":"4e8ea36e3d659eb22ac7c86498003ca8885bab9c40685bb8ca7796a8230201da","dumps/main/attachments/search-config-icons/94a84724-c30f-4767-ba42-01cc37fc31a4":"98dca7e24cad0a1be96ef2c323e9759beb63c72440756f887e2482d9ce8e8969","dumps/main/attachments/search-config-icons/94a84724-c30f-4767-ba42-01cc37fc31a4.meta.json":"1070966901fe9db82b71bfa74ddeedd4f23ab2ed1eddaf201634e06a604e6006","dumps/main/attachments/search-config-icons/96327a73-c433-5eb4-a16d-b090cadfb80b":"ca6e972004f62355c1ea97656bc2328e1643971bdecab9c6b563d45593b8122e","dumps/main/attachments/search-config-icons/96327a73-c433-5eb4-a16d-b090cadfb80b.meta.json":"c4e3c9e6426e6f35410c287eef95b3e2134e54409e462f02dd440876c06b1bb4","dumps/main/attachments/search-config-icons/9802e63d-05ec-48ba-93f9-746e0981ad98":"6b1b073183eb0012daea0dce351a94d395c8a0b531b610e56eac52b3d1d1da0e","dumps/main/attachments/search-config-icons/9802e63d-05ec-48ba-93f9-746e0981ad98.meta.json":"cceb55c68db8dddd23d064364a281e982069bfe2bb55eba7d282fffcec2aa89f","dumps/main/attachments/search-config-icons/9d96547d-7575-49ca-8908-1e046b8ea90e":"6a743574353de0ec7c85b49f46b2b554caa0fc1d064b90544c5dea0fea2b8901","dumps/main/attachments/search-config-icons/9d96547d-7575-49ca-8908-1e046b8ea90e.meta.json":"10897754c5aafe0b84413afee5e9948fd799262a26aa07bca85fe6fb369beac4","dumps/main/attachments/search-config-icons/a06db97d-1210-ea2e-5474-0e2f7d295bfd":"617dec5d635efb0a12d0de935c6999ef0249f4a63c62bdcb96551518bc3d1812","dumps/main/attachments/search-config-icons/a06db97d-1210-ea2e-5474-0e2f7d295bfd.meta.json":"06cf576ca882bd7c2d54c18329e21e5b1a9cb7732d4954b52cbfa52979a67765","dumps/main/attachments/search-config-icons/a06dc3fd-4bdb-41f3-2ebc-4cbed06a9bd3":"d994f806b1e4225b50be5ab681b2cecf845cc216a19a432d878cea3cb815bafd","dumps/main/attachments/search-config-icons/a06dc3fd-4bdb-41f3-2ebc-4cbed06a9bd3.meta.json":"67524e18799023a017c7d9db1b9ba5c9cc3090d20f8154449a8f44ba22719104","dumps/main/attachments/search-config-icons/a2c7d4e9-f770-51e1-0963-3c2c8401631d":"1bf68aca7bfc75ca8485c3dac9a1daa13c1a3eb480688c32262096af6076adfa","dumps/main/attachments/search-config-icons/a2c7d4e9-f770-51e1-0963-3c2c8401631d.meta.json":"4ab103bba0f8fde581c3950c6c08cfcf6786104d8cbcba240499308f26958d04","dumps/main/attachments/search-config-icons/a83f24e4-602c-47bd-930c-ad0947ee1adf":"66612f999921d892645c8a2b37aa5dad17b134e7fdaed375a683baec7fc10697","dumps/main/attachments/search-config-icons/a83f24e4-602c-47bd-930c-ad0947ee1adf.meta.json":"f985ffbde6cf6ef972b6798c9336922dcfa29ca9a31e3aa4fae1962e069bdb0c","dumps/main/attachments/search-config-icons/b64f09fd-52d1-c48e-af23-4ce918e7bf3b":"c3e8300801c5c585662f14fd8e819d635efd9830783dc3c631212927866e9898","dumps/main/attachments/search-config-icons/b64f09fd-52d1-c48e-af23-4ce918e7bf3b.meta.json":"f7fd846d6717131e75865f8f5ed562e88f40be3dcf1603f2660b425dedabc7d1","dumps/main/attachments/search-config-icons/b882b24d-1776-4ef9-9016-0bdbd935eda3":"076352591c7077af4af5771918f80b5da9c6bf479327cc68390abdb158f3ec03","dumps/main/attachments/search-config-icons/b882b24d-1776-4ef9-9016-0bdbd935eda3.meta.json":"229139bca53bc63bd59b8f261f36c11fbe76b2b45dfeac2580261cf290c41365","dumps/main/attachments/search-config-icons/b8ca5a94-8fff-27ad-6e00-96e244a32e21":"1474c93e49c209aca2a2df2acb61b64574805106bead6edebd67287de21920e0","dumps/main/attachments/search-config-icons/b8ca5a94-8fff-27ad-6e00-96e244a32e21.meta.json":"6fd72c11afb4249d0166d8d98c552ee02d73c0e07f0578bfd3d7e67d70bcaee3","dumps/main/attachments/search-config-icons/b9424309-f601-4a69-98ca-ca68e65633e6":"601d72e7abde5ec864b3d8ca0031896f769107670b84c66053062481a56d8665","dumps/main/attachments/search-config-icons/b9424309-f601-4a69-98ca-ca68e65633e6.meta.json":"f299a7d56c5552fc592c66073d3e1e1d16ce4a99e935dcc0cad7dafcad6b9e3b","dumps/main/attachments/search-config-icons/c411adc1-9661-4fb5-a4c1-8cfe74911943":"150765e8e9b985ba5b820ac9b8e7623023d5a0e24f94663d5e9203d8d7598059","dumps/main/attachments/search-config-icons/c411adc1-9661-4fb5-a4c1-8cfe74911943.meta.json":"c5cc89d5f24ef1fa40b1c47c2e97eaeb01439b8d3b186b9c2fe716c94ead30f2","dumps/main/attachments/search-config-icons/cbf9e891-d079-2b28-5617-283450d463dd":"5b2c34b3c4e8dd898b664dba6c3786e2ff9869eff55d673aa48361f11325ed07","dumps/main/attachments/search-config-icons/cbf9e891-d079-2b28-5617-283450d463dd.meta.json":"b757806fd1b922d81bbecab94c73d3db98cfc2aa2791a4d5137112f795a732ee","dumps/main/attachments/search-config-icons/d87f251c-3e12-a8bf-e2d0-afd43d36c5f9":"865d76c8175a8f11dedc93f0bc212242a97a8a76adac870e8249368cecc81402","dumps/main/attachments/search-config-icons/d87f251c-3e12-a8bf-e2d0-afd43d36c5f9.meta.json":"22594c8870cbabe5fc5d2637509235202502661b466e9e37c5878716f323a34f","dumps/main/attachments/search-config-icons/db0e1627-ae89-4c25-8944-a9481d8512d9":"97a68f0b948b68bbf389a9ef43e2fe6c31ff8dc7889c939fdfdea79378576c67","dumps/main/attachments/search-config-icons/db0e1627-ae89-4c25-8944-a9481d8512d9.meta.json":"1eccc999dcd377af84cf63ed60b7ef23d5d4b936a1e465d12349a5366b1b012d","dumps/main/attachments/search-config-icons/e02f23df-8d48-2b1b-3b5c-6dd27302c61c":"247aa26993083705ce99a8e5612cdf262aca98cde86ba19afc964329ba95986a","dumps/main/attachments/search-config-icons/e02f23df-8d48-2b1b-3b5c-6dd27302c61c.meta.json":"06fc893d29cf406519611da9d1993a13bd9134192940c12bf64536ea571db4f0","dumps/main/attachments/search-config-icons/e718e983-09aa-e8f6-b25f-cd4b395d4785":"809697f48848e7c3638d5f3e0b224ea60b3800504e7bd8417854d55989b85196","dumps/main/attachments/search-config-icons/e718e983-09aa-e8f6-b25f-cd4b395d4785.meta.json":"0d9baef39747776500e5b83e72cd9d901fc09ac08247368dd2117bb4ec011f54","dumps/main/attachments/search-config-icons/e7547f62-187b-b641-d462-e54a3f813d9a":"c971ee33b8c0a57349669d957bf73070b0632b128c94748e845b57d5e15221a4","dumps/main/attachments/search-config-icons/e7547f62-187b-b641-d462-e54a3f813d9a.meta.json":"8ec4f6a7826966f2ff82632ef527366db3452ebc40c90a557602111f0ea956c9","dumps/main/attachments/search-config-icons/eb62e768-151b-45d1-9fe5-9e1d2a5991c5":"aa46b3d1ed8557e5bc7e71988cc6c46b00363b890d2a781973f9dc9073f8dd31","dumps/main/attachments/search-config-icons/eb62e768-151b-45d1-9fe5-9e1d2a5991c5.meta.json":"a06682b589df8dd63b1f25c01630ead55a89217f72c0bc04b391829af3fef59f","dumps/main/attachments/search-config-icons/f312610a-ebfb-a106-ea92-fd643c5d3636":"91d17ba44192a6430ffdb447ff3a11533ef964628f67c13480cc9470212d3d65","dumps/main/attachments/search-config-icons/f312610a-ebfb-a106-ea92-fd643c5d3636.meta.json":"ce26ab2382a7a67a55688330dd74127b4a980610f4030bde8eaaa20b81306559","dumps/main/attachments/search-config-icons/f943d7bc-872e-4a81-810f-94d26465da69":"69e0131f3e85657f827eb4ad3f01c25cf17540fe2db15c7e756f4dcfc1853dd2","dumps/main/attachments/search-config-icons/f943d7bc-872e-4a81-810f-94d26465da69.meta.json":"2e29a77bc8758ac3674f3a94b42fb871171fc53ae45bcb1fec6527c787758a23","dumps/main/attachments/search-config-icons/fa0fc42c-d91d-fca7-34eb-806ff46062dc":"6da5620880159634213e197fafca1dde0272153be3e4590818533fab8d040770","dumps/main/attachments/search-config-icons/fa0fc42c-d91d-fca7-34eb-806ff46062dc.meta.json":"0c3c0eb832be884f25186395b8bf08cdbe0a6e2845b9e55e7cbea5d0f183ed7d","dumps/main/attachments/search-config-icons/fca3e3ee-56cd-f474-dc31-307fd24a891d":"c4d88cfa5262f6d2cf76b167281d25821c9e1770684b739ed6ad3cf7277a121b","dumps/main/attachments/search-config-icons/fca3e3ee-56cd-f474-dc31-307fd24a891d.meta.json":"a40c37a5150e3745849f67305fe2fe1e06ef1c3901f6dc604a8e3f6c94e7b624","dumps/main/attachments/search-config-icons/fe75ce3f-1545-400c-b28c-ad771054e69f":"3a9d06951c7c9d2c19cd00533a760b0f8755b1e2e718af81c710297d030fbe44","dumps/main/attachments/search-config-icons/fe75ce3f-1545-400c-b28c-ad771054e69f.meta.json":"3f353e083d7a885f6d59d36c9276a2d325686a533cf8c502cd41a10172e763ea","dumps/main/attachments/search-config-icons/fed4f021-ff3e-942a-010e-afa43fda2136":"d7fdfd971d874f2ec6f209df6f6b8173d126cd3f7a25daacb94de4259efbcf16","dumps/main/attachments/search-config-icons/fed4f021-ff3e-942a-010e-afa43fda2136.meta.json":"740f77dcc93ece89fd55557baf399a4464373c81154b0a9758b8622f6c458253","dumps/main/attachments/translations-wasm/4fd32605-9889-4dd9-9fc7-577ad1136746":"a3a89d9ad0a4ed8f27bf3e403701b23f5709816f6376438503f2fa5b0182c2dc","dumps/main/attachments/translations-wasm/4fd32605-9889-4dd9-9fc7-577ad1136746.meta.json":"443145b56a534c87db789181355536a2a60062b74ef6de9aa7bdb38bc33c328e","dumps/main/regions.json":"e8990158373f82d3f89fed5089cf29e4177cc85904479128728e05025e9a0c0c","dumps/main/regions.timestamp":"a0109417e42fae00eee42898223a4e4eeadc8d0567ad0aa5a379ced494aac5bf","dumps/main/search-config-icons.json":"9b83df4a7c80c7136917f4ae89624c7f5fc25bb710d77e487d53178c5543c9fb","dumps/main/search-config-icons.timestamp":"eb8bfe4d2b9fce7cde34b9f41f513664015a86ba35254a3524df327b8a29080b","dumps/main/search-config-v2.json":"4a409b410fbb5cf72443cae17c76181ef5852b75d219e90db2af8a7141aa9ed3","dumps/main/search-config-v2.timestamp":"912e3976dc7e6bfd5585322ae4375962ec220148815799fcc949982449872beb","dumps/main/search-telemetry-v2.json":"405b6a0e198f5cc2d2a4e484a5ccd2ca269bd5e08d03857cdc8e102c35f58708","dumps/main/search-telemetry-v2.timestamp":"95f877d4333a744273784096aa9a87f381c40f44bcbd539d17d3686874fae9f9","dumps/main/summarizer-models-config.json":"2785f498567aebcc2c3157b360a06970b8174815506a6e018c4cf9130d150002","dumps/main/summarizer-models-config.timestamp":"a1a521e82e18713743a7c6b7c437072a1b371019fd933ca8138938cd52f1d728","dumps/main/translations-models.json":"2445d5664eab4b3719094532cc36b1c22fa11a64a010d82158cbd9f477e16125","dumps/main/translations-models.timestamp":"d0b4624dcc17bd16572d34e64161ddcc5365d8ce8880f82e6e44e9063efba8dd","dumps/main/translations-wasm.json":"08f51644de84bb00ad059d131bef1621028ff802d5014a5c1c63c42c70e18fd3","dumps/main/translations-wasm.timestamp":"e2f810185686f4fd61c898403428ed17dafa3402272a2dcd585df732527eff89","src/cache.rs":"c6179802017b43885136e7d64004890cc13e8c2d4742e04073cf404b578f63db","src/client.rs":"259e79368110ce96a9e837f73b5f1eb294c4fd7735d837613a28d0a2e15c01dc","src/config.rs":"3e322bdab94855e17427187ffe92a59c1a64c9175d5e1f8605df2f6409a3c93f","src/context.rs":"43bab81026b6f1a2509d129e806fffd09ba80110d656798a02589985017a3c21","src/error.rs":"7f56c3ae167811c5a8413b73a7e6abcec2377c67cf48e7520929e15532678eef","src/jexl_filter.rs":"48a9d960e05dae444421f7c4ceeb45eab656f03f1e7071215c8e8d39aab56b54","src/lib.rs":"3e1cb064a01dd566b2359aaf25ede52251f033f05ea43afdd38fd62631b991c1","src/macros.rs":"a16189ed0c6de18d1c66ee9204edc56541d1b987513eb7491c2472a962263f51","src/schema.rs":"348e0d5ad1840aaae796b537d21381ef91bd75be262138bfec376d9f88d205b3","src/service.rs":"e917b3f0e9bfa53c7f8ca9c87fb8ca1d868800611955c216bf188d4cbf321bb4","src/signatures.rs":"5dc590aac827b03b144e0d98b8ed71998651aaf6bd09d29c9aef1d4c82cba23c","src/storage.rs":"c33dd92914770e96d3d44dbb9e95f512ce54261710a42c7cf4a896be348c529e","uniffi.toml":"bd7cc0e7c1981f53938f429c4f2541ac454ed4160a8a0b4670659e38acd23ee5"},"package":null} \ No newline at end of file diff --git a/third_party/rust/remote_settings/dumps/main/attachments/search-config-icons/7bbe6c5c-fdb8-2845-a4f4-e1382e708a0e b/third_party/rust/remote_settings/dumps/main/attachments/search-config-icons/7bbe6c5c-fdb8-2845-a4f4-e1382e708a0e deleted file mode 100644 index ba687ca8e70bc..0000000000000 Binary files a/third_party/rust/remote_settings/dumps/main/attachments/search-config-icons/7bbe6c5c-fdb8-2845-a4f4-e1382e708a0e and /dev/null differ diff --git a/third_party/rust/remote_settings/dumps/main/attachments/search-config-icons/7bbe6c5c-fdb8-2845-a4f4-e1382e708a0e.meta.json b/third_party/rust/remote_settings/dumps/main/attachments/search-config-icons/7bbe6c5c-fdb8-2845-a4f4-e1382e708a0e.meta.json deleted file mode 100644 index 2f3be12d73d26..0000000000000 --- a/third_party/rust/remote_settings/dumps/main/attachments/search-config-icons/7bbe6c5c-fdb8-2845-a4f4-e1382e708a0e.meta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "location": "main-workspace/search-config-icons/4d6f988d-8905-4aa7-aeea-5b04a6197767.ico", - "hash": "24daa27a3234d01b5add42e027b0a34000d0ab47c17fe3924c2ca267b7b61c19", - "size": 5430 -} \ No newline at end of file diff --git a/third_party/rust/remote_settings/dumps/main/attachments/search-config-icons/95ed201d-4ab8-4cb8-831d-454f53cab0f8 b/third_party/rust/remote_settings/dumps/main/attachments/search-config-icons/95ed201d-4ab8-4cb8-831d-454f53cab0f8 deleted file mode 100644 index e5c76d29bde86..0000000000000 Binary files a/third_party/rust/remote_settings/dumps/main/attachments/search-config-icons/95ed201d-4ab8-4cb8-831d-454f53cab0f8 and /dev/null differ diff --git a/third_party/rust/remote_settings/dumps/main/attachments/search-config-icons/95ed201d-4ab8-4cb8-831d-454f53cab0f8.meta.json b/third_party/rust/remote_settings/dumps/main/attachments/search-config-icons/95ed201d-4ab8-4cb8-831d-454f53cab0f8.meta.json deleted file mode 100644 index 7d5c847fb15fb..0000000000000 --- a/third_party/rust/remote_settings/dumps/main/attachments/search-config-icons/95ed201d-4ab8-4cb8-831d-454f53cab0f8.meta.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "location": "main-workspace/search-config-icons/1229ffe4-7a6f-46d7-b664-5596df0aa730.png", - "hash": "3426b5100a6bdb45f8039f0c71a6b68193750ba7bae5b36e5ed31b2b7f372cda", - "size": 1357 -} \ No newline at end of file diff --git a/third_party/rust/remote_settings/dumps/main/regions.timestamp b/third_party/rust/remote_settings/dumps/main/regions.timestamp new file mode 100644 index 0000000000000..60ae2308d5e38 --- /dev/null +++ b/third_party/rust/remote_settings/dumps/main/regions.timestamp @@ -0,0 +1 @@ +1600363002708 \ No newline at end of file diff --git a/third_party/rust/remote_settings/dumps/main/search-config-icons.json b/third_party/rust/remote_settings/dumps/main/search-config-icons.json index 4e4f1783772a5..7c0e10d6118f3 100644 --- a/third_party/rust/remote_settings/dumps/main/search-config-icons.json +++ b/third_party/rust/remote_settings/dumps/main/search-config-icons.json @@ -555,23 +555,6 @@ "last_modified": 1744118264931, "schema": 1743687935690 }, - { - "attachment": { - "filename": "azerdict-16-firefox.ico", - "hash": "24daa27a3234d01b5add42e027b0a34000d0ab47c17fe3924c2ca267b7b61c19", - "location": "main-workspace/search-config-icons/4d6f988d-8905-4aa7-aeea-5b04a6197767.ico", - "mimetype": "image/x-icon", - "size": 5430 - }, - "engineIdentifiers": [ - "azerdict" - ], - "filter_expression": "env.appinfo.OS != \"iOS\" && env.appinfo.OS != \"Android\"", - "id": "7bbe6c5c-fdb8-2845-a4f4-e1382e708a0e", - "imageSize": 16, - "last_modified": 1744118264831, - "schema": 1743687843227 - }, { "attachment": { "filename": "Icon%2016x16.svg", @@ -774,23 +757,6 @@ "last_modified": 1744118264941, "schema": 1743687940531 }, - { - "attachment": { - "filename": "azerdict_mobile.png", - "hash": "3426b5100a6bdb45f8039f0c71a6b68193750ba7bae5b36e5ed31b2b7f372cda", - "location": "main-workspace/search-config-icons/1229ffe4-7a6f-46d7-b664-5596df0aa730.png", - "mimetype": "image/png", - "size": 1357 - }, - "engineIdentifiers": [ - "azerdict" - ], - "filter_expression": "env.appinfo.OS == \"iOS\" || env.appinfo.OS == \"Android\"", - "id": "95ed201d-4ab8-4cb8-831d-454f53cab0f8", - "imageSize": 96, - "last_modified": 1744118264962, - "schema": 1743687938695 - }, { "attachment": { "filename": "allegro-pl-16-firefox.ico", @@ -1206,5 +1172,5 @@ "schema": 1743687832067 } ], - "timestamp": 1763049497744 + "timestamp": 1765918784979 } \ No newline at end of file diff --git a/third_party/rust/remote_settings/dumps/main/search-config-icons.timestamp b/third_party/rust/remote_settings/dumps/main/search-config-icons.timestamp new file mode 100644 index 0000000000000..1ec63ac809f59 --- /dev/null +++ b/third_party/rust/remote_settings/dumps/main/search-config-icons.timestamp @@ -0,0 +1 @@ +1763049497744 \ No newline at end of file diff --git a/third_party/rust/remote_settings/dumps/main/search-config-v2.timestamp b/third_party/rust/remote_settings/dumps/main/search-config-v2.timestamp new file mode 100644 index 0000000000000..4451d3c5b24eb --- /dev/null +++ b/third_party/rust/remote_settings/dumps/main/search-config-v2.timestamp @@ -0,0 +1 @@ +1764082724032 \ No newline at end of file diff --git a/third_party/rust/remote_settings/dumps/main/search-telemetry-v2.timestamp b/third_party/rust/remote_settings/dumps/main/search-telemetry-v2.timestamp new file mode 100644 index 0000000000000..541e3d4dd79f2 --- /dev/null +++ b/third_party/rust/remote_settings/dumps/main/search-telemetry-v2.timestamp @@ -0,0 +1 @@ +1757010621729 \ No newline at end of file diff --git a/third_party/rust/remote_settings/dumps/main/summarizer-models-config.timestamp b/third_party/rust/remote_settings/dumps/main/summarizer-models-config.timestamp new file mode 100644 index 0000000000000..2e0b81c77a596 --- /dev/null +++ b/third_party/rust/remote_settings/dumps/main/summarizer-models-config.timestamp @@ -0,0 +1 @@ +1755604678567 \ No newline at end of file diff --git a/third_party/rust/remote_settings/dumps/main/translations-models.timestamp b/third_party/rust/remote_settings/dumps/main/translations-models.timestamp new file mode 100644 index 0000000000000..a76d3c9f57d0c --- /dev/null +++ b/third_party/rust/remote_settings/dumps/main/translations-models.timestamp @@ -0,0 +1 @@ +1761148716130 \ No newline at end of file diff --git a/third_party/rust/remote_settings/dumps/main/translations-wasm.timestamp b/third_party/rust/remote_settings/dumps/main/translations-wasm.timestamp new file mode 100644 index 0000000000000..dfdef03a43778 --- /dev/null +++ b/third_party/rust/remote_settings/dumps/main/translations-wasm.timestamp @@ -0,0 +1 @@ +1749069444811 \ No newline at end of file diff --git a/third_party/rust/remote_settings/src/client.rs b/third_party/rust/remote_settings/src/client.rs index 84a720d3e23c3..b58a1562d6487 100644 --- a/third_party/rust/remote_settings/src/client.rs +++ b/third_party/rust/remote_settings/src/client.rs @@ -146,7 +146,6 @@ impl RemoteSettingsClient { "74793ce1-a918-a5eb-d3c0-2aadaff3c88c", "74f94dc2-caf6-4b90-b3d2-f3e2f7714d88", "764e3b14-fe16-4feb-8384-124c516a5afa", - "7bbe6c5c-fdb8-2845-a4f4-e1382e708a0e", "7bf4ca37-e2b8-4d31-a1c3-979bc0e85131", "7c81cf98-7c11-4afd-8279-db89118a6dfb", "7cb4d88a-d4df-45b2-87e4-f896eaf1bbdb", @@ -159,7 +158,6 @@ impl RemoteSettingsClient { "8abb10a7-212f-46b5-a7b4-244f414e3810", "91a9672d-e945-8e1e-0996-aefdb0190716", "94a84724-c30f-4767-ba42-01cc37fc31a4", - "95ed201d-4ab8-4cb8-831d-454f53cab0f8", "96327a73-c433-5eb4-a16d-b090cadfb80b", "9802e63d-05ec-48ba-93f9-746e0981ad98", "9d96547d-7575-49ca-8908-1e046b8ea90e", @@ -213,10 +211,17 @@ impl RemoteSettingsClient { &self.collection_name } + fn load_packaged_timestamp(&self) -> Option { + // Using the macro generated `get_packaged_timestamp` in macros.rs + Self::get_packaged_timestamp(&self.collection_name) + } + fn load_packaged_data(&self) -> Option { // Using the macro generated `get_packaged_data` in macros.rs - Self::get_packaged_data(&self.collection_name) - .and_then(|data| serde_json::from_str(data).ok()) + let str_data = Self::get_packaged_data(&self.collection_name)?; + let data: CollectionData = serde_json::from_str(str_data).ok()?; + debug_assert_eq!(data.timestamp, self.load_packaged_timestamp().unwrap()); + Some(data) } fn load_packaged_attachment(&self, filename: &str) -> Option<(&'static [u8], &'static str)> { @@ -241,6 +246,28 @@ impl RemoteSettingsClient { .collect() } + /// Returns the parsed packaged data, but only if it's newer than the data we have + /// in storage. This avoids parsing the packaged data if we won't use it. + fn get_packaged_data_if_newer( + &self, + storage: &mut Storage, + collection_url: &str, + ) -> Result> { + let packaged_ts = self.load_packaged_timestamp(); + let storage_ts = storage.get_last_modified_timestamp(collection_url)?; + let packaged_is_newer = match (packaged_ts, storage_ts) { + (Some(packaged_ts), Some(storage_ts)) => packaged_ts > storage_ts, + (Some(_), None) => true, // no storage data + (None, _) => false, // no packaged data + }; + + if packaged_is_newer { + Ok(self.load_packaged_data()) + } else { + Ok(None) + } + } + /// Get the current set of records. /// /// If records are not present in storage this will normally return None. Use `sync_if_empty = @@ -248,23 +275,15 @@ impl RemoteSettingsClient { pub fn get_records(&self, sync_if_empty: bool) -> Result>> { let mut inner = self.inner.lock(); let collection_url = inner.api_client.collection_url(); - let is_prod = inner.api_client.is_prod_server()?; - let packaged_data = if is_prod { - self.load_packaged_data() - } else { - None - }; // Case 1: The packaged data is more recent than the cache // // This happens when there's no cached data or when we get new packaged data because of a // product update - if let Some(packaged_data) = packaged_data { - let cached_timestamp = inner - .storage - .get_last_modified_timestamp(&collection_url)? - .unwrap_or(0); - if packaged_data.timestamp > cached_timestamp { + if inner.api_client.is_prod_server()? { + if let Some(packaged_data) = + self.get_packaged_data_if_newer(&mut inner.storage, &collection_url)? + { // Remove previously cached data (packaged data does not have tombstones like diff responses do). inner.storage.empty()?; // Insert new packaged data. diff --git a/third_party/rust/remote_settings/src/macros.rs b/third_party/rust/remote_settings/src/macros.rs index 34b14661beda9..dd071b0a98b36 100644 --- a/third_party/rust/remote_settings/src/macros.rs +++ b/third_party/rust/remote_settings/src/macros.rs @@ -18,6 +18,26 @@ macro_rules! packaged_collections { _ => None, } } + + /// Get just the timestamp, which is stored separately. This allows + /// checking which data is newer without paying the cost of parsing + /// the full packaged JSON. + fn get_packaged_timestamp(collection_name: &str) -> Option { + match collection_name { + $($collection => { + let timestamp_str = include_str!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/dumps/", + $bucket, + "/", + $collection, + ".timestamp" + )); + timestamp_str.trim().parse().ok() + }),* + _ => None, + } + } }; } diff --git a/third_party/rust/sql-support/.cargo-checksum.json b/third_party/rust/sql-support/.cargo-checksum.json index 6fc63116b35dd..2ed5f19711006 100644 --- a/third_party/rust/sql-support/.cargo-checksum.json +++ b/third_party/rust/sql-support/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"3f7d58923501bb32fd721524762265c435e15257c5357bf8b6e7783e5cf88fb0","src/conn_ext.rs":"68e56f325ed57898add4fb86c4392a490855baa23a2fc08095be55f4e05c76c3","src/debug_tools.rs":"112c2ff182ba8181e5c62c27bc668c7e67a1a65e9f7ab92e52bf8f611f8c062e","src/each_chunk.rs":"0b4de829ccaf06b743d0ee5bce766399d841e12592cd00d22605b75a5ae6dbd0","src/lazy.rs":"a96b4f4ec572538b49cdfa8fee981dcf5143a5f51163fb8a573d3ac128df70f9","src/lib.rs":"ea2df947bd03cfb97de205274ac0c83660edb4294bc9c2dc427c532786bd5e4b","src/maintenance.rs":"1508244ba4270e7af0aac3d75e34ecf917551ca4ae6ec9c1733c37253a2b9aab","src/maybe_cached.rs":"0b18425595055883a98807fbd62ff27a79c18af34e7cb3439f8c3438463ef2dd","src/open_database.rs":"4cd52e1d4b422efa04a2477cb20aa229537c175f710eabfc3acbac3b218d45a3","src/repeat.rs":"3dad3cbc6f47fc7598fc7b0fbf79b9c915322396d1f64d3d09651d100d428351"},"package":null} \ No newline at end of file +{"files":{"Cargo.toml":"3f7d58923501bb32fd721524762265c435e15257c5357bf8b6e7783e5cf88fb0","src/conn_ext.rs":"68e56f325ed57898add4fb86c4392a490855baa23a2fc08095be55f4e05c76c3","src/debug_tools.rs":"112c2ff182ba8181e5c62c27bc668c7e67a1a65e9f7ab92e52bf8f611f8c062e","src/each_chunk.rs":"0b4de829ccaf06b743d0ee5bce766399d841e12592cd00d22605b75a5ae6dbd0","src/lazy.rs":"a96b4f4ec572538b49cdfa8fee981dcf5143a5f51163fb8a573d3ac128df70f9","src/lib.rs":"ea2df947bd03cfb97de205274ac0c83660edb4294bc9c2dc427c532786bd5e4b","src/maintenance.rs":"1508244ba4270e7af0aac3d75e34ecf917551ca4ae6ec9c1733c37253a2b9aab","src/maybe_cached.rs":"0b18425595055883a98807fbd62ff27a79c18af34e7cb3439f8c3438463ef2dd","src/open_database.rs":"bfb61df14739abd812b5295598d491b42ef51e2ad809ec32837522bccdf14500","src/repeat.rs":"3dad3cbc6f47fc7598fc7b0fbf79b9c915322396d1f64d3d09651d100d428351"},"package":null} \ No newline at end of file diff --git a/third_party/rust/sql-support/src/open_database.rs b/third_party/rust/sql-support/src/open_database.rs index ccbbe08f3cd26..ec715c163376d 100644 --- a/third_party/rust/sql-support/src/open_database.rs +++ b/third_party/rust/sql-support/src/open_database.rs @@ -153,6 +153,7 @@ fn do_open_database_with_flags>( connection_initializer.prepare(&conn, db_empty)?; if open_flags.contains(OpenFlags::SQLITE_OPEN_READ_WRITE) { + let mut write_schema_version = true; let tx = conn.transaction_with_behavior(TransactionBehavior::Immediate)?; if db_empty { debug!("{}: initializing new database", CI::NAME); @@ -161,20 +162,25 @@ fn do_open_database_with_flags>( let mut current_version = get_schema_version(&tx)?; if current_version > CI::END_VERSION { return Err(Error::IncompatibleVersion(current_version)); - } - while current_version < CI::END_VERSION { - debug!( - "{}: upgrading database to {}", - CI::NAME, - current_version + 1 - ); - connection_initializer.upgrade_from(&tx, current_version)?; - current_version += 1; + } else if current_version == CI::END_VERSION { + write_schema_version = false; + } else { + while current_version < CI::END_VERSION { + debug!( + "{}: upgrading database to {}", + CI::NAME, + current_version + 1 + ); + connection_initializer.upgrade_from(&tx, current_version)?; + current_version += 1; + } } } debug!("{}: finishing writable database open", CI::NAME); connection_initializer.finish(&tx)?; - set_schema_version(&tx, CI::END_VERSION)?; + if write_schema_version { + set_schema_version(&tx, CI::END_VERSION)?; + } tx.commit()?; } else { // There's an implied requirement that the first connection to a DB is diff --git a/third_party/rust/viaduct/.cargo-checksum.json b/third_party/rust/viaduct/.cargo-checksum.json index aebca7426151e..ed2aee9158bea 100644 --- a/third_party/rust/viaduct/.cargo-checksum.json +++ b/third_party/rust/viaduct/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"e204bc008f9a56fa79975febe7a9dd105c385cac0c9f24963fa45b4881192a44","README.md":"d73ab3e981a55c60a3c0995daa46fee6e513e8d78fb3c34691dd47320547695e","src/backend.rs":"501657c02aff05a987eb9d1a94aef8725a4db0af8a4d7c4959a49b3dc048fa68","src/backend/ffi.rs":"1c07fbfd807ee63ce32d5ac1000b8e0eef0a660ac4aa48c6ff15abf59fdadb75","src/client.rs":"0c35db14ba2a1952a1543bc3e8307bfb94de4b73964f58aecbac599a562b2246","src/error.rs":"2bf09dee6a0fbce7f0a7ffb4d5a01c59d458634336e8767399ed42ce7e9b1287","src/fetch_msg_types.proto":"de8a46a4947a140783a4d714364f18ccf02c4759d6ab5ace9da0b1c058efa6c3","src/headers.rs":"63bfa3ba4953f1900a56e3cc6e15b0eb8bd1268cdb0020a1b86391f1043dab82","src/headers/name.rs":"d7304e006278a5466b5fe09e194a9ca921b565d76e24be491ec6178f527d2d61","src/lib.rs":"9eb7c5a81feca0cf7fa22af3d1f32e8043bf7259765c4018e8cd53ee65d91933","src/mozilla.appservices.httpconfig.protobuf.rs":"9ede762489a0c07bc08a5b852b33013a410cb41b44b92a44555f85bb2db91412","src/new_backend.rs":"c2a7211498c89b3445f0048a79a1d3a4f5e10e53a304fe126cff04a165f90c4e","src/ohttp.rs":"d2edbb15f15d3ade8fad1eb13a767fcfe65e6b0b76b3bfb599af379608be4575","src/ohttp_client.rs":"cb91882a05ddcc1fe759dcab0d4cff7570571600922bef9cce3207b6a79fe249","src/settings.rs":"d2788035fed3bbbb43ed4ddbb832fbd98019cce1c34e32ffa21c74a8c127b540","uniffi.toml":"d73e88bf94a6b2c4a94bd0bada509542dbbadb3be1bf4ad32f52e465af6503d7"},"package":null} \ No newline at end of file +{"files":{"Cargo.toml":"d039791d31e5c20508c9f57ddab4053a22c4896c1095740d5c509d72db3eabb7","README.md":"d73ab3e981a55c60a3c0995daa46fee6e513e8d78fb3c34691dd47320547695e","src/backend.rs":"501657c02aff05a987eb9d1a94aef8725a4db0af8a4d7c4959a49b3dc048fa68","src/backend/ffi.rs":"1c07fbfd807ee63ce32d5ac1000b8e0eef0a660ac4aa48c6ff15abf59fdadb75","src/client.rs":"0c35db14ba2a1952a1543bc3e8307bfb94de4b73964f58aecbac599a562b2246","src/error.rs":"2bf09dee6a0fbce7f0a7ffb4d5a01c59d458634336e8767399ed42ce7e9b1287","src/fetch_msg_types.proto":"de8a46a4947a140783a4d714364f18ccf02c4759d6ab5ace9da0b1c058efa6c3","src/headers.rs":"63bfa3ba4953f1900a56e3cc6e15b0eb8bd1268cdb0020a1b86391f1043dab82","src/headers/name.rs":"d7304e006278a5466b5fe09e194a9ca921b565d76e24be491ec6178f527d2d61","src/lib.rs":"9eb7c5a81feca0cf7fa22af3d1f32e8043bf7259765c4018e8cd53ee65d91933","src/mozilla.appservices.httpconfig.protobuf.rs":"9ede762489a0c07bc08a5b852b33013a410cb41b44b92a44555f85bb2db91412","src/new_backend.rs":"c2a7211498c89b3445f0048a79a1d3a4f5e10e53a304fe126cff04a165f90c4e","src/ohttp.rs":"d2edbb15f15d3ade8fad1eb13a767fcfe65e6b0b76b3bfb599af379608be4575","src/ohttp_client.rs":"a530c26ff6b008428bbb68ab1bb68cb1c4e68c515a43b58d6206e8c7393f2976","src/settings.rs":"d2788035fed3bbbb43ed4ddbb832fbd98019cce1c34e32ffa21c74a8c127b540","uniffi.toml":"d73e88bf94a6b2c4a94bd0bada509542dbbadb3be1bf4ad32f52e465af6503d7"},"package":null} \ No newline at end of file diff --git a/third_party/rust/viaduct/Cargo.toml b/third_party/rust/viaduct/Cargo.toml index 011de82faa2b0..e22b2aedf7b79 100644 --- a/third_party/rust/viaduct/Cargo.toml +++ b/third_party/rust/viaduct/Cargo.toml @@ -51,16 +51,14 @@ thiserror = "2" url = "2" [dependencies.bhttp] -git = "https://github.com/martinthomson/ohttp.git" -rev = "bf6a983845cc0b540effb3a615e92d914dfcfd0b" +version = "0.7.1" optional = true [dependencies.error-support] path = "../support/error" [dependencies.ohttp] -git = "https://github.com/martinthomson/ohttp.git" -rev = "bf6a983845cc0b540effb3a615e92d914dfcfd0b" +version = "0.7.1" features = [ "client", "server", diff --git a/third_party/rust/viaduct/src/ohttp_client.rs b/third_party/rust/viaduct/src/ohttp_client.rs index 68369d6b64b76..6cdf6a5e8c61e 100644 --- a/third_party/rust/viaduct/src/ohttp_client.rs +++ b/third_party/rust/viaduct/src/ohttp_client.rs @@ -1,3 +1,7 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. */ + use crate::ViaductError; use parking_lot::Mutex; use std::collections::HashMap; diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/Cargo.toml b/toolkit/components/uniffi-bindgen-gecko-js/components/Cargo.toml index a6e84b9677fea..ead10056d4871 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/Cargo.toml +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/Cargo.toml @@ -17,6 +17,7 @@ harness = false [dependencies] uniffi = { workspace = true } +ads-client = "0.1" context_id = "0.1" filter_adult = "0.1" tabs = "0.1" diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustAdsClient.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustAdsClient.sys.mjs new file mode 100644 index 0000000000000..5077d910d3f8b --- /dev/null +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustAdsClient.sys.mjs @@ -0,0 +1,3479 @@ +// This file was autogenerated by the `uniffi-bindgen-gecko-js` crate. +// Trust me, you don't want to mess with it! + +import { + ArrayBufferDataStream, + FfiConverter, + FfiConverterArrayBuffer, + FfiConverterInt8, + FfiConverterUInt8, + FfiConverterInt16, + FfiConverterUInt16, + FfiConverterInt32, + FfiConverterUInt32, + FfiConverterInt64, + FfiConverterUInt64, + FfiConverterFloat32, + FfiConverterFloat64, + FfiConverterBoolean, + FfiConverterBytes, + FfiConverterString, + UniFFICallbackHandler, + UniFFICallbackMethodHandler, + UniFFIError, + UniFFIInternalError, + UniFFITypeError, + constructUniffiObject, + handleRustResult, + uniffiObjectPtr, +} from "moz-src:///toolkit/components/uniffi-js/js/UniFFI.sys.mjs"; + +// Objects intended to be used in the unit tests +export var UnitTestObjs = { + uniffiObjectPtr, +}; + + + + + +// Export the FFIConverter object to make external types work. +export class FfiConverterOptionalUInt64 extends FfiConverterArrayBuffer { + static checkType(value) { + if (value !== undefined && value !== null) { + FfiConverterUInt64.checkType(value) + } + } + + static read(dataStream) { + const code = dataStream.readUint8(0); + switch (code) { + case 0: + return null + case 1: + return FfiConverterUInt64.read(dataStream) + default: + throw new UniFFIError(`Unexpected code: ${code}`); + } + } + + static write(dataStream, value) { + if (value === null || value === undefined) { + dataStream.writeUint8(0); + return; + } + dataStream.writeUint8(1); + FfiConverterUInt64.write(dataStream, value) + } + + static computeSize(value) { + if (value === null || value === undefined) { + return 1; + } + return 1 + FfiConverterUInt64.computeSize(value) + } +} +/** + * MozAdsCacheConfig + */ +export class MozAdsCacheConfig { + constructor( + { + dbPath, + defaultCacheTtlSeconds, + maxSizeMib + } = { + dbPath: undefined, + defaultCacheTtlSeconds: undefined, + maxSizeMib: undefined + } + ) { + try { + FfiConverterString.checkType(dbPath) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("dbPath"); + } + throw e; + } + try { + FfiConverterOptionalUInt64.checkType(defaultCacheTtlSeconds) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("defaultCacheTtlSeconds"); + } + throw e; + } + try { + FfiConverterOptionalUInt64.checkType(maxSizeMib) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("maxSizeMib"); + } + throw e; + } + /** + * dbPath + */ + this.dbPath = dbPath; + /** + * defaultCacheTtlSeconds + */ + this.defaultCacheTtlSeconds = defaultCacheTtlSeconds; + /** + * maxSizeMib + */ + this.maxSizeMib = maxSizeMib; + } + + equals(other) { + return ( + this.dbPath == other.dbPath + && this.defaultCacheTtlSeconds == other.defaultCacheTtlSeconds + && this.maxSizeMib == other.maxSizeMib + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsCacheConfig extends FfiConverterArrayBuffer { + static read(dataStream) { + return new MozAdsCacheConfig({ + dbPath: FfiConverterString.read(dataStream), + defaultCacheTtlSeconds: FfiConverterOptionalUInt64.read(dataStream), + maxSizeMib: FfiConverterOptionalUInt64.read(dataStream), + }); + } + static write(dataStream, value) { + FfiConverterString.write(dataStream, value.dbPath); + FfiConverterOptionalUInt64.write(dataStream, value.defaultCacheTtlSeconds); + FfiConverterOptionalUInt64.write(dataStream, value.maxSizeMib); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterString.computeSize(value.dbPath); + totalSize += FfiConverterOptionalUInt64.computeSize(value.defaultCacheTtlSeconds); + totalSize += FfiConverterOptionalUInt64.computeSize(value.maxSizeMib); + return totalSize + } + + static checkType(value) { + super.checkType(value); + if (!(value instanceof MozAdsCacheConfig)) { + throw new UniFFITypeError(`Expected 'MozAdsCacheConfig', found '${typeof value}'`); + } + try { + FfiConverterString.checkType(value.dbPath); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".dbPath"); + } + throw e; + } + try { + FfiConverterOptionalUInt64.checkType(value.defaultCacheTtlSeconds); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".defaultCacheTtlSeconds"); + } + throw e; + } + try { + FfiConverterOptionalUInt64.checkType(value.maxSizeMib); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".maxSizeMib"); + } + throw e; + } + } +} +export class FfiConverterTypeAdsClientUrl extends FfiConverter { + static lift(value) { + return FfiConverterString.lift(value); + } + + static lower(value) { + return FfiConverterString.lower(value); + } + + static write(dataStream, value) { + FfiConverterString.write(dataStream, value); + } + + static read(dataStream) { + const builtinVal = FfiConverterString.read(dataStream); + return builtinVal; + } + + static computeSize(value) { + return FfiConverterString.computeSize(value); + } + + static checkType(value) { + if (value === null || value === undefined) { + throw new TypeError("value is null or undefined"); + } + } +} +// Export the FFIConverter object to make external types work. +export class FfiConverterOptionalTypeAdsClientUrl extends FfiConverterArrayBuffer { + static checkType(value) { + if (value !== undefined && value !== null) { + FfiConverterTypeAdsClientUrl.checkType(value) + } + } + + static read(dataStream) { + const code = dataStream.readUint8(0); + switch (code) { + case 0: + return null + case 1: + return FfiConverterTypeAdsClientUrl.read(dataStream) + default: + throw new UniFFIError(`Unexpected code: ${code}`); + } + } + + static write(dataStream, value) { + if (value === null || value === undefined) { + dataStream.writeUint8(0); + return; + } + dataStream.writeUint8(1); + FfiConverterTypeAdsClientUrl.write(dataStream, value) + } + + static computeSize(value) { + if (value === null || value === undefined) { + return 1; + } + return 1 + FfiConverterTypeAdsClientUrl.computeSize(value) + } +} +/** + * MozAdsCallbacks + */ +export class MozAdsCallbacks { + constructor( + { + click, + impression, + report + } = { + click: undefined, + impression: undefined, + report: undefined + } + ) { + try { + FfiConverterTypeAdsClientUrl.checkType(click) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("click"); + } + throw e; + } + try { + FfiConverterTypeAdsClientUrl.checkType(impression) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("impression"); + } + throw e; + } + try { + FfiConverterOptionalTypeAdsClientUrl.checkType(report) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("report"); + } + throw e; + } + /** + * click + */ + this.click = click; + /** + * impression + */ + this.impression = impression; + /** + * report + */ + this.report = report; + } + + equals(other) { + return ( + this.click == other.click + && this.impression == other.impression + && this.report == other.report + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsCallbacks extends FfiConverterArrayBuffer { + static read(dataStream) { + return new MozAdsCallbacks({ + click: FfiConverterTypeAdsClientUrl.read(dataStream), + impression: FfiConverterTypeAdsClientUrl.read(dataStream), + report: FfiConverterOptionalTypeAdsClientUrl.read(dataStream), + }); + } + static write(dataStream, value) { + FfiConverterTypeAdsClientUrl.write(dataStream, value.click); + FfiConverterTypeAdsClientUrl.write(dataStream, value.impression); + FfiConverterOptionalTypeAdsClientUrl.write(dataStream, value.report); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterTypeAdsClientUrl.computeSize(value.click); + totalSize += FfiConverterTypeAdsClientUrl.computeSize(value.impression); + totalSize += FfiConverterOptionalTypeAdsClientUrl.computeSize(value.report); + return totalSize + } + + static checkType(value) { + super.checkType(value); + if (!(value instanceof MozAdsCallbacks)) { + throw new UniFFITypeError(`Expected 'MozAdsCallbacks', found '${typeof value}'`); + } + try { + FfiConverterTypeAdsClientUrl.checkType(value.click); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".click"); + } + throw e; + } + try { + FfiConverterTypeAdsClientUrl.checkType(value.impression); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".impression"); + } + throw e; + } + try { + FfiConverterOptionalTypeAdsClientUrl.checkType(value.report); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".report"); + } + throw e; + } + } +} + +/** + * MozAdsEnvironment + */ +export const MozAdsEnvironment = { + /** + * PROD + */ + PROD: 0, +}; +Object.freeze(MozAdsEnvironment); + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsEnvironment extends FfiConverterArrayBuffer { + static #validValues = Object.values(MozAdsEnvironment) + + static read(dataStream) { + // Use sequential indices (1-based) for the wire format to match the Rust scaffolding + switch (dataStream.readInt32()) { + case 1: + return MozAdsEnvironment.PROD + default: + throw new UniFFITypeError("Unknown MozAdsEnvironment variant"); + } + } + + static write(dataStream, value) { + // Use sequential indices (1-based) for the wire format to match the Rust scaffolding + if (value === MozAdsEnvironment.PROD) { + dataStream.writeInt32(1); + return; + } + throw new UniFFITypeError("Unknown MozAdsEnvironment variant"); + } + + static computeSize(value) { + return 4; + } + + static checkType(value) { + // Check that the value is a valid enum variant + if (!this.#validValues.includes(value)) { + throw new UniFFITypeError(`${value} is not a valid value for MozAdsEnvironment`); + } + } +} +// Export the FFIConverter object to make external types work. +export class FfiConverterOptionalTypeMozAdsCacheConfig extends FfiConverterArrayBuffer { + static checkType(value) { + if (value !== undefined && value !== null) { + FfiConverterTypeMozAdsCacheConfig.checkType(value) + } + } + + static read(dataStream) { + const code = dataStream.readUint8(0); + switch (code) { + case 0: + return null + case 1: + return FfiConverterTypeMozAdsCacheConfig.read(dataStream) + default: + throw new UniFFIError(`Unexpected code: ${code}`); + } + } + + static write(dataStream, value) { + if (value === null || value === undefined) { + dataStream.writeUint8(0); + return; + } + dataStream.writeUint8(1); + FfiConverterTypeMozAdsCacheConfig.write(dataStream, value) + } + + static computeSize(value) { + if (value === null || value === undefined) { + return 1; + } + return 1 + FfiConverterTypeMozAdsCacheConfig.computeSize(value) + } +} + +/** + * MozAdsTelemetry + */ +export class MozAdsTelemetry { + /** + * recordBuildCacheError + * @param {string} label + * @param {string} value + */ + recordBuildCacheError( + label, + value) { + throw Error("recordBuildCacheError not implemented"); + } + /** + * recordClientError + * @param {string} label + * @param {string} value + */ + recordClientError( + label, + value) { + throw Error("recordClientError not implemented"); + } + /** + * recordClientOperationTotal + * @param {string} label + */ + recordClientOperationTotal( + label) { + throw Error("recordClientOperationTotal not implemented"); + } + /** + * recordDeserializationError + * @param {string} label + * @param {string} value + */ + recordDeserializationError( + label, + value) { + throw Error("recordDeserializationError not implemented"); + } + /** + * recordHttpCacheOutcome + * @param {string} label + * @param {string} value + */ + recordHttpCacheOutcome( + label, + value) { + throw Error("recordHttpCacheOutcome not implemented"); + } + +} + +/** + * MozAdsTelemetry + */ +export class MozAdsTelemetryImpl extends MozAdsTelemetry { + // Use `init` to instantiate this class. + // DO NOT USE THIS CONSTRUCTOR DIRECTLY + constructor(opts) { + super(); + if (!Object.prototype.hasOwnProperty.call(opts, constructUniffiObject)) { + throw new UniFFIError("Attempting to construct an int 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]; + } + + /** + * recordBuildCacheError + * @param {string} label + * @param {string} value + */ + recordBuildCacheError( + label, + value) { + + FfiConverterString.checkType(label); + FfiConverterString.checkType(value); + const result = UniFFIScaffolding.callSync( + 1, // uniffi_ads_client_fn_method_mozadstelemetry_record_build_cache_error + FfiConverterTypeMozAdsTelemetry.lowerReceiver(this), + FfiConverterString.lower(label), + FfiConverterString.lower(value), + ) + return handleRustResult( + result, + (result) => undefined, + null, + ) + } + + /** + * recordClientError + * @param {string} label + * @param {string} value + */ + recordClientError( + label, + value) { + + FfiConverterString.checkType(label); + FfiConverterString.checkType(value); + const result = UniFFIScaffolding.callSync( + 2, // uniffi_ads_client_fn_method_mozadstelemetry_record_client_error + FfiConverterTypeMozAdsTelemetry.lowerReceiver(this), + FfiConverterString.lower(label), + FfiConverterString.lower(value), + ) + return handleRustResult( + result, + (result) => undefined, + null, + ) + } + + /** + * recordClientOperationTotal + * @param {string} label + */ + recordClientOperationTotal( + label) { + + FfiConverterString.checkType(label); + const result = UniFFIScaffolding.callSync( + 3, // uniffi_ads_client_fn_method_mozadstelemetry_record_client_operation_total + FfiConverterTypeMozAdsTelemetry.lowerReceiver(this), + FfiConverterString.lower(label), + ) + return handleRustResult( + result, + (result) => undefined, + null, + ) + } + + /** + * recordDeserializationError + * @param {string} label + * @param {string} value + */ + recordDeserializationError( + label, + value) { + + FfiConverterString.checkType(label); + FfiConverterString.checkType(value); + const result = UniFFIScaffolding.callSync( + 4, // uniffi_ads_client_fn_method_mozadstelemetry_record_deserialization_error + FfiConverterTypeMozAdsTelemetry.lowerReceiver(this), + FfiConverterString.lower(label), + FfiConverterString.lower(value), + ) + return handleRustResult( + result, + (result) => undefined, + null, + ) + } + + /** + * recordHttpCacheOutcome + * @param {string} label + * @param {string} value + */ + recordHttpCacheOutcome( + label, + value) { + + FfiConverterString.checkType(label); + FfiConverterString.checkType(value); + const result = UniFFIScaffolding.callSync( + 5, // uniffi_ads_client_fn_method_mozadstelemetry_record_http_cache_outcome + FfiConverterTypeMozAdsTelemetry.lowerReceiver(this), + FfiConverterString.lower(label), + FfiConverterString.lower(value), + ) + return handleRustResult( + result, + (result) => undefined, + null, + ) + } + +} + +// FfiConverter for a trait interface. This is a hybrid of the FFIConverter regular interfaces and +// for callback interfaces. +// +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsTelemetry extends FfiConverter { + // lift works like a regular interface + static lift(value) { + const opts = {}; + opts[constructUniffiObject] = value; + return new MozAdsTelemetryImpl(opts); + } + + // lower treats value like a callback interface + static lower(value) { + if (!(value instanceof MozAdsTelemetry)) { + throw new UniFFITypeError("expected 'MozAdsTelemetry' subclass"); + } + return uniffiCallbackHandlerAdsClientMozAdsTelemetry.storeCallbackObj(value) + } + + // lowerReceiver is used when calling methods on an interface we got from Rust, + // it treats value like a regular interface. + static lowerReceiver(value) { + const ptr = value[uniffiObjectPtr]; + if (!(ptr instanceof UniFFIPointer)) { + throw new UniFFITypeError("Object is not a 'MozAdsTelemetryImpl' instance"); + } + return ptr; + } + + static read(dataStream) { + return this.lift(dataStream.readPointer(1)); + } + + static write(dataStream, value) { + dataStream.writePointer(1, this.lower(value)); + } + + static computeSize(value) { + return 8; + } +} + +const uniffiCallbackHandlerAdsClientMozAdsTelemetry = new UniFFICallbackHandler( + "MozAdsTelemetry", + 1, + [ + new UniFFICallbackMethodHandler( + "recordBuildCacheError", + [ + FfiConverterString, + FfiConverterString, + ], + (result) => undefined, + (e) => { + throw e; + } + ), + new UniFFICallbackMethodHandler( + "recordClientError", + [ + FfiConverterString, + FfiConverterString, + ], + (result) => undefined, + (e) => { + throw e; + } + ), + new UniFFICallbackMethodHandler( + "recordClientOperationTotal", + [ + FfiConverterString, + ], + (result) => undefined, + (e) => { + throw e; + } + ), + new UniFFICallbackMethodHandler( + "recordDeserializationError", + [ + FfiConverterString, + FfiConverterString, + ], + (result) => undefined, + (e) => { + throw e; + } + ), + new UniFFICallbackMethodHandler( + "recordHttpCacheOutcome", + [ + FfiConverterString, + FfiConverterString, + ], + (result) => undefined, + (e) => { + throw e; + } + ), + ] +); + +// Allow the shutdown-related functionality to be tested in the unit tests +UnitTestObjs.uniffiCallbackHandlerAdsClientMozAdsTelemetry = uniffiCallbackHandlerAdsClientMozAdsTelemetry; +// Export the FFIConverter object to make external types work. +export class FfiConverterOptionalTypeMozAdsTelemetry extends FfiConverterArrayBuffer { + static checkType(value) { + if (value !== undefined && value !== null) { + FfiConverterTypeMozAdsTelemetry.checkType(value) + } + } + + static read(dataStream) { + const code = dataStream.readUint8(0); + switch (code) { + case 0: + return null + case 1: + return FfiConverterTypeMozAdsTelemetry.read(dataStream) + default: + throw new UniFFIError(`Unexpected code: ${code}`); + } + } + + static write(dataStream, value) { + if (value === null || value === undefined) { + dataStream.writeUint8(0); + return; + } + dataStream.writeUint8(1); + FfiConverterTypeMozAdsTelemetry.write(dataStream, value) + } + + static computeSize(value) { + if (value === null || value === undefined) { + return 1; + } + return 1 + FfiConverterTypeMozAdsTelemetry.computeSize(value) + } +} +/** + * MozAdsClientConfig + */ +export class MozAdsClientConfig { + constructor( + { + environment, + cacheConfig, + telemetry + } = { + environment: undefined, + cacheConfig: undefined, + telemetry: undefined + } + ) { + try { + FfiConverterTypeMozAdsEnvironment.checkType(environment) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("environment"); + } + throw e; + } + try { + FfiConverterOptionalTypeMozAdsCacheConfig.checkType(cacheConfig) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("cacheConfig"); + } + throw e; + } + try { + FfiConverterOptionalTypeMozAdsTelemetry.checkType(telemetry) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("telemetry"); + } + throw e; + } + /** + * environment + */ + this.environment = environment; + /** + * cacheConfig + */ + this.cacheConfig = cacheConfig; + /** + * telemetry + */ + this.telemetry = telemetry; + } + + equals(other) { + return ( + this.environment == other.environment + && this.cacheConfig == other.cacheConfig + && this.telemetry == other.telemetry + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsClientConfig extends FfiConverterArrayBuffer { + static read(dataStream) { + return new MozAdsClientConfig({ + environment: FfiConverterTypeMozAdsEnvironment.read(dataStream), + cacheConfig: FfiConverterOptionalTypeMozAdsCacheConfig.read(dataStream), + telemetry: FfiConverterOptionalTypeMozAdsTelemetry.read(dataStream), + }); + } + static write(dataStream, value) { + FfiConverterTypeMozAdsEnvironment.write(dataStream, value.environment); + FfiConverterOptionalTypeMozAdsCacheConfig.write(dataStream, value.cacheConfig); + FfiConverterOptionalTypeMozAdsTelemetry.write(dataStream, value.telemetry); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterTypeMozAdsEnvironment.computeSize(value.environment); + totalSize += FfiConverterOptionalTypeMozAdsCacheConfig.computeSize(value.cacheConfig); + totalSize += FfiConverterOptionalTypeMozAdsTelemetry.computeSize(value.telemetry); + return totalSize + } + + static checkType(value) { + super.checkType(value); + if (!(value instanceof MozAdsClientConfig)) { + throw new UniFFITypeError(`Expected 'MozAdsClientConfig', found '${typeof value}'`); + } + try { + FfiConverterTypeMozAdsEnvironment.checkType(value.environment); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".environment"); + } + throw e; + } + try { + FfiConverterOptionalTypeMozAdsCacheConfig.checkType(value.cacheConfig); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".cacheConfig"); + } + throw e; + } + try { + FfiConverterOptionalTypeMozAdsTelemetry.checkType(value.telemetry); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".telemetry"); + } + throw e; + } + } +} + +/** + * MozAdsIabContentTaxonomy + */ +export const MozAdsIabContentTaxonomy = { + /** + * IAB1_0 + */ + IAB1_0: 0, + /** + * IAB2_0 + */ + IAB2_0: 1, + /** + * IAB2_1 + */ + IAB2_1: 2, + /** + * IAB2_2 + */ + IAB2_2: 3, + /** + * IAB3_0 + */ + IAB3_0: 4, +}; +Object.freeze(MozAdsIabContentTaxonomy); + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsIABContentTaxonomy extends FfiConverterArrayBuffer { + static #validValues = Object.values(MozAdsIabContentTaxonomy) + + static read(dataStream) { + // Use sequential indices (1-based) for the wire format to match the Rust scaffolding + switch (dataStream.readInt32()) { + case 1: + return MozAdsIabContentTaxonomy.IAB1_0 + case 2: + return MozAdsIabContentTaxonomy.IAB2_0 + case 3: + return MozAdsIabContentTaxonomy.IAB2_1 + case 4: + return MozAdsIabContentTaxonomy.IAB2_2 + case 5: + return MozAdsIabContentTaxonomy.IAB3_0 + default: + throw new UniFFITypeError("Unknown MozAdsIabContentTaxonomy variant"); + } + } + + static write(dataStream, value) { + // Use sequential indices (1-based) for the wire format to match the Rust scaffolding + if (value === MozAdsIabContentTaxonomy.IAB1_0) { + dataStream.writeInt32(1); + return; + } + if (value === MozAdsIabContentTaxonomy.IAB2_0) { + dataStream.writeInt32(2); + return; + } + if (value === MozAdsIabContentTaxonomy.IAB2_1) { + dataStream.writeInt32(3); + return; + } + if (value === MozAdsIabContentTaxonomy.IAB2_2) { + dataStream.writeInt32(4); + return; + } + if (value === MozAdsIabContentTaxonomy.IAB3_0) { + dataStream.writeInt32(5); + return; + } + throw new UniFFITypeError("Unknown MozAdsIabContentTaxonomy variant"); + } + + static computeSize(value) { + return 4; + } + + static checkType(value) { + // Check that the value is a valid enum variant + if (!this.#validValues.includes(value)) { + throw new UniFFITypeError(`${value} is not a valid value for MozAdsIabContentTaxonomy`); + } + } +} +// 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; + } + }) + } +} +/** + * MozAdsContentCategory + */ +export class MozAdsContentCategory { + constructor( + { + taxonomy, + categories + } = { + taxonomy: undefined, + categories: undefined + } + ) { + try { + FfiConverterTypeMozAdsIABContentTaxonomy.checkType(taxonomy) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("taxonomy"); + } + throw e; + } + try { + FfiConverterSequenceString.checkType(categories) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("categories"); + } + throw e; + } + /** + * taxonomy + */ + this.taxonomy = taxonomy; + /** + * categories + */ + this.categories = categories; + } + + equals(other) { + return ( + this.taxonomy == other.taxonomy + && this.categories == other.categories + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsContentCategory extends FfiConverterArrayBuffer { + static read(dataStream) { + return new MozAdsContentCategory({ + taxonomy: FfiConverterTypeMozAdsIABContentTaxonomy.read(dataStream), + categories: FfiConverterSequenceString.read(dataStream), + }); + } + static write(dataStream, value) { + FfiConverterTypeMozAdsIABContentTaxonomy.write(dataStream, value.taxonomy); + FfiConverterSequenceString.write(dataStream, value.categories); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterTypeMozAdsIABContentTaxonomy.computeSize(value.taxonomy); + totalSize += FfiConverterSequenceString.computeSize(value.categories); + return totalSize + } + + static checkType(value) { + super.checkType(value); + if (!(value instanceof MozAdsContentCategory)) { + throw new UniFFITypeError(`Expected 'MozAdsContentCategory', found '${typeof value}'`); + } + try { + FfiConverterTypeMozAdsIABContentTaxonomy.checkType(value.taxonomy); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".taxonomy"); + } + throw e; + } + try { + FfiConverterSequenceString.checkType(value.categories); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".categories"); + } + throw e; + } + } +} +/** + * MozAdsIabContent + */ +export class MozAdsIabContent { + constructor( + { + taxonomy, + categoryIds + } = { + taxonomy: undefined, + categoryIds: undefined + } + ) { + try { + FfiConverterTypeMozAdsIABContentTaxonomy.checkType(taxonomy) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("taxonomy"); + } + throw e; + } + try { + FfiConverterSequenceString.checkType(categoryIds) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("categoryIds"); + } + throw e; + } + /** + * taxonomy + */ + this.taxonomy = taxonomy; + /** + * categoryIds + */ + this.categoryIds = categoryIds; + } + + equals(other) { + return ( + this.taxonomy == other.taxonomy + && this.categoryIds == other.categoryIds + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsIABContent extends FfiConverterArrayBuffer { + static read(dataStream) { + return new MozAdsIabContent({ + taxonomy: FfiConverterTypeMozAdsIABContentTaxonomy.read(dataStream), + categoryIds: FfiConverterSequenceString.read(dataStream), + }); + } + static write(dataStream, value) { + FfiConverterTypeMozAdsIABContentTaxonomy.write(dataStream, value.taxonomy); + FfiConverterSequenceString.write(dataStream, value.categoryIds); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterTypeMozAdsIABContentTaxonomy.computeSize(value.taxonomy); + totalSize += FfiConverterSequenceString.computeSize(value.categoryIds); + return totalSize + } + + static checkType(value) { + super.checkType(value); + if (!(value instanceof MozAdsIabContent)) { + throw new UniFFITypeError(`Expected 'MozAdsIabContent', found '${typeof value}'`); + } + try { + FfiConverterTypeMozAdsIABContentTaxonomy.checkType(value.taxonomy); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".taxonomy"); + } + throw e; + } + try { + FfiConverterSequenceString.checkType(value.categoryIds); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".categoryIds"); + } + throw e; + } + } +} +// 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 new 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) + } +} +/** + * MozAdsImage + */ +export class MozAdsImage { + constructor( + { + altText, + blockKey, + callbacks, + format, + imageUrl, + url + } = { + altText: undefined, + blockKey: undefined, + callbacks: undefined, + format: undefined, + imageUrl: undefined, + url: undefined + } + ) { + try { + FfiConverterOptionalString.checkType(altText) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("altText"); + } + throw e; + } + try { + FfiConverterString.checkType(blockKey) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("blockKey"); + } + throw e; + } + try { + FfiConverterTypeMozAdsCallbacks.checkType(callbacks) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("callbacks"); + } + throw e; + } + try { + FfiConverterString.checkType(format) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("format"); + } + throw e; + } + try { + FfiConverterString.checkType(imageUrl) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("imageUrl"); + } + throw e; + } + try { + FfiConverterString.checkType(url) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("url"); + } + throw e; + } + /** + * altText + */ + this.altText = altText; + /** + * blockKey + */ + this.blockKey = blockKey; + /** + * callbacks + */ + this.callbacks = callbacks; + /** + * format + */ + this.format = format; + /** + * imageUrl + */ + this.imageUrl = imageUrl; + /** + * url + */ + this.url = url; + } + + equals(other) { + return ( + this.altText == other.altText + && this.blockKey == other.blockKey + && this.callbacks.equals(other.callbacks) + && this.format == other.format + && this.imageUrl == other.imageUrl + && this.url == other.url + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsImage extends FfiConverterArrayBuffer { + static read(dataStream) { + return new MozAdsImage({ + altText: FfiConverterOptionalString.read(dataStream), + blockKey: FfiConverterString.read(dataStream), + callbacks: FfiConverterTypeMozAdsCallbacks.read(dataStream), + format: FfiConverterString.read(dataStream), + imageUrl: FfiConverterString.read(dataStream), + url: FfiConverterString.read(dataStream), + }); + } + static write(dataStream, value) { + FfiConverterOptionalString.write(dataStream, value.altText); + FfiConverterString.write(dataStream, value.blockKey); + FfiConverterTypeMozAdsCallbacks.write(dataStream, value.callbacks); + FfiConverterString.write(dataStream, value.format); + FfiConverterString.write(dataStream, value.imageUrl); + FfiConverterString.write(dataStream, value.url); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterOptionalString.computeSize(value.altText); + totalSize += FfiConverterString.computeSize(value.blockKey); + totalSize += FfiConverterTypeMozAdsCallbacks.computeSize(value.callbacks); + totalSize += FfiConverterString.computeSize(value.format); + totalSize += FfiConverterString.computeSize(value.imageUrl); + totalSize += FfiConverterString.computeSize(value.url); + return totalSize + } + + static checkType(value) { + super.checkType(value); + if (!(value instanceof MozAdsImage)) { + throw new UniFFITypeError(`Expected 'MozAdsImage', found '${typeof value}'`); + } + try { + FfiConverterOptionalString.checkType(value.altText); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".altText"); + } + throw e; + } + try { + FfiConverterString.checkType(value.blockKey); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".blockKey"); + } + throw e; + } + try { + FfiConverterTypeMozAdsCallbacks.checkType(value.callbacks); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".callbacks"); + } + throw e; + } + try { + FfiConverterString.checkType(value.format); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".format"); + } + throw e; + } + try { + FfiConverterString.checkType(value.imageUrl); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".imageUrl"); + } + throw e; + } + try { + FfiConverterString.checkType(value.url); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".url"); + } + throw e; + } + } +} +// Export the FFIConverter object to make external types work. +export class FfiConverterOptionalTypeMozAdsIABContent extends FfiConverterArrayBuffer { + static checkType(value) { + if (value !== undefined && value !== null) { + FfiConverterTypeMozAdsIABContent.checkType(value) + } + } + + static read(dataStream) { + const code = dataStream.readUint8(0); + switch (code) { + case 0: + return null + case 1: + return FfiConverterTypeMozAdsIABContent.read(dataStream) + default: + throw new UniFFIError(`Unexpected code: ${code}`); + } + } + + static write(dataStream, value) { + if (value === null || value === undefined) { + dataStream.writeUint8(0); + return; + } + dataStream.writeUint8(1); + FfiConverterTypeMozAdsIABContent.write(dataStream, value) + } + + static computeSize(value) { + if (value === null || value === undefined) { + return 1; + } + return 1 + FfiConverterTypeMozAdsIABContent.computeSize(value) + } +} +/** + * MozAdsPlacementRequest + */ +export class MozAdsPlacementRequest { + constructor( + { + placementId, + iabContent + } = { + placementId: undefined, + iabContent: undefined + } + ) { + try { + FfiConverterString.checkType(placementId) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("placementId"); + } + throw e; + } + try { + FfiConverterOptionalTypeMozAdsIABContent.checkType(iabContent) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("iabContent"); + } + throw e; + } + /** + * placementId + */ + this.placementId = placementId; + /** + * iabContent + */ + this.iabContent = iabContent; + } + + equals(other) { + return ( + this.placementId == other.placementId + && this.iabContent == other.iabContent + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsPlacementRequest extends FfiConverterArrayBuffer { + static read(dataStream) { + return new MozAdsPlacementRequest({ + placementId: FfiConverterString.read(dataStream), + iabContent: FfiConverterOptionalTypeMozAdsIABContent.read(dataStream), + }); + } + static write(dataStream, value) { + FfiConverterString.write(dataStream, value.placementId); + FfiConverterOptionalTypeMozAdsIABContent.write(dataStream, value.iabContent); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterString.computeSize(value.placementId); + totalSize += FfiConverterOptionalTypeMozAdsIABContent.computeSize(value.iabContent); + return totalSize + } + + static checkType(value) { + super.checkType(value); + if (!(value instanceof MozAdsPlacementRequest)) { + throw new UniFFITypeError(`Expected 'MozAdsPlacementRequest', found '${typeof value}'`); + } + try { + FfiConverterString.checkType(value.placementId); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".placementId"); + } + throw e; + } + try { + FfiConverterOptionalTypeMozAdsIABContent.checkType(value.iabContent); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".iabContent"); + } + throw e; + } + } +} + + +/** + * MozAdsPlacementRequestWithCount + */ +export class MozAdsPlacementRequestWithCount { + constructor( + { + count, + placementId, + iabContent + } = { + count: undefined, + placementId: undefined, + iabContent: undefined + } + ) { + try { + FfiConverterUInt32.checkType(count) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("count"); + } + throw e; + } + try { + FfiConverterString.checkType(placementId) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("placementId"); + } + throw e; + } + try { + FfiConverterOptionalTypeMozAdsIABContent.checkType(iabContent) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("iabContent"); + } + throw e; + } + /** + * count + */ + this.count = count; + /** + * placementId + */ + this.placementId = placementId; + /** + * iabContent + */ + this.iabContent = iabContent; + } + + equals(other) { + return ( + this.count == other.count + && this.placementId == other.placementId + && this.iabContent == other.iabContent + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsPlacementRequestWithCount extends FfiConverterArrayBuffer { + static read(dataStream) { + return new MozAdsPlacementRequestWithCount({ + count: FfiConverterUInt32.read(dataStream), + placementId: FfiConverterString.read(dataStream), + iabContent: FfiConverterOptionalTypeMozAdsIABContent.read(dataStream), + }); + } + static write(dataStream, value) { + FfiConverterUInt32.write(dataStream, value.count); + FfiConverterString.write(dataStream, value.placementId); + FfiConverterOptionalTypeMozAdsIABContent.write(dataStream, value.iabContent); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterUInt32.computeSize(value.count); + totalSize += FfiConverterString.computeSize(value.placementId); + totalSize += FfiConverterOptionalTypeMozAdsIABContent.computeSize(value.iabContent); + return totalSize + } + + static checkType(value) { + super.checkType(value); + if (!(value instanceof MozAdsPlacementRequestWithCount)) { + throw new UniFFITypeError(`Expected 'MozAdsPlacementRequestWithCount', found '${typeof value}'`); + } + try { + FfiConverterUInt32.checkType(value.count); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".count"); + } + throw e; + } + try { + FfiConverterString.checkType(value.placementId); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".placementId"); + } + throw e; + } + try { + FfiConverterOptionalTypeMozAdsIABContent.checkType(value.iabContent); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".iabContent"); + } + throw e; + } + } +} + +/** + * MozAdsCacheMode + */ +export const MozAdsCacheMode = { + /** + * CACHE_FIRST + */ + CACHE_FIRST: 0, + /** + * NETWORK_FIRST + */ + NETWORK_FIRST: 1, +}; +Object.freeze(MozAdsCacheMode); + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsCacheMode extends FfiConverterArrayBuffer { + static #validValues = Object.values(MozAdsCacheMode) + + static read(dataStream) { + // Use sequential indices (1-based) for the wire format to match the Rust scaffolding + switch (dataStream.readInt32()) { + case 1: + return MozAdsCacheMode.CACHE_FIRST + case 2: + return MozAdsCacheMode.NETWORK_FIRST + default: + throw new UniFFITypeError("Unknown MozAdsCacheMode variant"); + } + } + + static write(dataStream, value) { + // Use sequential indices (1-based) for the wire format to match the Rust scaffolding + if (value === MozAdsCacheMode.CACHE_FIRST) { + dataStream.writeInt32(1); + return; + } + if (value === MozAdsCacheMode.NETWORK_FIRST) { + dataStream.writeInt32(2); + return; + } + throw new UniFFITypeError("Unknown MozAdsCacheMode variant"); + } + + static computeSize(value) { + return 4; + } + + static checkType(value) { + // Check that the value is a valid enum variant + if (!this.#validValues.includes(value)) { + throw new UniFFITypeError(`${value} is not a valid value for MozAdsCacheMode`); + } + } +} +/** + * MozAdsRequestCachePolicy + */ +export class MozAdsRequestCachePolicy { + constructor( + { + mode, + ttlSeconds + } = { + mode: undefined, + ttlSeconds: undefined + } + ) { + try { + FfiConverterTypeMozAdsCacheMode.checkType(mode) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("mode"); + } + throw e; + } + try { + FfiConverterOptionalUInt64.checkType(ttlSeconds) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("ttlSeconds"); + } + throw e; + } + /** + * mode + */ + this.mode = mode; + /** + * ttlSeconds + */ + this.ttlSeconds = ttlSeconds; + } + + equals(other) { + return ( + this.mode == other.mode + && this.ttlSeconds == other.ttlSeconds + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsRequestCachePolicy extends FfiConverterArrayBuffer { + static read(dataStream) { + return new MozAdsRequestCachePolicy({ + mode: FfiConverterTypeMozAdsCacheMode.read(dataStream), + ttlSeconds: FfiConverterOptionalUInt64.read(dataStream), + }); + } + static write(dataStream, value) { + FfiConverterTypeMozAdsCacheMode.write(dataStream, value.mode); + FfiConverterOptionalUInt64.write(dataStream, value.ttlSeconds); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterTypeMozAdsCacheMode.computeSize(value.mode); + totalSize += FfiConverterOptionalUInt64.computeSize(value.ttlSeconds); + return totalSize + } + + static checkType(value) { + super.checkType(value); + if (!(value instanceof MozAdsRequestCachePolicy)) { + throw new UniFFITypeError(`Expected 'MozAdsRequestCachePolicy', found '${typeof value}'`); + } + try { + FfiConverterTypeMozAdsCacheMode.checkType(value.mode); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".mode"); + } + throw e; + } + try { + FfiConverterOptionalUInt64.checkType(value.ttlSeconds); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".ttlSeconds"); + } + throw e; + } + } +} +// Export the FFIConverter object to make external types work. +export class FfiConverterOptionalTypeMozAdsRequestCachePolicy extends FfiConverterArrayBuffer { + static checkType(value) { + if (value !== undefined && value !== null) { + FfiConverterTypeMozAdsRequestCachePolicy.checkType(value) + } + } + + static read(dataStream) { + const code = dataStream.readUint8(0); + switch (code) { + case 0: + return null + case 1: + return FfiConverterTypeMozAdsRequestCachePolicy.read(dataStream) + default: + throw new UniFFIError(`Unexpected code: ${code}`); + } + } + + static write(dataStream, value) { + if (value === null || value === undefined) { + dataStream.writeUint8(0); + return; + } + dataStream.writeUint8(1); + FfiConverterTypeMozAdsRequestCachePolicy.write(dataStream, value) + } + + static computeSize(value) { + if (value === null || value === undefined) { + return 1; + } + return 1 + FfiConverterTypeMozAdsRequestCachePolicy.computeSize(value) + } +} +/** + * MozAdsRequestOptions + */ +export class MozAdsRequestOptions { + constructor( + { + cachePolicy + } = { + cachePolicy: undefined + } + ) { + try { + FfiConverterOptionalTypeMozAdsRequestCachePolicy.checkType(cachePolicy) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("cachePolicy"); + } + throw e; + } + /** + * cachePolicy + */ + this.cachePolicy = cachePolicy; + } + + equals(other) { + return ( + this.cachePolicy == other.cachePolicy + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsRequestOptions extends FfiConverterArrayBuffer { + static read(dataStream) { + return new MozAdsRequestOptions({ + cachePolicy: FfiConverterOptionalTypeMozAdsRequestCachePolicy.read(dataStream), + }); + } + static write(dataStream, value) { + FfiConverterOptionalTypeMozAdsRequestCachePolicy.write(dataStream, value.cachePolicy); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterOptionalTypeMozAdsRequestCachePolicy.computeSize(value.cachePolicy); + return totalSize + } + + static checkType(value) { + super.checkType(value); + if (!(value instanceof MozAdsRequestOptions)) { + throw new UniFFITypeError(`Expected 'MozAdsRequestOptions', found '${typeof value}'`); + } + try { + FfiConverterOptionalTypeMozAdsRequestCachePolicy.checkType(value.cachePolicy); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".cachePolicy"); + } + throw e; + } + } +} +/** + * MozAdsSpocFrequencyCaps + */ +export class MozAdsSpocFrequencyCaps { + constructor( + { + capKey, + day + } = { + capKey: undefined, + day: undefined + } + ) { + try { + FfiConverterString.checkType(capKey) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("capKey"); + } + throw e; + } + try { + FfiConverterUInt32.checkType(day) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("day"); + } + throw e; + } + /** + * capKey + */ + this.capKey = capKey; + /** + * day + */ + this.day = day; + } + + equals(other) { + return ( + this.capKey == other.capKey + && this.day == other.day + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsSpocFrequencyCaps extends FfiConverterArrayBuffer { + static read(dataStream) { + return new MozAdsSpocFrequencyCaps({ + capKey: FfiConverterString.read(dataStream), + day: FfiConverterUInt32.read(dataStream), + }); + } + static write(dataStream, value) { + FfiConverterString.write(dataStream, value.capKey); + FfiConverterUInt32.write(dataStream, value.day); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterString.computeSize(value.capKey); + totalSize += FfiConverterUInt32.computeSize(value.day); + return totalSize + } + + static checkType(value) { + super.checkType(value); + if (!(value instanceof MozAdsSpocFrequencyCaps)) { + throw new UniFFITypeError(`Expected 'MozAdsSpocFrequencyCaps', found '${typeof value}'`); + } + try { + FfiConverterString.checkType(value.capKey); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".capKey"); + } + throw e; + } + try { + FfiConverterUInt32.checkType(value.day); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".day"); + } + throw e; + } + } +} +// Export the FFIConverter object to make external types work. +export class FfiConverterMapStringUInt32 extends FfiConverterArrayBuffer { + static read(dataStream) { + const len = dataStream.readInt32(); + const map = new Map(); + for (let i = 0; i < len; i++) { + const key = FfiConverterString.read(dataStream); + const value = FfiConverterUInt32.read(dataStream); + map.set(key, value); + } + + return map; + } + + static write(dataStream, map) { + dataStream.writeInt32(map.size); + for (const [key, value] of map) { + FfiConverterString.write(dataStream, key); + FfiConverterUInt32.write(dataStream, value); + } + } + + static computeSize(map) { + // The size of the length + let size = 4; + for (const [key, value] of map) { + size += FfiConverterString.computeSize(key); + size += FfiConverterUInt32.computeSize(value); + } + return size; + } + + static checkType(map) { + for (const [key, value] of map) { + try { + FfiConverterString.checkType(key); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("(key)"); + } + throw e; + } + + try { + FfiConverterUInt32.checkType(value); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(`[${key}]`); + } + throw e; + } + } + } +} + + +/** + * MozAdsSpocRanking + */ +export class MozAdsSpocRanking { + constructor( + { + priority, + personalizationModels, + itemScore + } = { + priority: undefined, + personalizationModels: undefined, + itemScore: undefined + } + ) { + try { + FfiConverterUInt32.checkType(priority) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("priority"); + } + throw e; + } + try { + FfiConverterMapStringUInt32.checkType(personalizationModels) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("personalizationModels"); + } + throw e; + } + try { + FfiConverterFloat64.checkType(itemScore) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("itemScore"); + } + throw e; + } + /** + * priority + */ + this.priority = priority; + /** + * personalizationModels + */ + this.personalizationModels = personalizationModels; + /** + * itemScore + */ + this.itemScore = itemScore; + } + + equals(other) { + return ( + this.priority == other.priority + && this.personalizationModels == other.personalizationModels + && this.itemScore == other.itemScore + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsSpocRanking extends FfiConverterArrayBuffer { + static read(dataStream) { + return new MozAdsSpocRanking({ + priority: FfiConverterUInt32.read(dataStream), + personalizationModels: FfiConverterMapStringUInt32.read(dataStream), + itemScore: FfiConverterFloat64.read(dataStream), + }); + } + static write(dataStream, value) { + FfiConverterUInt32.write(dataStream, value.priority); + FfiConverterMapStringUInt32.write(dataStream, value.personalizationModels); + FfiConverterFloat64.write(dataStream, value.itemScore); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterUInt32.computeSize(value.priority); + totalSize += FfiConverterMapStringUInt32.computeSize(value.personalizationModels); + totalSize += FfiConverterFloat64.computeSize(value.itemScore); + return totalSize + } + + static checkType(value) { + super.checkType(value); + if (!(value instanceof MozAdsSpocRanking)) { + throw new UniFFITypeError(`Expected 'MozAdsSpocRanking', found '${typeof value}'`); + } + try { + FfiConverterUInt32.checkType(value.priority); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".priority"); + } + throw e; + } + try { + FfiConverterMapStringUInt32.checkType(value.personalizationModels); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".personalizationModels"); + } + throw e; + } + try { + FfiConverterFloat64.checkType(value.itemScore); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".itemScore"); + } + throw e; + } + } +} +/** + * MozAdsSpoc + */ +export class MozAdsSpoc { + constructor( + { + blockKey, + callbacks, + caps, + domain, + excerpt, + format, + imageUrl, + ranking, + sponsor, + sponsoredByOverride, + title, + url + } = { + blockKey: undefined, + callbacks: undefined, + caps: undefined, + domain: undefined, + excerpt: undefined, + format: undefined, + imageUrl: undefined, + ranking: undefined, + sponsor: undefined, + sponsoredByOverride: undefined, + title: undefined, + url: undefined + } + ) { + try { + FfiConverterString.checkType(blockKey) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("blockKey"); + } + throw e; + } + try { + FfiConverterTypeMozAdsCallbacks.checkType(callbacks) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("callbacks"); + } + throw e; + } + try { + FfiConverterTypeMozAdsSpocFrequencyCaps.checkType(caps) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("caps"); + } + throw e; + } + try { + FfiConverterString.checkType(domain) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("domain"); + } + throw e; + } + try { + FfiConverterString.checkType(excerpt) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("excerpt"); + } + throw e; + } + try { + FfiConverterString.checkType(format) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("format"); + } + throw e; + } + try { + FfiConverterString.checkType(imageUrl) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("imageUrl"); + } + throw e; + } + try { + FfiConverterTypeMozAdsSpocRanking.checkType(ranking) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("ranking"); + } + throw e; + } + try { + FfiConverterString.checkType(sponsor) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("sponsor"); + } + throw e; + } + try { + FfiConverterOptionalString.checkType(sponsoredByOverride) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("sponsoredByOverride"); + } + throw e; + } + try { + FfiConverterString.checkType(title) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("title"); + } + throw e; + } + try { + FfiConverterString.checkType(url) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("url"); + } + throw e; + } + /** + * blockKey + */ + this.blockKey = blockKey; + /** + * callbacks + */ + this.callbacks = callbacks; + /** + * caps + */ + this.caps = caps; + /** + * domain + */ + this.domain = domain; + /** + * excerpt + */ + this.excerpt = excerpt; + /** + * format + */ + this.format = format; + /** + * imageUrl + */ + this.imageUrl = imageUrl; + /** + * ranking + */ + this.ranking = ranking; + /** + * sponsor + */ + this.sponsor = sponsor; + /** + * sponsoredByOverride + */ + this.sponsoredByOverride = sponsoredByOverride; + /** + * title + */ + this.title = title; + /** + * url + */ + this.url = url; + } + + equals(other) { + return ( + this.blockKey == other.blockKey + && this.callbacks.equals(other.callbacks) + && this.caps.equals(other.caps) + && this.domain == other.domain + && this.excerpt == other.excerpt + && this.format == other.format + && this.imageUrl == other.imageUrl + && this.ranking.equals(other.ranking) + && this.sponsor == other.sponsor + && this.sponsoredByOverride == other.sponsoredByOverride + && this.title == other.title + && this.url == other.url + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsSpoc extends FfiConverterArrayBuffer { + static read(dataStream) { + return new MozAdsSpoc({ + blockKey: FfiConverterString.read(dataStream), + callbacks: FfiConverterTypeMozAdsCallbacks.read(dataStream), + caps: FfiConverterTypeMozAdsSpocFrequencyCaps.read(dataStream), + domain: FfiConverterString.read(dataStream), + excerpt: FfiConverterString.read(dataStream), + format: FfiConverterString.read(dataStream), + imageUrl: FfiConverterString.read(dataStream), + ranking: FfiConverterTypeMozAdsSpocRanking.read(dataStream), + sponsor: FfiConverterString.read(dataStream), + sponsoredByOverride: FfiConverterOptionalString.read(dataStream), + title: FfiConverterString.read(dataStream), + url: FfiConverterString.read(dataStream), + }); + } + static write(dataStream, value) { + FfiConverterString.write(dataStream, value.blockKey); + FfiConverterTypeMozAdsCallbacks.write(dataStream, value.callbacks); + FfiConverterTypeMozAdsSpocFrequencyCaps.write(dataStream, value.caps); + FfiConverterString.write(dataStream, value.domain); + FfiConverterString.write(dataStream, value.excerpt); + FfiConverterString.write(dataStream, value.format); + FfiConverterString.write(dataStream, value.imageUrl); + FfiConverterTypeMozAdsSpocRanking.write(dataStream, value.ranking); + FfiConverterString.write(dataStream, value.sponsor); + FfiConverterOptionalString.write(dataStream, value.sponsoredByOverride); + FfiConverterString.write(dataStream, value.title); + FfiConverterString.write(dataStream, value.url); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterString.computeSize(value.blockKey); + totalSize += FfiConverterTypeMozAdsCallbacks.computeSize(value.callbacks); + totalSize += FfiConverterTypeMozAdsSpocFrequencyCaps.computeSize(value.caps); + totalSize += FfiConverterString.computeSize(value.domain); + totalSize += FfiConverterString.computeSize(value.excerpt); + totalSize += FfiConverterString.computeSize(value.format); + totalSize += FfiConverterString.computeSize(value.imageUrl); + totalSize += FfiConverterTypeMozAdsSpocRanking.computeSize(value.ranking); + totalSize += FfiConverterString.computeSize(value.sponsor); + totalSize += FfiConverterOptionalString.computeSize(value.sponsoredByOverride); + totalSize += FfiConverterString.computeSize(value.title); + totalSize += FfiConverterString.computeSize(value.url); + return totalSize + } + + static checkType(value) { + super.checkType(value); + if (!(value instanceof MozAdsSpoc)) { + throw new UniFFITypeError(`Expected 'MozAdsSpoc', found '${typeof value}'`); + } + try { + FfiConverterString.checkType(value.blockKey); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".blockKey"); + } + throw e; + } + try { + FfiConverterTypeMozAdsCallbacks.checkType(value.callbacks); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".callbacks"); + } + throw e; + } + try { + FfiConverterTypeMozAdsSpocFrequencyCaps.checkType(value.caps); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".caps"); + } + throw e; + } + try { + FfiConverterString.checkType(value.domain); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".domain"); + } + throw e; + } + try { + FfiConverterString.checkType(value.excerpt); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".excerpt"); + } + throw e; + } + try { + FfiConverterString.checkType(value.format); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".format"); + } + throw e; + } + try { + FfiConverterString.checkType(value.imageUrl); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".imageUrl"); + } + throw e; + } + try { + FfiConverterTypeMozAdsSpocRanking.checkType(value.ranking); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".ranking"); + } + throw e; + } + try { + FfiConverterString.checkType(value.sponsor); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".sponsor"); + } + throw e; + } + try { + FfiConverterOptionalString.checkType(value.sponsoredByOverride); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".sponsoredByOverride"); + } + throw e; + } + try { + FfiConverterString.checkType(value.title); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".title"); + } + throw e; + } + try { + FfiConverterString.checkType(value.url); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".url"); + } + throw e; + } + } +} +/** + * MozAdsTile + */ +export class MozAdsTile { + constructor( + { + blockKey, + callbacks, + format, + imageUrl, + name, + url + } = { + blockKey: undefined, + callbacks: undefined, + format: undefined, + imageUrl: undefined, + name: undefined, + url: undefined + } + ) { + try { + FfiConverterString.checkType(blockKey) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("blockKey"); + } + throw e; + } + try { + FfiConverterTypeMozAdsCallbacks.checkType(callbacks) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("callbacks"); + } + throw e; + } + try { + FfiConverterString.checkType(format) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("format"); + } + throw e; + } + try { + FfiConverterString.checkType(imageUrl) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("imageUrl"); + } + throw e; + } + try { + FfiConverterString.checkType(name) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("name"); + } + throw e; + } + try { + FfiConverterString.checkType(url) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("url"); + } + throw e; + } + /** + * blockKey + */ + this.blockKey = blockKey; + /** + * callbacks + */ + this.callbacks = callbacks; + /** + * format + */ + this.format = format; + /** + * imageUrl + */ + this.imageUrl = imageUrl; + /** + * name + */ + this.name = name; + /** + * url + */ + this.url = url; + } + + equals(other) { + return ( + this.blockKey == other.blockKey + && this.callbacks.equals(other.callbacks) + && this.format == other.format + && this.imageUrl == other.imageUrl + && this.name == other.name + && this.url == other.url + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsTile extends FfiConverterArrayBuffer { + static read(dataStream) { + return new MozAdsTile({ + blockKey: FfiConverterString.read(dataStream), + callbacks: FfiConverterTypeMozAdsCallbacks.read(dataStream), + format: FfiConverterString.read(dataStream), + imageUrl: FfiConverterString.read(dataStream), + name: FfiConverterString.read(dataStream), + url: FfiConverterString.read(dataStream), + }); + } + static write(dataStream, value) { + FfiConverterString.write(dataStream, value.blockKey); + FfiConverterTypeMozAdsCallbacks.write(dataStream, value.callbacks); + FfiConverterString.write(dataStream, value.format); + FfiConverterString.write(dataStream, value.imageUrl); + FfiConverterString.write(dataStream, value.name); + FfiConverterString.write(dataStream, value.url); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterString.computeSize(value.blockKey); + totalSize += FfiConverterTypeMozAdsCallbacks.computeSize(value.callbacks); + totalSize += FfiConverterString.computeSize(value.format); + totalSize += FfiConverterString.computeSize(value.imageUrl); + totalSize += FfiConverterString.computeSize(value.name); + totalSize += FfiConverterString.computeSize(value.url); + return totalSize + } + + static checkType(value) { + super.checkType(value); + if (!(value instanceof MozAdsTile)) { + throw new UniFFITypeError(`Expected 'MozAdsTile', found '${typeof value}'`); + } + try { + FfiConverterString.checkType(value.blockKey); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".blockKey"); + } + throw e; + } + try { + FfiConverterTypeMozAdsCallbacks.checkType(value.callbacks); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".callbacks"); + } + throw e; + } + try { + FfiConverterString.checkType(value.format); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".format"); + } + throw e; + } + try { + FfiConverterString.checkType(value.imageUrl); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".imageUrl"); + } + throw e; + } + try { + FfiConverterString.checkType(value.name); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".name"); + } + throw e; + } + try { + FfiConverterString.checkType(value.url); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".url"); + } + throw e; + } + } +} + +/** + * MozAdsClientApiError + */ +export class MozAdsClientApiError extends Error {} + + +/** + * Other + */ +export class Other extends MozAdsClientApiError { + + constructor( + reason, + ...params + ) { + const message = `reason: ${ reason }`; + super(message, ...params); + this.reason = reason; + } + toString() { + return `Other: ${super.toString()}` + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsClientApiError extends FfiConverterArrayBuffer { + static read(dataStream) { + switch (dataStream.readInt32()) { + case 1: + return new Other( + FfiConverterString.read(dataStream) + ); + default: + throw new UniFFITypeError("Unknown MozAdsClientApiError variant"); + } + } + static computeSize(value) { + // Size of the Int indicating the variant + let totalSize = 4; + if (value instanceof Other) { + totalSize += FfiConverterString.computeSize(value.reason); + return totalSize; + } + throw new UniFFITypeError("Unknown MozAdsClientApiError variant"); + } + static write(dataStream, value) { + if (value instanceof Other) { + dataStream.writeInt32(1); + FfiConverterString.write(dataStream, value.reason); + return; + } + throw new UniFFITypeError("Unknown MozAdsClientApiError variant"); + } + + static errorClass = MozAdsClientApiError; +} +// Export the FFIConverter object to make external types work. +export class FfiConverterSequenceTypeMozAdsPlacementRequest extends FfiConverterArrayBuffer { + static read(dataStream) { + const len = dataStream.readInt32(); + const arr = []; + for (let i = 0; i < len; i++) { + arr.push(FfiConverterTypeMozAdsPlacementRequest.read(dataStream)); + } + return arr; + } + + static write(dataStream, value) { + dataStream.writeInt32(value.length); + value.forEach((innerValue) => { + FfiConverterTypeMozAdsPlacementRequest.write(dataStream, innerValue); + }) + } + + static computeSize(value) { + // The size of the length + let size = 4; + for (const innerValue of value) { + size += FfiConverterTypeMozAdsPlacementRequest.computeSize(innerValue); + } + return size; + } + + static checkType(value) { + if (!Array.isArray(value)) { + throw new UniFFITypeError(`${value} is not an array`); + } + value.forEach((innerValue, idx) => { + try { + FfiConverterTypeMozAdsPlacementRequest.checkType(innerValue); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(`[${idx}]`); + } + throw e; + } + }) + } +} +// Export the FFIConverter object to make external types work. +export class FfiConverterOptionalTypeMozAdsRequestOptions extends FfiConverterArrayBuffer { + static checkType(value) { + if (value !== undefined && value !== null) { + FfiConverterTypeMozAdsRequestOptions.checkType(value) + } + } + + static read(dataStream) { + const code = dataStream.readUint8(0); + switch (code) { + case 0: + return null + case 1: + return FfiConverterTypeMozAdsRequestOptions.read(dataStream) + default: + throw new UniFFIError(`Unexpected code: ${code}`); + } + } + + static write(dataStream, value) { + if (value === null || value === undefined) { + dataStream.writeUint8(0); + return; + } + dataStream.writeUint8(1); + FfiConverterTypeMozAdsRequestOptions.write(dataStream, value) + } + + static computeSize(value) { + if (value === null || value === undefined) { + return 1; + } + return 1 + FfiConverterTypeMozAdsRequestOptions.computeSize(value) + } +} +// Export the FFIConverter object to make external types work. +export class FfiConverterMapStringTypeMozAdsImage extends FfiConverterArrayBuffer { + static read(dataStream) { + const len = dataStream.readInt32(); + const map = new Map(); + for (let i = 0; i < len; i++) { + const key = FfiConverterString.read(dataStream); + const value = FfiConverterTypeMozAdsImage.read(dataStream); + map.set(key, value); + } + + return map; + } + + static write(dataStream, map) { + dataStream.writeInt32(map.size); + for (const [key, value] of map) { + FfiConverterString.write(dataStream, key); + FfiConverterTypeMozAdsImage.write(dataStream, value); + } + } + + static computeSize(map) { + // The size of the length + let size = 4; + for (const [key, value] of map) { + size += FfiConverterString.computeSize(key); + size += FfiConverterTypeMozAdsImage.computeSize(value); + } + return size; + } + + static checkType(map) { + for (const [key, value] of map) { + try { + FfiConverterString.checkType(key); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("(key)"); + } + throw e; + } + + try { + FfiConverterTypeMozAdsImage.checkType(value); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(`[${key}]`); + } + throw e; + } + } + } +} +// Export the FFIConverter object to make external types work. +export class FfiConverterSequenceTypeMozAdsPlacementRequestWithCount extends FfiConverterArrayBuffer { + static read(dataStream) { + const len = dataStream.readInt32(); + const arr = []; + for (let i = 0; i < len; i++) { + arr.push(FfiConverterTypeMozAdsPlacementRequestWithCount.read(dataStream)); + } + return arr; + } + + static write(dataStream, value) { + dataStream.writeInt32(value.length); + value.forEach((innerValue) => { + FfiConverterTypeMozAdsPlacementRequestWithCount.write(dataStream, innerValue); + }) + } + + static computeSize(value) { + // The size of the length + let size = 4; + for (const innerValue of value) { + size += FfiConverterTypeMozAdsPlacementRequestWithCount.computeSize(innerValue); + } + return size; + } + + static checkType(value) { + if (!Array.isArray(value)) { + throw new UniFFITypeError(`${value} is not an array`); + } + value.forEach((innerValue, idx) => { + try { + FfiConverterTypeMozAdsPlacementRequestWithCount.checkType(innerValue); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(`[${idx}]`); + } + throw e; + } + }) + } +} +// Export the FFIConverter object to make external types work. +export class FfiConverterSequenceTypeMozAdsSpoc extends FfiConverterArrayBuffer { + static read(dataStream) { + const len = dataStream.readInt32(); + const arr = []; + for (let i = 0; i < len; i++) { + arr.push(FfiConverterTypeMozAdsSpoc.read(dataStream)); + } + return arr; + } + + static write(dataStream, value) { + dataStream.writeInt32(value.length); + value.forEach((innerValue) => { + FfiConverterTypeMozAdsSpoc.write(dataStream, innerValue); + }) + } + + static computeSize(value) { + // The size of the length + let size = 4; + for (const innerValue of value) { + size += FfiConverterTypeMozAdsSpoc.computeSize(innerValue); + } + return size; + } + + static checkType(value) { + if (!Array.isArray(value)) { + throw new UniFFITypeError(`${value} is not an array`); + } + value.forEach((innerValue, idx) => { + try { + FfiConverterTypeMozAdsSpoc.checkType(innerValue); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(`[${idx}]`); + } + throw e; + } + }) + } +} +// Export the FFIConverter object to make external types work. +export class FfiConverterMapStringSequenceTypeMozAdsSpoc extends FfiConverterArrayBuffer { + static read(dataStream) { + const len = dataStream.readInt32(); + const map = new Map(); + for (let i = 0; i < len; i++) { + const key = FfiConverterString.read(dataStream); + const value = FfiConverterSequenceTypeMozAdsSpoc.read(dataStream); + map.set(key, value); + } + + return map; + } + + static write(dataStream, map) { + dataStream.writeInt32(map.size); + for (const [key, value] of map) { + FfiConverterString.write(dataStream, key); + FfiConverterSequenceTypeMozAdsSpoc.write(dataStream, value); + } + } + + static computeSize(map) { + // The size of the length + let size = 4; + for (const [key, value] of map) { + size += FfiConverterString.computeSize(key); + size += FfiConverterSequenceTypeMozAdsSpoc.computeSize(value); + } + return size; + } + + static checkType(map) { + for (const [key, value] of map) { + try { + FfiConverterString.checkType(key); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("(key)"); + } + throw e; + } + + try { + FfiConverterSequenceTypeMozAdsSpoc.checkType(value); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(`[${key}]`); + } + throw e; + } + } + } +} +// Export the FFIConverter object to make external types work. +export class FfiConverterMapStringTypeMozAdsTile extends FfiConverterArrayBuffer { + static read(dataStream) { + const len = dataStream.readInt32(); + const map = new Map(); + for (let i = 0; i < len; i++) { + const key = FfiConverterString.read(dataStream); + const value = FfiConverterTypeMozAdsTile.read(dataStream); + map.set(key, value); + } + + return map; + } + + static write(dataStream, map) { + dataStream.writeInt32(map.size); + for (const [key, value] of map) { + FfiConverterString.write(dataStream, key); + FfiConverterTypeMozAdsTile.write(dataStream, value); + } + } + + static computeSize(map) { + // The size of the length + let size = 4; + for (const [key, value] of map) { + size += FfiConverterString.computeSize(key); + size += FfiConverterTypeMozAdsTile.computeSize(value); + } + return size; + } + + static checkType(map) { + for (const [key, value] of map) { + try { + FfiConverterString.checkType(key); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("(key)"); + } + throw e; + } + + try { + FfiConverterTypeMozAdsTile.checkType(value); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(`[${key}]`); + } + throw e; + } + } + } +} + +/** + * MozAdsClientInterface + */ +export class MozAdsClientInterface { + /** + * clearCache + */ + clearCache() { + throw Error("clearCache not implemented"); + } + /** + * cycleContextId + * @returns {string} + */ + cycleContextId() { + throw Error("cycleContextId not implemented"); + } + /** + * recordClick + * @param {string} clickUrl + */ + async recordClick( + clickUrl) { + throw Error("recordClick not implemented"); + } + /** + * recordImpression + * @param {string} impressionUrl + */ + async recordImpression( + impressionUrl) { + throw Error("recordImpression not implemented"); + } + /** + * reportAd + * @param {string} reportUrl + */ + async reportAd( + reportUrl) { + throw Error("reportAd not implemented"); + } + /** + * requestImageAds + * @param {Array.} mozAdRequests + * @param {?MozAdsRequestOptions} options + * @returns {Promise}} + */ + async requestImageAds( + mozAdRequests, + options) { + throw Error("requestImageAds not implemented"); + } + /** + * requestSpocAds + * @param {Array.} mozAdRequests + * @param {?MozAdsRequestOptions} options + * @returns {Promise}} + */ + async requestSpocAds( + mozAdRequests, + options) { + throw Error("requestSpocAds not implemented"); + } + /** + * requestTileAds + * @param {Array.} mozAdRequests + * @param {?MozAdsRequestOptions} options + * @returns {Promise}} + */ + async requestTileAds( + mozAdRequests, + options) { + throw Error("requestTileAds not implemented"); + } + +} + +/** + * MozAdsClient + */ +export class MozAdsClient extends MozAdsClientInterface { + // Use `init` to instantiate this class. + // DO NOT USE THIS CONSTRUCTOR DIRECTLY + constructor(opts) { + super(); + if (!Object.prototype.hasOwnProperty.call(opts, constructUniffiObject)) { + throw new UniFFIError("Attempting to construct an int 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]; + } + /** + * init + * @param {?MozAdsClientConfig} clientConfig + * @returns {MozAdsClient} + */ + static init( + clientConfig) { + + FfiConverterOptionalTypeMozAdsClientConfig.checkType(clientConfig); + const result = UniFFIScaffolding.callSync( + 6, // uniffi_ads_client_fn_constructor_mozadsclient_new + FfiConverterOptionalTypeMozAdsClientConfig.lower(clientConfig), + ) + return handleRustResult( + result, + FfiConverterTypeMozAdsClient.lift.bind(FfiConverterTypeMozAdsClient), + null, + ) + } + + /** + * clearCache + */ + clearCache() { + + const result = UniFFIScaffolding.callSync( + 7, // uniffi_ads_client_fn_method_mozadsclient_clear_cache + FfiConverterTypeMozAdsClient.lowerReceiver(this), + ) + return handleRustResult( + result, + (result) => undefined, + FfiConverterTypeMozAdsClientApiError.lift.bind(FfiConverterTypeMozAdsClientApiError), + ) + } + + /** + * cycleContextId + * @returns {string} + */ + cycleContextId() { + + const result = UniFFIScaffolding.callSync( + 8, // uniffi_ads_client_fn_method_mozadsclient_cycle_context_id + FfiConverterTypeMozAdsClient.lowerReceiver(this), + ) + return handleRustResult( + result, + FfiConverterString.lift.bind(FfiConverterString), + FfiConverterTypeMozAdsClientApiError.lift.bind(FfiConverterTypeMozAdsClientApiError), + ) + } + + /** + * recordClick + * @param {string} clickUrl + */ + async recordClick( + clickUrl) { + + FfiConverterString.checkType(clickUrl); + const result = await UniFFIScaffolding.callAsyncWrapper( + 9, // uniffi_ads_client_fn_method_mozadsclient_record_click + FfiConverterTypeMozAdsClient.lowerReceiver(this), + FfiConverterString.lower(clickUrl), + ) + return handleRustResult( + result, + (result) => undefined, + FfiConverterTypeMozAdsClientApiError.lift.bind(FfiConverterTypeMozAdsClientApiError), + ) + } + + /** + * recordImpression + * @param {string} impressionUrl + */ + async recordImpression( + impressionUrl) { + + FfiConverterString.checkType(impressionUrl); + const result = await UniFFIScaffolding.callAsyncWrapper( + 10, // uniffi_ads_client_fn_method_mozadsclient_record_impression + FfiConverterTypeMozAdsClient.lowerReceiver(this), + FfiConverterString.lower(impressionUrl), + ) + return handleRustResult( + result, + (result) => undefined, + FfiConverterTypeMozAdsClientApiError.lift.bind(FfiConverterTypeMozAdsClientApiError), + ) + } + + /** + * reportAd + * @param {string} reportUrl + */ + async reportAd( + reportUrl) { + + FfiConverterString.checkType(reportUrl); + const result = await UniFFIScaffolding.callAsyncWrapper( + 11, // uniffi_ads_client_fn_method_mozadsclient_report_ad + FfiConverterTypeMozAdsClient.lowerReceiver(this), + FfiConverterString.lower(reportUrl), + ) + return handleRustResult( + result, + (result) => undefined, + FfiConverterTypeMozAdsClientApiError.lift.bind(FfiConverterTypeMozAdsClientApiError), + ) + } + + /** + * requestImageAds + * @param {Array.} mozAdRequests + * @param {?MozAdsRequestOptions} options + * @returns {Promise}} + */ + async requestImageAds( + mozAdRequests, + options) { + + FfiConverterSequenceTypeMozAdsPlacementRequest.checkType(mozAdRequests); + FfiConverterOptionalTypeMozAdsRequestOptions.checkType(options); + const result = await UniFFIScaffolding.callAsyncWrapper( + 12, // uniffi_ads_client_fn_method_mozadsclient_request_image_ads + FfiConverterTypeMozAdsClient.lowerReceiver(this), + FfiConverterSequenceTypeMozAdsPlacementRequest.lower(mozAdRequests), + FfiConverterOptionalTypeMozAdsRequestOptions.lower(options), + ) + return handleRustResult( + result, + FfiConverterMapStringTypeMozAdsImage.lift.bind(FfiConverterMapStringTypeMozAdsImage), + FfiConverterTypeMozAdsClientApiError.lift.bind(FfiConverterTypeMozAdsClientApiError), + ) + } + + /** + * requestSpocAds + * @param {Array.} mozAdRequests + * @param {?MozAdsRequestOptions} options + * @returns {Promise}} + */ + async requestSpocAds( + mozAdRequests, + options) { + + FfiConverterSequenceTypeMozAdsPlacementRequestWithCount.checkType(mozAdRequests); + FfiConverterOptionalTypeMozAdsRequestOptions.checkType(options); + const result = await UniFFIScaffolding.callAsyncWrapper( + 13, // uniffi_ads_client_fn_method_mozadsclient_request_spoc_ads + FfiConverterTypeMozAdsClient.lowerReceiver(this), + FfiConverterSequenceTypeMozAdsPlacementRequestWithCount.lower(mozAdRequests), + FfiConverterOptionalTypeMozAdsRequestOptions.lower(options), + ) + return handleRustResult( + result, + FfiConverterMapStringSequenceTypeMozAdsSpoc.lift.bind(FfiConverterMapStringSequenceTypeMozAdsSpoc), + FfiConverterTypeMozAdsClientApiError.lift.bind(FfiConverterTypeMozAdsClientApiError), + ) + } + + /** + * requestTileAds + * @param {Array.} mozAdRequests + * @param {?MozAdsRequestOptions} options + * @returns {Promise}} + */ + async requestTileAds( + mozAdRequests, + options) { + + FfiConverterSequenceTypeMozAdsPlacementRequest.checkType(mozAdRequests); + FfiConverterOptionalTypeMozAdsRequestOptions.checkType(options); + const result = await UniFFIScaffolding.callAsyncWrapper( + 14, // uniffi_ads_client_fn_method_mozadsclient_request_tile_ads + FfiConverterTypeMozAdsClient.lowerReceiver(this), + FfiConverterSequenceTypeMozAdsPlacementRequest.lower(mozAdRequests), + FfiConverterOptionalTypeMozAdsRequestOptions.lower(options), + ) + return handleRustResult( + result, + FfiConverterMapStringTypeMozAdsTile.lift.bind(FfiConverterMapStringTypeMozAdsTile), + FfiConverterTypeMozAdsClientApiError.lift.bind(FfiConverterTypeMozAdsClientApiError), + ) + } + +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeMozAdsClient extends FfiConverter { + static lift(value) { + const opts = {}; + opts[constructUniffiObject] = value; + return new MozAdsClient(opts); + } + + static lower(value) { + const ptr = value[uniffiObjectPtr]; + if (!(ptr instanceof UniFFIPointer)) { + throw new UniFFITypeError("Object is not a 'MozAdsClient' instance"); + } + return ptr; + } + + static lowerReceiver(value) { + // This works exactly the same as lower for non-trait interfaces + return this.lower(value); + } + + static read(dataStream) { + return this.lift(dataStream.readPointer(2)); + } + + static write(dataStream, value) { + dataStream.writePointer(2, this.lower(value)); + } + + static computeSize(value) { + return 8; + } +} + + + +// Export the FFIConverter object to make external types work. +export class FfiConverterOptionalTypeMozAdsClientConfig extends FfiConverterArrayBuffer { + static checkType(value) { + if (value !== undefined && value !== null) { + FfiConverterTypeMozAdsClientConfig.checkType(value) + } + } + + static read(dataStream) { + const code = dataStream.readUint8(0); + switch (code) { + case 0: + return null + case 1: + return FfiConverterTypeMozAdsClientConfig.read(dataStream) + default: + throw new UniFFIError(`Unexpected code: ${code}`); + } + } + + static write(dataStream, value) { + if (value === null || value === undefined) { + dataStream.writeUint8(0); + return; + } + dataStream.writeUint8(1); + FfiConverterTypeMozAdsClientConfig.write(dataStream, value) + } + + static computeSize(value) { + if (value === null || value === undefined) { + return 1; + } + return 1 + FfiConverterTypeMozAdsClientConfig.computeSize(value) + } +} diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustContextId.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustContextId.sys.mjs index 2f1b1a1692d6c..888f60c32f28b 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustContextId.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustContextId.sys.mjs @@ -162,7 +162,7 @@ export class ContextIdComponent extends ContextIdComponentInterface { FfiConverterBoolean.checkType(runningInTestAutomation); FfiConverterTypeContextIdCallback.checkType(callback); const result = UniFFIScaffolding.callSync( - 1, // uniffi_context_id_fn_constructor_contextidcomponent_new + 15, // uniffi_context_id_fn_constructor_contextidcomponent_new FfiConverterString.lower(initContextId), FfiConverterInt64.lower(creationTimestampS), FfiConverterBoolean.lower(runningInTestAutomation), @@ -181,7 +181,7 @@ export class ContextIdComponent extends ContextIdComponentInterface { async forceRotation() { const result = await UniFFIScaffolding.callAsyncWrapper( - 2, // uniffi_context_id_fn_method_contextidcomponent_force_rotation + 16, // uniffi_context_id_fn_method_contextidcomponent_force_rotation FfiConverterTypeContextIDComponent.lowerReceiver(this), ) return handleRustResult( @@ -201,7 +201,7 @@ export class ContextIdComponent extends ContextIdComponentInterface { FfiConverterUInt8.checkType(rotationDaysInS); const result = await UniFFIScaffolding.callAsyncWrapper( - 3, // uniffi_context_id_fn_method_contextidcomponent_request + 17, // uniffi_context_id_fn_method_contextidcomponent_request FfiConverterTypeContextIDComponent.lowerReceiver(this), FfiConverterUInt8.lower(rotationDaysInS), ) @@ -219,7 +219,7 @@ export class ContextIdComponent extends ContextIdComponentInterface { async unsetCallback() { const result = await UniFFIScaffolding.callAsyncWrapper( - 4, // uniffi_context_id_fn_method_contextidcomponent_unset_callback + 18, // uniffi_context_id_fn_method_contextidcomponent_unset_callback FfiConverterTypeContextIDComponent.lowerReceiver(this), ) return handleRustResult( @@ -253,11 +253,11 @@ export class FfiConverterTypeContextIDComponent extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(1)); + return this.lift(dataStream.readPointer(3)); } static write(dataStream, value) { - dataStream.writePointer(1, this.lower(value)); + dataStream.writePointer(3, this.lower(value)); } static computeSize(value) { @@ -320,7 +320,7 @@ export class FfiConverterTypeContextIdCallback extends FfiConverter { } const uniffiCallbackHandlerContextIdContextIdCallback = new UniFFICallbackHandler( "ContextIdCallback", - 1, + 2, [ new UniFFICallbackMethodHandler( "persist", diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustFilterAdult.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustFilterAdult.sys.mjs index 09fe5124e62a6..43b262b37e1bf 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustFilterAdult.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustFilterAdult.sys.mjs @@ -135,7 +135,7 @@ export class FilterAdultComponent extends FilterAdultComponentInterface { static init() { const result = UniFFIScaffolding.callSync( - 5, // uniffi_filter_adult_fn_constructor_filteradultcomponent_new + 19, // uniffi_filter_adult_fn_constructor_filteradultcomponent_new ) return handleRustResult( result, @@ -154,7 +154,7 @@ export class FilterAdultComponent extends FilterAdultComponentInterface { FfiConverterString.checkType(baseDomainToCheck); const result = UniFFIScaffolding.callSync( - 6, // uniffi_filter_adult_fn_method_filteradultcomponent_contains + 20, // uniffi_filter_adult_fn_method_filteradultcomponent_contains FfiConverterTypeFilterAdultComponent.lowerReceiver(this), FfiConverterString.lower(baseDomainToCheck), ) @@ -189,11 +189,11 @@ export class FfiConverterTypeFilterAdultComponent extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(2)); + return this.lift(dataStream.readPointer(4)); } static write(dataStream, value) { - dataStream.writePointer(2, this.lower(value)); + dataStream.writePointer(4, this.lower(value)); } static computeSize(value) { diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustInitRustComponents.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustInitRustComponents.sys.mjs index 3277d513798cb..a0beba9de31a2 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustInitRustComponents.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustInitRustComponents.sys.mjs @@ -48,7 +48,7 @@ export async function initialize( FfiConverterString.checkType(profilePath); const result = await UniFFIScaffolding.callAsyncWrapper( - 7, // uniffi_init_rust_components_fn_func_initialize + 21, // uniffi_init_rust_components_fn_func_initialize FfiConverterString.lower(profilePath), ) return handleRustResult( diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustLogins.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustLogins.sys.mjs index 3da4b15599a4d..290bcd9a1ab92 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustLogins.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustLogins.sys.mjs @@ -48,7 +48,7 @@ FfiConverterString.checkType(canary); FfiConverterString.checkType(text); FfiConverterString.checkType(encryptionKey); const result = UniFFIScaffolding.callSync( - 8, // uniffi_logins_fn_func_check_canary + 22, // uniffi_logins_fn_func_check_canary FfiConverterString.lower(canary), FfiConverterString.lower(text), FfiConverterString.lower(encryptionKey), @@ -73,7 +73,7 @@ export function createCanary( FfiConverterString.checkType(text); FfiConverterString.checkType(encryptionKey); const result = UniFFIScaffolding.callSync( - 9, // uniffi_logins_fn_func_create_canary + 23, // uniffi_logins_fn_func_create_canary FfiConverterString.lower(text), FfiConverterString.lower(encryptionKey), ) @@ -92,7 +92,7 @@ return handleRustResult( export function createKey() { const result = UniFFIScaffolding.callSync( - 10, // uniffi_logins_fn_func_create_key + 24, // uniffi_logins_fn_func_create_key ) return handleRustResult( result, @@ -114,7 +114,7 @@ export function createLoginStoreWithNssKeymanager( FfiConverterString.checkType(path); FfiConverterTypePrimaryPasswordAuthenticator.checkType(primaryPasswordAuthenticator); const result = UniFFIScaffolding.callSync( - 11, // uniffi_logins_fn_func_create_login_store_with_nss_keymanager + 25, // uniffi_logins_fn_func_create_login_store_with_nss_keymanager FfiConverterString.lower(path), FfiConverterTypePrimaryPasswordAuthenticator.lower(primaryPasswordAuthenticator), ) @@ -139,7 +139,7 @@ export function createLoginStoreWithStaticKeyManager( FfiConverterString.checkType(path); FfiConverterString.checkType(key); const result = UniFFIScaffolding.callSync( - 12, // uniffi_logins_fn_func_create_login_store_with_static_key_manager + 26, // uniffi_logins_fn_func_create_login_store_with_static_key_manager FfiConverterString.lower(path), FfiConverterString.lower(key), ) @@ -161,7 +161,7 @@ export function createManagedEncdec( FfiConverterTypeKeyManager.checkType(keyManager); const result = UniFFIScaffolding.callSync( - 13, // uniffi_logins_fn_func_create_managed_encdec + 27, // uniffi_logins_fn_func_create_managed_encdec FfiConverterTypeKeyManager.lower(keyManager), ) return handleRustResult( @@ -175,7 +175,7 @@ return handleRustResult( * Utility function to create a StaticKeyManager to be used for the time * being until support lands for [trait implementation of an UniFFI * interface](https://mozilla.github.io/uniffi-rs/next/proc_macro/index.html#structs-implementing-traits) - * in UniFFI. + * in UniFFI. * @param {string} key * @returns {KeyManager} */ @@ -184,7 +184,7 @@ export function createStaticKeyManager( FfiConverterString.checkType(key); const result = UniFFIScaffolding.callSync( - 14, // uniffi_logins_fn_func_create_static_key_manager + 28, // uniffi_logins_fn_func_create_static_key_manager FfiConverterString.lower(key), ) return handleRustResult( @@ -235,6 +235,42 @@ export class FfiConverterOptionalString extends FfiConverterArrayBuffer { return 1 + FfiConverterString.computeSize(value) } } +// Export the FFIConverter object to make external types work. +export class FfiConverterOptionalInt64 extends FfiConverterArrayBuffer { + static checkType(value) { + if (value !== undefined && value !== null) { + FfiConverterInt64.checkType(value) + } + } + + static read(dataStream) { + const code = dataStream.readUint8(0); + switch (code) { + case 0: + return null + case 1: + return FfiConverterInt64.read(dataStream) + default: + throw new UniFFIError(`Unexpected code: ${code}`); + } + } + + static write(dataStream, value) { + if (value === null || value === undefined) { + dataStream.writeUint8(0); + return; + } + dataStream.writeUint8(1); + FfiConverterInt64.write(dataStream, value) + } + + static computeSize(value) { + if (value === null || value === undefined) { + return 1; + } + return 1 + FfiConverterInt64.computeSize(value) + } +} /** * A login stored in the database */ @@ -252,7 +288,9 @@ export class Login { usernameField, passwordField, password, - username + username, + timeOfLastBreach, + timeLastBreachAlertDismissed } = { id: undefined, timesUsed: undefined, @@ -265,7 +303,9 @@ export class Login { usernameField: undefined, passwordField: undefined, password: undefined, - username: undefined + username: undefined, + timeOfLastBreach: undefined, + timeLastBreachAlertDismissed: undefined } ) { try { @@ -364,6 +404,22 @@ export class Login { } throw e; } + try { + FfiConverterOptionalInt64.checkType(timeOfLastBreach) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("timeOfLastBreach"); + } + throw e; + } + try { + FfiConverterOptionalInt64.checkType(timeLastBreachAlertDismissed) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("timeLastBreachAlertDismissed"); + } + throw e; + } /** * id */ @@ -412,6 +468,18 @@ export class Login { * username */ this.username = username; + /** + * These fields can be synced from Desktop and are NOT included in LoginEntry, + * so update() will not modify them. Use the dedicated API methods to manipulate: + * record_breach(), reset_all_breaches(), is_potentially_breached(), + * record_breach_alert_dismissal(), record_breach_alert_dismissal_time(), + * and is_breach_alert_dismissed(). + */ + this.timeOfLastBreach = timeOfLastBreach; + /** + * timeLastBreachAlertDismissed + */ + this.timeLastBreachAlertDismissed = timeLastBreachAlertDismissed; } equals(other) { @@ -428,6 +496,8 @@ export class Login { && this.passwordField == other.passwordField && this.password == other.password && this.username == other.username + && this.timeOfLastBreach == other.timeOfLastBreach + && this.timeLastBreachAlertDismissed == other.timeLastBreachAlertDismissed ) } } @@ -448,6 +518,8 @@ export class FfiConverterTypeLogin extends FfiConverterArrayBuffer { passwordField: FfiConverterString.read(dataStream), password: FfiConverterString.read(dataStream), username: FfiConverterString.read(dataStream), + timeOfLastBreach: FfiConverterOptionalInt64.read(dataStream), + timeLastBreachAlertDismissed: FfiConverterOptionalInt64.read(dataStream), }); } static write(dataStream, value) { @@ -463,6 +535,8 @@ export class FfiConverterTypeLogin extends FfiConverterArrayBuffer { FfiConverterString.write(dataStream, value.passwordField); FfiConverterString.write(dataStream, value.password); FfiConverterString.write(dataStream, value.username); + FfiConverterOptionalInt64.write(dataStream, value.timeOfLastBreach); + FfiConverterOptionalInt64.write(dataStream, value.timeLastBreachAlertDismissed); } static computeSize(value) { @@ -479,6 +553,8 @@ export class FfiConverterTypeLogin extends FfiConverterArrayBuffer { totalSize += FfiConverterString.computeSize(value.passwordField); totalSize += FfiConverterString.computeSize(value.password); totalSize += FfiConverterString.computeSize(value.username); + totalSize += FfiConverterOptionalInt64.computeSize(value.timeOfLastBreach); + totalSize += FfiConverterOptionalInt64.computeSize(value.timeLastBreachAlertDismissed); return totalSize } @@ -583,6 +659,22 @@ export class FfiConverterTypeLogin extends FfiConverterArrayBuffer { } throw e; } + try { + FfiConverterOptionalInt64.checkType(value.timeOfLastBreach); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".timeOfLastBreach"); + } + throw e; + } + try { + FfiConverterOptionalInt64.checkType(value.timeLastBreachAlertDismissed); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".timeLastBreachAlertDismissed"); + } + throw e; + } } } /** @@ -1772,7 +1864,7 @@ export class EncryptorDecryptorImpl extends EncryptorDecryptor { FfiConverterBytes.checkType(ciphertext); const result = UniFFIScaffolding.callSync( - 15, // uniffi_logins_fn_method_encryptordecryptor_decrypt + 29, // uniffi_logins_fn_method_encryptordecryptor_decrypt FfiConverterTypeEncryptorDecryptor.lowerReceiver(this), FfiConverterBytes.lower(ciphertext), ) @@ -1793,7 +1885,7 @@ export class EncryptorDecryptorImpl extends EncryptorDecryptor { FfiConverterBytes.checkType(cleartext); const result = UniFFIScaffolding.callSync( - 16, // uniffi_logins_fn_method_encryptordecryptor_encrypt + 30, // uniffi_logins_fn_method_encryptordecryptor_encrypt FfiConverterTypeEncryptorDecryptor.lowerReceiver(this), FfiConverterBytes.lower(cleartext), ) @@ -1837,11 +1929,11 @@ export class FfiConverterTypeEncryptorDecryptor extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(3)); + return this.lift(dataStream.readPointer(5)); } static write(dataStream, value) { - dataStream.writePointer(3, this.lower(value)); + dataStream.writePointer(5, this.lower(value)); } static computeSize(value) { @@ -1851,7 +1943,7 @@ export class FfiConverterTypeEncryptorDecryptor extends FfiConverter { const uniffiCallbackHandlerLoginsEncryptorDecryptor = new UniFFICallbackHandler( "EncryptorDecryptor", - 2, + 3, [ new UniFFICallbackMethodHandler( "decrypt", @@ -1924,7 +2016,7 @@ export class KeyManagerImpl extends KeyManager { getKey() { const result = UniFFIScaffolding.callSync( - 17, // uniffi_logins_fn_method_keymanager_get_key + 31, // uniffi_logins_fn_method_keymanager_get_key FfiConverterTypeKeyManager.lowerReceiver(this), ) return handleRustResult( @@ -1967,11 +2059,11 @@ export class FfiConverterTypeKeyManager extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(4)); + return this.lift(dataStream.readPointer(6)); } static write(dataStream, value) { - dataStream.writePointer(4, this.lower(value)); + dataStream.writePointer(6, this.lower(value)); } static computeSize(value) { @@ -1981,7 +2073,7 @@ export class FfiConverterTypeKeyManager extends FfiConverter { const uniffiCallbackHandlerLoginsKeyManager = new UniFFICallbackHandler( "KeyManager", - 3, + 4, [ new UniFFICallbackMethodHandler( "getKey", @@ -2444,6 +2536,15 @@ export class LoginStoreInterface { baseDomain) { throw Error("hasLoginsByBaseDomain not implemented"); } + /** + * Determines whether a breach alert has been dismissed, based on the breach date and the alert dismissal timestamp. + * @param {string} id + * @returns {boolean} + */ + isBreachAlertDismissed( + id) { + throw Error("isBreachAlertDismissed not implemented"); + } /** * isEmpty * @returns {boolean} @@ -2451,6 +2552,15 @@ export class LoginStoreInterface { isEmpty() { throw Error("isEmpty not implemented"); } + /** + * Determines whether a login’s password is potentially breached, based on the breach date and the time of the last password change. + * @param {string} id + * @returns {boolean} + */ + isPotentiallyBreached( + id) { + throw Error("isPotentiallyBreached not implemented"); + } /** * list * @returns {Array.} @@ -2458,6 +2568,35 @@ export class LoginStoreInterface { list() { throw Error("list not implemented"); } + /** + * Stores a known breach date for a login. + * In Firefox Desktop this is updated once per session from Remote Settings. + * @param {string} id + * @param {number} timestamp + */ + recordBreach( + id, + timestamp) { + throw Error("recordBreach not implemented"); + } + /** + * Stores that the user dismissed the breach alert for a login. + * @param {string} id + */ + recordBreachAlertDismissal( + id) { + throw Error("recordBreachAlertDismissal not implemented"); + } + /** + * Stores the time at which the user dismissed the breach alert for a login. + * @param {string} id + * @param {number} timestamp + */ + recordBreachAlertDismissalTime( + id, + timestamp) { + throw Error("recordBreachAlertDismissalTime not implemented"); + } /** * registerWithSyncManager */ @@ -2470,6 +2609,12 @@ export class LoginStoreInterface { reset() { throw Error("reset not implemented"); } + /** + * Removes all recorded breaches for all logins (i.e. sets time_of_last_breach to null). + */ + resetAllBreaches() { + throw Error("resetAllBreaches not implemented"); + } /** * Run maintenance on the DB * @@ -2561,7 +2706,7 @@ export class LoginStore extends LoginStoreInterface { FfiConverterString.checkType(path); FfiConverterTypeEncryptorDecryptor.checkType(encdec); const result = UniFFIScaffolding.callSync( - 18, // uniffi_logins_fn_constructor_loginstore_new + 32, // uniffi_logins_fn_constructor_loginstore_new FfiConverterString.lower(path), FfiConverterTypeEncryptorDecryptor.lower(encdec), ) @@ -2582,7 +2727,7 @@ export class LoginStore extends LoginStoreInterface { FfiConverterTypeLoginEntry.checkType(login); const result = UniFFIScaffolding.callSync( - 19, // uniffi_logins_fn_method_loginstore_add + 33, // uniffi_logins_fn_method_loginstore_add FfiConverterTypeLoginStore.lowerReceiver(this), FfiConverterTypeLoginEntry.lower(login), ) @@ -2603,7 +2748,7 @@ export class LoginStore extends LoginStoreInterface { FfiConverterSequenceTypeLoginEntry.checkType(logins); const result = UniFFIScaffolding.callSync( - 20, // uniffi_logins_fn_method_loginstore_add_many + 34, // uniffi_logins_fn_method_loginstore_add_many FfiConverterTypeLoginStore.lowerReceiver(this), FfiConverterSequenceTypeLoginEntry.lower(logins), ) @@ -2624,7 +2769,7 @@ export class LoginStore extends LoginStoreInterface { FfiConverterSequenceTypeLoginEntryWithMeta.checkType(entriesWithMeta); const result = UniFFIScaffolding.callSync( - 21, // uniffi_logins_fn_method_loginstore_add_many_with_meta + 35, // uniffi_logins_fn_method_loginstore_add_many_with_meta FfiConverterTypeLoginStore.lowerReceiver(this), FfiConverterSequenceTypeLoginEntryWithMeta.lower(entriesWithMeta), ) @@ -2645,7 +2790,7 @@ export class LoginStore extends LoginStoreInterface { FfiConverterTypeLoginEntry.checkType(login); const result = UniFFIScaffolding.callSync( - 22, // uniffi_logins_fn_method_loginstore_add_or_update + 36, // uniffi_logins_fn_method_loginstore_add_or_update FfiConverterTypeLoginStore.lowerReceiver(this), FfiConverterTypeLoginEntry.lower(login), ) @@ -2666,7 +2811,7 @@ export class LoginStore extends LoginStoreInterface { FfiConverterTypeLoginEntryWithMeta.checkType(entryWithMeta); const result = UniFFIScaffolding.callSync( - 23, // uniffi_logins_fn_method_loginstore_add_with_meta + 37, // uniffi_logins_fn_method_loginstore_add_with_meta FfiConverterTypeLoginStore.lowerReceiver(this), FfiConverterTypeLoginEntryWithMeta.lower(entryWithMeta), ) @@ -2684,7 +2829,7 @@ export class LoginStore extends LoginStoreInterface { count() { const result = UniFFIScaffolding.callSync( - 24, // uniffi_logins_fn_method_loginstore_count + 38, // uniffi_logins_fn_method_loginstore_count FfiConverterTypeLoginStore.lowerReceiver(this), ) return handleRustResult( @@ -2704,7 +2849,7 @@ export class LoginStore extends LoginStoreInterface { FfiConverterString.checkType(formActionOrigin); const result = UniFFIScaffolding.callSync( - 25, // uniffi_logins_fn_method_loginstore_count_by_form_action_origin + 39, // uniffi_logins_fn_method_loginstore_count_by_form_action_origin FfiConverterTypeLoginStore.lowerReceiver(this), FfiConverterString.lower(formActionOrigin), ) @@ -2725,7 +2870,7 @@ export class LoginStore extends LoginStoreInterface { FfiConverterString.checkType(origin); const result = UniFFIScaffolding.callSync( - 26, // uniffi_logins_fn_method_loginstore_count_by_origin + 40, // uniffi_logins_fn_method_loginstore_count_by_origin FfiConverterTypeLoginStore.lowerReceiver(this), FfiConverterString.lower(origin), ) @@ -2746,7 +2891,7 @@ export class LoginStore extends LoginStoreInterface { FfiConverterString.checkType(id); const result = UniFFIScaffolding.callSync( - 27, // uniffi_logins_fn_method_loginstore_delete + 41, // uniffi_logins_fn_method_loginstore_delete FfiConverterTypeLoginStore.lowerReceiver(this), FfiConverterString.lower(id), ) @@ -2767,7 +2912,7 @@ export class LoginStore extends LoginStoreInterface { FfiConverterSequenceString.checkType(ids); const result = UniFFIScaffolding.callSync( - 28, // uniffi_logins_fn_method_loginstore_delete_many + 42, // uniffi_logins_fn_method_loginstore_delete_many FfiConverterTypeLoginStore.lowerReceiver(this), FfiConverterSequenceString.lower(ids), ) @@ -2790,7 +2935,7 @@ export class LoginStore extends LoginStoreInterface { deleteUndecryptableRecordsForRemoteReplacement() { const result = UniFFIScaffolding.callSync( - 29, // uniffi_logins_fn_method_loginstore_delete_undecryptable_records_for_remote_replacement + 43, // uniffi_logins_fn_method_loginstore_delete_undecryptable_records_for_remote_replacement FfiConverterTypeLoginStore.lowerReceiver(this), ) return handleRustResult( @@ -2810,7 +2955,7 @@ export class LoginStore extends LoginStoreInterface { FfiConverterTypeLoginEntry.checkType(look); const result = UniFFIScaffolding.callSync( - 30, // uniffi_logins_fn_method_loginstore_find_login_to_update + 44, // uniffi_logins_fn_method_loginstore_find_login_to_update FfiConverterTypeLoginStore.lowerReceiver(this), FfiConverterTypeLoginEntry.lower(look), ) @@ -2831,7 +2976,7 @@ export class LoginStore extends LoginStoreInterface { FfiConverterString.checkType(id); const result = UniFFIScaffolding.callSync( - 31, // uniffi_logins_fn_method_loginstore_get + 45, // uniffi_logins_fn_method_loginstore_get FfiConverterTypeLoginStore.lowerReceiver(this), FfiConverterString.lower(id), ) @@ -2852,7 +2997,7 @@ export class LoginStore extends LoginStoreInterface { FfiConverterString.checkType(baseDomain); const result = UniFFIScaffolding.callSync( - 32, // uniffi_logins_fn_method_loginstore_get_by_base_domain + 46, // uniffi_logins_fn_method_loginstore_get_by_base_domain FfiConverterTypeLoginStore.lowerReceiver(this), FfiConverterString.lower(baseDomain), ) @@ -2870,7 +3015,7 @@ export class LoginStore extends LoginStoreInterface { getCheckpoint() { const result = UniFFIScaffolding.callSync( - 33, // uniffi_logins_fn_method_loginstore_get_checkpoint + 47, // uniffi_logins_fn_method_loginstore_get_checkpoint FfiConverterTypeLoginStore.lowerReceiver(this), ) return handleRustResult( @@ -2890,7 +3035,7 @@ export class LoginStore extends LoginStoreInterface { FfiConverterString.checkType(baseDomain); const result = UniFFIScaffolding.callSync( - 34, // uniffi_logins_fn_method_loginstore_has_logins_by_base_domain + 48, // uniffi_logins_fn_method_loginstore_has_logins_by_base_domain FfiConverterTypeLoginStore.lowerReceiver(this), FfiConverterString.lower(baseDomain), ) @@ -2901,6 +3046,27 @@ export class LoginStore extends LoginStoreInterface { ) } + /** + * Determines whether a breach alert has been dismissed, based on the breach date and the alert dismissal timestamp. + * @param {string} id + * @returns {boolean} + */ + isBreachAlertDismissed( + id) { + + FfiConverterString.checkType(id); + const result = UniFFIScaffolding.callSync( + 49, // uniffi_logins_fn_method_loginstore_is_breach_alert_dismissed + FfiConverterTypeLoginStore.lowerReceiver(this), + FfiConverterString.lower(id), + ) + return handleRustResult( + result, + FfiConverterBoolean.lift.bind(FfiConverterBoolean), + FfiConverterTypeLoginsApiError.lift.bind(FfiConverterTypeLoginsApiError), + ) + } + /** * isEmpty * @returns {boolean} @@ -2908,7 +3074,7 @@ export class LoginStore extends LoginStoreInterface { isEmpty() { const result = UniFFIScaffolding.callSync( - 35, // uniffi_logins_fn_method_loginstore_is_empty + 50, // uniffi_logins_fn_method_loginstore_is_empty FfiConverterTypeLoginStore.lowerReceiver(this), ) return handleRustResult( @@ -2918,6 +3084,27 @@ export class LoginStore extends LoginStoreInterface { ) } + /** + * Determines whether a login’s password is potentially breached, based on the breach date and the time of the last password change. + * @param {string} id + * @returns {boolean} + */ + isPotentiallyBreached( + id) { + + FfiConverterString.checkType(id); + const result = UniFFIScaffolding.callSync( + 51, // uniffi_logins_fn_method_loginstore_is_potentially_breached + FfiConverterTypeLoginStore.lowerReceiver(this), + FfiConverterString.lower(id), + ) + return handleRustResult( + result, + FfiConverterBoolean.lift.bind(FfiConverterBoolean), + FfiConverterTypeLoginsApiError.lift.bind(FfiConverterTypeLoginsApiError), + ) + } + /** * list * @returns {Array.} @@ -2925,7 +3112,7 @@ export class LoginStore extends LoginStoreInterface { list() { const result = UniFFIScaffolding.callSync( - 36, // uniffi_logins_fn_method_loginstore_list + 52, // uniffi_logins_fn_method_loginstore_list FfiConverterTypeLoginStore.lowerReceiver(this), ) return handleRustResult( @@ -2935,13 +3122,82 @@ export class LoginStore extends LoginStoreInterface { ) } + /** + * Stores a known breach date for a login. + * In Firefox Desktop this is updated once per session from Remote Settings. + * @param {string} id + * @param {number} timestamp + */ + recordBreach( + id, + timestamp) { + + FfiConverterString.checkType(id); + FfiConverterInt64.checkType(timestamp); + const result = UniFFIScaffolding.callSync( + 53, // uniffi_logins_fn_method_loginstore_record_breach + FfiConverterTypeLoginStore.lowerReceiver(this), + FfiConverterString.lower(id), + FfiConverterInt64.lower(timestamp), + ) + return handleRustResult( + result, + (result) => undefined, + FfiConverterTypeLoginsApiError.lift.bind(FfiConverterTypeLoginsApiError), + ) + } + + /** + * Stores that the user dismissed the breach alert for a login. + * @param {string} id + */ + recordBreachAlertDismissal( + id) { + + FfiConverterString.checkType(id); + const result = UniFFIScaffolding.callSync( + 54, // uniffi_logins_fn_method_loginstore_record_breach_alert_dismissal + FfiConverterTypeLoginStore.lowerReceiver(this), + FfiConverterString.lower(id), + ) + return handleRustResult( + result, + (result) => undefined, + FfiConverterTypeLoginsApiError.lift.bind(FfiConverterTypeLoginsApiError), + ) + } + + /** + * Stores the time at which the user dismissed the breach alert for a login. + * @param {string} id + * @param {number} timestamp + */ + recordBreachAlertDismissalTime( + id, + timestamp) { + + FfiConverterString.checkType(id); + FfiConverterInt64.checkType(timestamp); + const result = UniFFIScaffolding.callSync( + 55, // uniffi_logins_fn_method_loginstore_record_breach_alert_dismissal_time + FfiConverterTypeLoginStore.lowerReceiver(this), + FfiConverterString.lower(id), + FfiConverterInt64.lower(timestamp), + ) + return handleRustResult( + result, + (result) => undefined, + FfiConverterTypeLoginsApiError.lift.bind(FfiConverterTypeLoginsApiError), + ) + } + /** * registerWithSyncManager */ registerWithSyncManager() { const result = UniFFIScaffolding.callSync( - 37, // uniffi_logins_fn_method_loginstore_register_with_sync_manager + 56, // uniffi_logins_fn_method_loginstore_register_with_sync_manager FfiConverterTypeLoginStore.lowerReceiver(this), ) return handleRustResult( @@ -2957,7 +3213,23 @@ export class LoginStore extends LoginStoreInterface { reset() { const result = UniFFIScaffolding.callSync( - 38, // uniffi_logins_fn_method_loginstore_reset + 57, // uniffi_logins_fn_method_loginstore_reset + FfiConverterTypeLoginStore.lowerReceiver(this), + ) + return handleRustResult( + result, + (result) => undefined, + FfiConverterTypeLoginsApiError.lift.bind(FfiConverterTypeLoginsApiError), + ) + } + + /** + * Removes all recorded breaches for all logins (i.e. sets time_of_last_breach to null). + */ + resetAllBreaches() { + + const result = UniFFIScaffolding.callSync( + 58, // uniffi_logins_fn_method_loginstore_reset_all_breaches FfiConverterTypeLoginStore.lowerReceiver(this), ) return handleRustResult( @@ -2976,7 +3248,7 @@ export class LoginStore extends LoginStoreInterface { async runMaintenance() { const result = await UniFFIScaffolding.callAsyncWrapper( - 39, // uniffi_logins_fn_method_loginstore_run_maintenance + 59, // uniffi_logins_fn_method_loginstore_run_maintenance FfiConverterTypeLoginStore.lowerReceiver(this), ) return handleRustResult( @@ -2995,7 +3267,7 @@ export class LoginStore extends LoginStoreInterface { FfiConverterString.checkType(checkpoint); const result = UniFFIScaffolding.callSync( - 40, // uniffi_logins_fn_method_loginstore_set_checkpoint + 60, // uniffi_logins_fn_method_loginstore_set_checkpoint FfiConverterTypeLoginStore.lowerReceiver(this), FfiConverterString.lower(checkpoint), ) @@ -3012,7 +3284,7 @@ export class LoginStore extends LoginStoreInterface { shutdown() { const result = UniFFIScaffolding.callSync( - 41, // uniffi_logins_fn_method_loginstore_shutdown + 61, // uniffi_logins_fn_method_loginstore_shutdown FfiConverterTypeLoginStore.lowerReceiver(this), ) return handleRustResult( @@ -3031,7 +3303,7 @@ export class LoginStore extends LoginStoreInterface { FfiConverterString.checkType(id); const result = UniFFIScaffolding.callSync( - 42, // uniffi_logins_fn_method_loginstore_touch + 62, // uniffi_logins_fn_method_loginstore_touch FfiConverterTypeLoginStore.lowerReceiver(this), FfiConverterString.lower(id), ) @@ -3055,7 +3327,7 @@ export class LoginStore extends LoginStoreInterface { FfiConverterString.checkType(id); FfiConverterTypeLoginEntry.checkType(login); const result = UniFFIScaffolding.callSync( - 43, // uniffi_logins_fn_method_loginstore_update + 63, // uniffi_logins_fn_method_loginstore_update FfiConverterTypeLoginStore.lowerReceiver(this), FfiConverterString.lower(id), FfiConverterTypeLoginEntry.lower(login), @@ -3083,7 +3355,7 @@ export class LoginStore extends LoginStoreInterface { wipeLocal() { const result = UniFFIScaffolding.callSync( - 44, // uniffi_logins_fn_method_loginstore_wipe_local + 64, // uniffi_logins_fn_method_loginstore_wipe_local FfiConverterTypeLoginStore.lowerReceiver(this), ) return handleRustResult( @@ -3117,11 +3389,11 @@ export class FfiConverterTypeLoginStore extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(5)); + return this.lift(dataStream.readPointer(7)); } static write(dataStream, value) { - dataStream.writePointer(5, this.lower(value)); + dataStream.writePointer(7, this.lower(value)); } static computeSize(value) { @@ -3164,7 +3436,7 @@ export class ManagedEncryptorDecryptor extends ManagedEncryptorDecryptorInterfac FfiConverterTypeKeyManager.checkType(keyManager); const result = UniFFIScaffolding.callSync( - 45, // uniffi_logins_fn_constructor_managedencryptordecryptor_new + 65, // uniffi_logins_fn_constructor_managedencryptordecryptor_new FfiConverterTypeKeyManager.lower(keyManager), ) return handleRustResult( @@ -3198,11 +3470,11 @@ export class FfiConverterTypeManagedEncryptorDecryptor extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(6)); + return this.lift(dataStream.readPointer(8)); } static write(dataStream, value) { - dataStream.writePointer(6, this.lower(value)); + dataStream.writePointer(8, this.lower(value)); } static computeSize(value) { @@ -3332,7 +3604,7 @@ export class NssKeyManager extends NssKeyManagerInterface { FfiConverterTypePrimaryPasswordAuthenticator.checkType(primaryPasswordAuthenticator); const result = UniFFIScaffolding.callSync( - 46, // uniffi_logins_fn_constructor_nsskeymanager_new + 66, // uniffi_logins_fn_constructor_nsskeymanager_new FfiConverterTypePrimaryPasswordAuthenticator.lower(primaryPasswordAuthenticator), ) return handleRustResult( @@ -3349,7 +3621,7 @@ export class NssKeyManager extends NssKeyManagerInterface { intoDynKeyManager() { const result = UniFFIScaffolding.callSync( - 47, // uniffi_logins_fn_method_nsskeymanager_into_dyn_key_manager + 67, // uniffi_logins_fn_method_nsskeymanager_into_dyn_key_manager FfiConverterTypeNSSKeyManager.lowerReceiver(this), ) return handleRustResult( @@ -3383,11 +3655,11 @@ export class FfiConverterTypeNSSKeyManager extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(7)); + return this.lift(dataStream.readPointer(9)); } static write(dataStream, value) { - dataStream.writePointer(7, this.lower(value)); + dataStream.writePointer(9, this.lower(value)); } static computeSize(value) { @@ -3451,7 +3723,7 @@ export class PrimaryPasswordAuthenticatorImpl extends PrimaryPasswordAuthenticat async getPrimaryPassword() { const result = await UniFFIScaffolding.callAsync( - 48, // uniffi_logins_fn_method_primarypasswordauthenticator_get_primary_password + 68, // uniffi_logins_fn_method_primarypasswordauthenticator_get_primary_password FfiConverterTypePrimaryPasswordAuthenticator.lowerReceiver(this), ) return handleRustResult( @@ -3467,7 +3739,7 @@ export class PrimaryPasswordAuthenticatorImpl extends PrimaryPasswordAuthenticat async onAuthenticationSuccess() { const result = await UniFFIScaffolding.callAsync( - 49, // uniffi_logins_fn_method_primarypasswordauthenticator_on_authentication_success + 69, // uniffi_logins_fn_method_primarypasswordauthenticator_on_authentication_success FfiConverterTypePrimaryPasswordAuthenticator.lowerReceiver(this), ) return handleRustResult( @@ -3483,7 +3755,7 @@ export class PrimaryPasswordAuthenticatorImpl extends PrimaryPasswordAuthenticat async onAuthenticationFailure() { const result = await UniFFIScaffolding.callAsync( - 50, // uniffi_logins_fn_method_primarypasswordauthenticator_on_authentication_failure + 70, // uniffi_logins_fn_method_primarypasswordauthenticator_on_authentication_failure FfiConverterTypePrimaryPasswordAuthenticator.lowerReceiver(this), ) return handleRustResult( @@ -3526,11 +3798,11 @@ export class FfiConverterTypePrimaryPasswordAuthenticator extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(8)); + return this.lift(dataStream.readPointer(10)); } static write(dataStream, value) { - dataStream.writePointer(8, this.lower(value)); + dataStream.writePointer(10, this.lower(value)); } static computeSize(value) { @@ -3540,7 +3812,7 @@ export class FfiConverterTypePrimaryPasswordAuthenticator extends FfiConverter { const uniffiCallbackHandlerLoginsPrimaryPasswordAuthenticator = new UniFFICallbackHandler( "PrimaryPasswordAuthenticator", - 4, + 5, [ new UniFFICallbackMethodHandler( "getPrimaryPassword", @@ -3618,7 +3890,7 @@ export class StaticKeyManager extends StaticKeyManagerInterface { FfiConverterString.checkType(key); const result = UniFFIScaffolding.callSync( - 51, // uniffi_logins_fn_constructor_statickeymanager_new + 71, // uniffi_logins_fn_constructor_statickeymanager_new FfiConverterString.lower(key), ) return handleRustResult( @@ -3652,11 +3924,11 @@ export class FfiConverterTypeStaticKeyManager extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(9)); + return this.lift(dataStream.readPointer(11)); } static write(dataStream, value) { - dataStream.writePointer(9, this.lower(value)); + dataStream.writePointer(11, this.lower(value)); } static computeSize(value) { diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustRelevancy.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustRelevancy.sys.mjs index 08994a35f0315..1b345420e9b41 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustRelevancy.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustRelevancy.sys.mjs @@ -56,7 +56,7 @@ export function score( FfiConverterTypeInterestVector.checkType(interestVector); FfiConverterSequenceTypeInterest.checkType(contentCategories); const result = UniFFIScaffolding.callSync( - 52, // uniffi_relevancy_fn_func_score + 72, // uniffi_relevancy_fn_func_score FfiConverterTypeInterestVector.lower(interestVector), FfiConverterSequenceTypeInterest.lower(contentCategories), ) @@ -1414,7 +1414,7 @@ export class RelevancyStore extends RelevancyStoreInterface { FfiConverterString.checkType(dbPath); FfiConverterTypeRemoteSettingsService.checkType(remoteSettings); const result = UniFFIScaffolding.callSync( - 53, // uniffi_relevancy_fn_constructor_relevancystore_new + 73, // uniffi_relevancy_fn_constructor_relevancystore_new FfiConverterString.lower(dbPath), FfiConverterTypeRemoteSettingsService.lower(remoteSettings), ) @@ -1442,7 +1442,7 @@ export class RelevancyStore extends RelevancyStoreInterface { FfiConverterString.checkType(bandit); FfiConverterSequenceString.checkType(arms); const result = await UniFFIScaffolding.callAsyncWrapper( - 54, // uniffi_relevancy_fn_method_relevancystore_bandit_init + 74, // uniffi_relevancy_fn_method_relevancystore_bandit_init FfiConverterTypeRelevancyStore.lowerReceiver(this), FfiConverterString.lower(bandit), FfiConverterSequenceString.lower(arms), @@ -1473,7 +1473,7 @@ export class RelevancyStore extends RelevancyStoreInterface { FfiConverterString.checkType(bandit); FfiConverterSequenceString.checkType(arms); const result = await UniFFIScaffolding.callAsyncWrapper( - 55, // uniffi_relevancy_fn_method_relevancystore_bandit_select + 75, // uniffi_relevancy_fn_method_relevancystore_bandit_select FfiConverterTypeRelevancyStore.lowerReceiver(this), FfiConverterString.lower(bandit), FfiConverterSequenceString.lower(arms), @@ -1506,7 +1506,7 @@ export class RelevancyStore extends RelevancyStoreInterface { FfiConverterString.checkType(arm); FfiConverterBoolean.checkType(selected); const result = await UniFFIScaffolding.callAsyncWrapper( - 56, // uniffi_relevancy_fn_method_relevancystore_bandit_update + 76, // uniffi_relevancy_fn_method_relevancystore_bandit_update FfiConverterTypeRelevancyStore.lowerReceiver(this), FfiConverterString.lower(bandit), FfiConverterString.lower(arm), @@ -1527,7 +1527,7 @@ export class RelevancyStore extends RelevancyStoreInterface { close() { const result = UniFFIScaffolding.callSync( - 57, // uniffi_relevancy_fn_method_relevancystore_close + 77, // uniffi_relevancy_fn_method_relevancystore_close FfiConverterTypeRelevancyStore.lowerReceiver(this), ) return handleRustResult( @@ -1543,7 +1543,7 @@ export class RelevancyStore extends RelevancyStoreInterface { async ensureInterestDataPopulated() { const result = await UniFFIScaffolding.callAsyncWrapper( - 58, // uniffi_relevancy_fn_method_relevancystore_ensure_interest_data_populated + 78, // uniffi_relevancy_fn_method_relevancystore_ensure_interest_data_populated FfiConverterTypeRelevancyStore.lowerReceiver(this), ) return handleRustResult( @@ -1566,7 +1566,7 @@ export class RelevancyStore extends RelevancyStoreInterface { FfiConverterString.checkType(bandit); FfiConverterString.checkType(arm); const result = await UniFFIScaffolding.callAsyncWrapper( - 59, // uniffi_relevancy_fn_method_relevancystore_get_bandit_data + 79, // uniffi_relevancy_fn_method_relevancystore_get_bandit_data FfiConverterTypeRelevancyStore.lowerReceiver(this), FfiConverterString.lower(bandit), FfiConverterString.lower(arm), @@ -1598,7 +1598,7 @@ export class RelevancyStore extends RelevancyStoreInterface { FfiConverterSequenceString.checkType(topUrlsByFrecency); const result = await UniFFIScaffolding.callAsyncWrapper( - 60, // uniffi_relevancy_fn_method_relevancystore_ingest + 80, // uniffi_relevancy_fn_method_relevancystore_ingest FfiConverterTypeRelevancyStore.lowerReceiver(this), FfiConverterSequenceString.lower(topUrlsByFrecency), ) @@ -1615,7 +1615,7 @@ export class RelevancyStore extends RelevancyStoreInterface { interrupt() { const result = UniFFIScaffolding.callSync( - 61, // uniffi_relevancy_fn_method_relevancystore_interrupt + 81, // uniffi_relevancy_fn_method_relevancystore_interrupt FfiConverterTypeRelevancyStore.lowerReceiver(this), ) return handleRustResult( @@ -1635,7 +1635,7 @@ export class RelevancyStore extends RelevancyStoreInterface { async userInterestVector() { const result = await UniFFIScaffolding.callAsyncWrapper( - 62, // uniffi_relevancy_fn_method_relevancystore_user_interest_vector + 82, // uniffi_relevancy_fn_method_relevancystore_user_interest_vector FfiConverterTypeRelevancyStore.lowerReceiver(this), ) return handleRustResult( @@ -1669,11 +1669,11 @@ export class FfiConverterTypeRelevancyStore extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(10)); + return this.lift(dataStream.readPointer(12)); } static write(dataStream, value) { - dataStream.writePointer(10, this.lower(value)); + dataStream.writePointer(12, this.lower(value)); } static computeSize(value) { diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustRemoteSettings.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustRemoteSettings.sys.mjs index 59cdd929b9dc7..0ec203c631a2b 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustRemoteSettings.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustRemoteSettings.sys.mjs @@ -1623,7 +1623,7 @@ export class RemoteSettings extends RemoteSettingsInterface { FfiConverterTypeRemoteSettingsConfig.checkType(remoteSettingsConfig); const result = UniFFIScaffolding.callSync( - 63, // uniffi_remote_settings_fn_constructor_remotesettings_new + 83, // uniffi_remote_settings_fn_constructor_remotesettings_new FfiConverterTypeRemoteSettingsConfig.lower(remoteSettingsConfig), ) return handleRustResult( @@ -1645,7 +1645,7 @@ export class RemoteSettings extends RemoteSettingsInterface { FfiConverterString.checkType(attachmentId); FfiConverterString.checkType(path); const result = await UniFFIScaffolding.callAsyncWrapper( - 64, // uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path + 84, // uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path FfiConverterTypeRemoteSettings.lowerReceiver(this), FfiConverterString.lower(attachmentId), FfiConverterString.lower(path), @@ -1664,7 +1664,7 @@ export class RemoteSettings extends RemoteSettingsInterface { async getRecords() { const result = await UniFFIScaffolding.callAsyncWrapper( - 65, // uniffi_remote_settings_fn_method_remotesettings_get_records + 85, // uniffi_remote_settings_fn_method_remotesettings_get_records FfiConverterTypeRemoteSettings.lowerReceiver(this), ) return handleRustResult( @@ -1685,7 +1685,7 @@ export class RemoteSettings extends RemoteSettingsInterface { FfiConverterUInt64.checkType(timestamp); const result = await UniFFIScaffolding.callAsyncWrapper( - 66, // uniffi_remote_settings_fn_method_remotesettings_get_records_since + 86, // uniffi_remote_settings_fn_method_remotesettings_get_records_since FfiConverterTypeRemoteSettings.lowerReceiver(this), FfiConverterUInt64.lower(timestamp), ) @@ -1720,11 +1720,11 @@ export class FfiConverterTypeRemoteSettings extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(11)); + return this.lift(dataStream.readPointer(13)); } static write(dataStream, value) { - dataStream.writePointer(11, this.lower(value)); + dataStream.writePointer(13, this.lower(value)); } static computeSize(value) { @@ -1969,7 +1969,7 @@ export class RemoteSettingsClient extends RemoteSettingsClientInterface { async collectionName() { const result = await UniFFIScaffolding.callAsyncWrapper( - 67, // uniffi_remote_settings_fn_method_remotesettingsclient_collection_name + 87, // uniffi_remote_settings_fn_method_remotesettingsclient_collection_name FfiConverterTypeRemoteSettingsClient.lowerReceiver(this), ) return handleRustResult( @@ -1997,7 +1997,7 @@ export class RemoteSettingsClient extends RemoteSettingsClientInterface { FfiConverterTypeRemoteSettingsRecord.checkType(record); const result = await UniFFIScaffolding.callAsyncWrapper( - 68, // uniffi_remote_settings_fn_method_remotesettingsclient_get_attachment + 88, // uniffi_remote_settings_fn_method_remotesettingsclient_get_attachment FfiConverterTypeRemoteSettingsClient.lowerReceiver(this), FfiConverterTypeRemoteSettingsRecord.lower(record), ) @@ -2033,7 +2033,7 @@ export class RemoteSettingsClient extends RemoteSettingsClientInterface { FfiConverterBoolean.checkType(syncIfEmpty); const result = await UniFFIScaffolding.callAsyncWrapper( - 69, // uniffi_remote_settings_fn_method_remotesettingsclient_get_records + 89, // uniffi_remote_settings_fn_method_remotesettingsclient_get_records FfiConverterTypeRemoteSettingsClient.lowerReceiver(this), FfiConverterBoolean.lower(syncIfEmpty), ) @@ -2057,7 +2057,7 @@ export class RemoteSettingsClient extends RemoteSettingsClientInterface { FfiConverterBoolean.checkType(syncIfEmpty); const result = await UniFFIScaffolding.callAsyncWrapper( - 70, // uniffi_remote_settings_fn_method_remotesettingsclient_get_records_map + 90, // uniffi_remote_settings_fn_method_remotesettingsclient_get_records_map FfiConverterTypeRemoteSettingsClient.lowerReceiver(this), FfiConverterBoolean.lower(syncIfEmpty), ) @@ -2074,7 +2074,7 @@ export class RemoteSettingsClient extends RemoteSettingsClientInterface { async shutdown() { const result = await UniFFIScaffolding.callAsyncWrapper( - 71, // uniffi_remote_settings_fn_method_remotesettingsclient_shutdown + 91, // uniffi_remote_settings_fn_method_remotesettingsclient_shutdown FfiConverterTypeRemoteSettingsClient.lowerReceiver(this), ) return handleRustResult( @@ -2090,7 +2090,7 @@ export class RemoteSettingsClient extends RemoteSettingsClientInterface { async sync() { const result = await UniFFIScaffolding.callAsyncWrapper( - 72, // uniffi_remote_settings_fn_method_remotesettingsclient_sync + 92, // uniffi_remote_settings_fn_method_remotesettingsclient_sync FfiConverterTypeRemoteSettingsClient.lowerReceiver(this), ) return handleRustResult( @@ -2124,11 +2124,11 @@ export class FfiConverterTypeRemoteSettingsClient extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(12)); + return this.lift(dataStream.readPointer(14)); } static write(dataStream, value) { - dataStream.writePointer(12, this.lower(value)); + dataStream.writePointer(14, this.lower(value)); } static computeSize(value) { @@ -2271,7 +2271,7 @@ export class RemoteSettingsService extends RemoteSettingsServiceInterface { FfiConverterString.checkType(storageDir); FfiConverterTypeRemoteSettingsConfig2.checkType(config); const result = UniFFIScaffolding.callSync( - 73, // uniffi_remote_settings_fn_constructor_remotesettingsservice_new + 93, // uniffi_remote_settings_fn_constructor_remotesettingsservice_new FfiConverterString.lower(storageDir), FfiConverterTypeRemoteSettingsConfig2.lower(config), ) @@ -2289,7 +2289,7 @@ export class RemoteSettingsService extends RemoteSettingsServiceInterface { clientUrl() { const result = UniFFIScaffolding.callSync( - 74, // uniffi_remote_settings_fn_method_remotesettingsservice_client_url + 94, // uniffi_remote_settings_fn_method_remotesettingsservice_client_url FfiConverterTypeRemoteSettingsService.lowerReceiver(this), ) return handleRustResult( @@ -2311,7 +2311,7 @@ export class RemoteSettingsService extends RemoteSettingsServiceInterface { FfiConverterString.checkType(collectionName); const result = await UniFFIScaffolding.callAsyncWrapper( - 75, // uniffi_remote_settings_fn_method_remotesettingsservice_make_client + 95, // uniffi_remote_settings_fn_method_remotesettingsservice_make_client FfiConverterTypeRemoteSettingsService.lowerReceiver(this), FfiConverterString.lower(collectionName), ) @@ -2329,7 +2329,7 @@ export class RemoteSettingsService extends RemoteSettingsServiceInterface { async sync() { const result = await UniFFIScaffolding.callAsyncWrapper( - 76, // uniffi_remote_settings_fn_method_remotesettingsservice_sync + 96, // uniffi_remote_settings_fn_method_remotesettingsservice_sync FfiConverterTypeRemoteSettingsService.lowerReceiver(this), ) return handleRustResult( @@ -2354,7 +2354,7 @@ export class RemoteSettingsService extends RemoteSettingsServiceInterface { FfiConverterTypeRemoteSettingsConfig2.checkType(config); const result = UniFFIScaffolding.callSync( - 77, // uniffi_remote_settings_fn_method_remotesettingsservice_update_config + 97, // uniffi_remote_settings_fn_method_remotesettingsservice_update_config FfiConverterTypeRemoteSettingsService.lowerReceiver(this), FfiConverterTypeRemoteSettingsConfig2.lower(config), ) @@ -2389,11 +2389,11 @@ export class FfiConverterTypeRemoteSettingsService extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(13)); + return this.lift(dataStream.readPointer(15)); } static write(dataStream, value) { - dataStream.writePointer(13, this.lower(value)); + dataStream.writePointer(15, this.lower(value)); } static computeSize(value) { diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustSearch.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustSearch.sys.mjs index 2ab692958efa8..ba2b1876e5320 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustSearch.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustSearch.sys.mjs @@ -2782,7 +2782,7 @@ export class SearchEngineSelector extends SearchEngineSelectorInterface { static init() { const result = UniFFIScaffolding.callSync( - 78, // uniffi_search_fn_constructor_searchengineselector_new + 98, // uniffi_search_fn_constructor_searchengineselector_new ) return handleRustResult( result, @@ -2799,7 +2799,7 @@ export class SearchEngineSelector extends SearchEngineSelectorInterface { clearSearchConfig() { const result = UniFFIScaffolding.callSync( - 79, // uniffi_search_fn_method_searchengineselector_clear_search_config + 99, // uniffi_search_fn_method_searchengineselector_clear_search_config FfiConverterTypeSearchEngineSelector.lowerReceiver(this), ) return handleRustResult( @@ -2821,7 +2821,7 @@ export class SearchEngineSelector extends SearchEngineSelectorInterface { FfiConverterTypeSearchUserEnvironment.checkType(userEnvironment); const result = UniFFIScaffolding.callSync( - 80, // uniffi_search_fn_method_searchengineselector_filter_engine_configuration + 100, // uniffi_search_fn_method_searchengineselector_filter_engine_configuration FfiConverterTypeSearchEngineSelector.lowerReceiver(this), FfiConverterTypeSearchUserEnvironment.lower(userEnvironment), ) @@ -2841,7 +2841,7 @@ export class SearchEngineSelector extends SearchEngineSelectorInterface { FfiConverterString.checkType(overrides); const result = UniFFIScaffolding.callSync( - 81, // uniffi_search_fn_method_searchengineselector_set_config_overrides + 101, // uniffi_search_fn_method_searchengineselector_set_config_overrides FfiConverterTypeSearchEngineSelector.lowerReceiver(this), FfiConverterString.lower(overrides), ) @@ -2865,7 +2865,7 @@ export class SearchEngineSelector extends SearchEngineSelectorInterface { FfiConverterString.checkType(configuration); const result = UniFFIScaffolding.callSync( - 82, // uniffi_search_fn_method_searchengineselector_set_search_config + 102, // uniffi_search_fn_method_searchengineselector_set_search_config FfiConverterTypeSearchEngineSelector.lowerReceiver(this), FfiConverterString.lower(configuration), ) @@ -2896,7 +2896,7 @@ export class SearchEngineSelector extends SearchEngineSelectorInterface { FfiConverterTypeRemoteSettingsService.checkType(service); FfiConverterBoolean.checkType(applyEngineOverrides); const result = await UniFFIScaffolding.callAsyncWrapper( - 83, // uniffi_search_fn_method_searchengineselector_use_remote_settings_server + 103, // uniffi_search_fn_method_searchengineselector_use_remote_settings_server FfiConverterTypeSearchEngineSelector.lowerReceiver(this), FfiConverterTypeRemoteSettingsService.lower(service), FfiConverterBoolean.lower(applyEngineOverrides), @@ -2932,11 +2932,11 @@ export class FfiConverterTypeSearchEngineSelector extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(14)); + return this.lift(dataStream.readPointer(16)); } static write(dataStream, value) { - dataStream.writePointer(14, this.lower(value)); + dataStream.writePointer(16, this.lower(value)); } static computeSize(value) { diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustSuggest.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustSuggest.sys.mjs index e9af70cbf7124..b00d3e00b40c6 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustSuggest.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustSuggest.sys.mjs @@ -47,7 +47,7 @@ export function rawSuggestionUrlMatches( FfiConverterString.checkType(rawUrl); FfiConverterString.checkType(cookedUrl); const result = UniFFIScaffolding.callSync( - 84, // uniffi_suggest_fn_func_raw_suggestion_url_matches + 104, // uniffi_suggest_fn_func_raw_suggestion_url_matches FfiConverterString.lower(rawUrl), FfiConverterString.lower(cookedUrl), ) @@ -4255,7 +4255,7 @@ export class SuggestStore extends SuggestStoreInterface { FfiConverterString.checkType(path); FfiConverterTypeRemoteSettingsService.checkType(remoteSettingsService); const result = UniFFIScaffolding.callSync( - 85, // uniffi_suggest_fn_constructor_suggeststore_new + 105, // uniffi_suggest_fn_constructor_suggeststore_new FfiConverterString.lower(path), FfiConverterTypeRemoteSettingsService.lower(remoteSettingsService), ) @@ -4273,7 +4273,7 @@ export class SuggestStore extends SuggestStoreInterface { async anyDismissedSuggestions() { const result = await UniFFIScaffolding.callAsyncWrapper( - 86, // uniffi_suggest_fn_method_suggeststore_any_dismissed_suggestions + 106, // uniffi_suggest_fn_method_suggeststore_any_dismissed_suggestions FfiConverterTypeSuggestStore.lowerReceiver(this), ) return handleRustResult( @@ -4289,7 +4289,7 @@ export class SuggestStore extends SuggestStoreInterface { async clear() { const result = await UniFFIScaffolding.callAsyncWrapper( - 87, // uniffi_suggest_fn_method_suggeststore_clear + 107, // uniffi_suggest_fn_method_suggeststore_clear FfiConverterTypeSuggestStore.lowerReceiver(this), ) return handleRustResult( @@ -4305,7 +4305,7 @@ export class SuggestStore extends SuggestStoreInterface { async clearDismissedSuggestions() { const result = await UniFFIScaffolding.callAsyncWrapper( - 88, // uniffi_suggest_fn_method_suggeststore_clear_dismissed_suggestions + 108, // uniffi_suggest_fn_method_suggeststore_clear_dismissed_suggestions FfiConverterTypeSuggestStore.lowerReceiver(this), ) return handleRustResult( @@ -4330,7 +4330,7 @@ export class SuggestStore extends SuggestStoreInterface { FfiConverterString.checkType(key); const result = await UniFFIScaffolding.callAsyncWrapper( - 89, // uniffi_suggest_fn_method_suggeststore_dismiss_by_key + 109, // uniffi_suggest_fn_method_suggeststore_dismiss_by_key FfiConverterTypeSuggestStore.lowerReceiver(this), FfiConverterString.lower(key), ) @@ -4352,7 +4352,7 @@ export class SuggestStore extends SuggestStoreInterface { FfiConverterTypeSuggestion.checkType(suggestion); const result = await UniFFIScaffolding.callAsyncWrapper( - 90, // uniffi_suggest_fn_method_suggeststore_dismiss_by_suggestion + 110, // uniffi_suggest_fn_method_suggeststore_dismiss_by_suggestion FfiConverterTypeSuggestStore.lowerReceiver(this), FfiConverterTypeSuggestion.lower(suggestion), ) @@ -4377,7 +4377,7 @@ export class SuggestStore extends SuggestStoreInterface { FfiConverterString.checkType(suggestionUrl); const result = await UniFFIScaffolding.callAsyncWrapper( - 91, // uniffi_suggest_fn_method_suggeststore_dismiss_suggestion + 111, // uniffi_suggest_fn_method_suggeststore_dismiss_suggestion FfiConverterTypeSuggestStore.lowerReceiver(this), FfiConverterString.lower(suggestionUrl), ) @@ -4400,7 +4400,7 @@ export class SuggestStore extends SuggestStoreInterface { FfiConverterTypeGeoname.checkType(geoname); const result = await UniFFIScaffolding.callAsyncWrapper( - 92, // uniffi_suggest_fn_method_suggeststore_fetch_geoname_alternates + 112, // uniffi_suggest_fn_method_suggeststore_fetch_geoname_alternates FfiConverterTypeSuggestStore.lowerReceiver(this), FfiConverterTypeGeoname.lower(geoname), ) @@ -4430,7 +4430,7 @@ export class SuggestStore extends SuggestStoreInterface { FfiConverterBoolean.checkType(matchNamePrefix); FfiConverterOptionalSequenceTypeGeoname.checkType(filter); const result = await UniFFIScaffolding.callAsyncWrapper( - 93, // uniffi_suggest_fn_method_suggeststore_fetch_geonames + 113, // uniffi_suggest_fn_method_suggeststore_fetch_geonames FfiConverterTypeSuggestStore.lowerReceiver(this), FfiConverterString.lower(query), FfiConverterBoolean.lower(matchNamePrefix), @@ -4450,7 +4450,7 @@ export class SuggestStore extends SuggestStoreInterface { async fetchGlobalConfig() { const result = await UniFFIScaffolding.callAsyncWrapper( - 94, // uniffi_suggest_fn_method_suggeststore_fetch_global_config + 114, // uniffi_suggest_fn_method_suggeststore_fetch_global_config FfiConverterTypeSuggestStore.lowerReceiver(this), ) return handleRustResult( @@ -4470,7 +4470,7 @@ export class SuggestStore extends SuggestStoreInterface { FfiConverterTypeSuggestionProvider.checkType(provider); const result = await UniFFIScaffolding.callAsyncWrapper( - 95, // uniffi_suggest_fn_method_suggeststore_fetch_provider_config + 115, // uniffi_suggest_fn_method_suggeststore_fetch_provider_config FfiConverterTypeSuggestStore.lowerReceiver(this), FfiConverterTypeSuggestionProvider.lower(provider), ) @@ -4491,7 +4491,7 @@ export class SuggestStore extends SuggestStoreInterface { FfiConverterTypeSuggestIngestionConstraints.checkType(constraints); const result = await UniFFIScaffolding.callAsyncWrapper( - 96, // uniffi_suggest_fn_method_suggeststore_ingest + 116, // uniffi_suggest_fn_method_suggeststore_ingest FfiConverterTypeSuggestStore.lowerReceiver(this), FfiConverterTypeSuggestIngestionConstraints.lower(constraints), ) @@ -4515,7 +4515,7 @@ export class SuggestStore extends SuggestStoreInterface { FfiConverterOptionalTypeInterruptKind.checkType(kind); const result = UniFFIScaffolding.callSync( - 97, // uniffi_suggest_fn_method_suggeststore_interrupt + 117, // uniffi_suggest_fn_method_suggeststore_interrupt FfiConverterTypeSuggestStore.lowerReceiver(this), FfiConverterOptionalTypeInterruptKind.lower(kind), ) @@ -4541,7 +4541,7 @@ export class SuggestStore extends SuggestStoreInterface { FfiConverterString.checkType(key); const result = await UniFFIScaffolding.callAsyncWrapper( - 98, // uniffi_suggest_fn_method_suggeststore_is_dismissed_by_key + 118, // uniffi_suggest_fn_method_suggeststore_is_dismissed_by_key FfiConverterTypeSuggestStore.lowerReceiver(this), FfiConverterString.lower(key), ) @@ -4566,7 +4566,7 @@ export class SuggestStore extends SuggestStoreInterface { FfiConverterTypeSuggestion.checkType(suggestion); const result = await UniFFIScaffolding.callAsyncWrapper( - 99, // uniffi_suggest_fn_method_suggeststore_is_dismissed_by_suggestion + 119, // uniffi_suggest_fn_method_suggeststore_is_dismissed_by_suggestion FfiConverterTypeSuggestStore.lowerReceiver(this), FfiConverterTypeSuggestion.lower(suggestion), ) @@ -4587,7 +4587,7 @@ export class SuggestStore extends SuggestStoreInterface { FfiConverterTypeSuggestionQuery.checkType(query); const result = await UniFFIScaffolding.callAsyncWrapper( - 100, // uniffi_suggest_fn_method_suggeststore_query + 120, // uniffi_suggest_fn_method_suggeststore_query FfiConverterTypeSuggestStore.lowerReceiver(this), FfiConverterTypeSuggestionQuery.lower(query), ) @@ -4608,7 +4608,7 @@ export class SuggestStore extends SuggestStoreInterface { FfiConverterTypeSuggestionQuery.checkType(query); const result = await UniFFIScaffolding.callAsyncWrapper( - 101, // uniffi_suggest_fn_method_suggeststore_query_with_metrics + 121, // uniffi_suggest_fn_method_suggeststore_query_with_metrics FfiConverterTypeSuggestStore.lowerReceiver(this), FfiConverterTypeSuggestionQuery.lower(query), ) @@ -4643,11 +4643,11 @@ export class FfiConverterTypeSuggestStore extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(15)); + return this.lift(dataStream.readPointer(17)); } static write(dataStream, value) { - dataStream.writePointer(15, this.lower(value)); + dataStream.writePointer(17, this.lower(value)); } static computeSize(value) { @@ -4772,7 +4772,7 @@ export class SuggestStoreBuilder extends SuggestStoreBuilderInterface { static init() { const result = UniFFIScaffolding.callSync( - 102, // uniffi_suggest_fn_constructor_suggeststorebuilder_new + 122, // uniffi_suggest_fn_constructor_suggeststorebuilder_new ) return handleRustResult( result, @@ -4788,7 +4788,7 @@ export class SuggestStoreBuilder extends SuggestStoreBuilderInterface { build() { const result = UniFFIScaffolding.callSync( - 103, // uniffi_suggest_fn_method_suggeststorebuilder_build + 123, // uniffi_suggest_fn_method_suggeststorebuilder_build FfiConverterTypeSuggestStoreBuilder.lowerReceiver(this), ) return handleRustResult( @@ -4808,7 +4808,7 @@ export class SuggestStoreBuilder extends SuggestStoreBuilderInterface { FfiConverterString.checkType(path); const result = await UniFFIScaffolding.callAsyncWrapper( - 104, // uniffi_suggest_fn_method_suggeststorebuilder_cache_path + 124, // uniffi_suggest_fn_method_suggeststorebuilder_cache_path FfiConverterTypeSuggestStoreBuilder.lowerReceiver(this), FfiConverterString.lower(path), ) @@ -4829,7 +4829,7 @@ export class SuggestStoreBuilder extends SuggestStoreBuilderInterface { FfiConverterString.checkType(path); const result = UniFFIScaffolding.callSync( - 105, // uniffi_suggest_fn_method_suggeststorebuilder_data_path + 125, // uniffi_suggest_fn_method_suggeststorebuilder_data_path FfiConverterTypeSuggestStoreBuilder.lowerReceiver(this), FfiConverterString.lower(path), ) @@ -4857,7 +4857,7 @@ export class SuggestStoreBuilder extends SuggestStoreBuilderInterface { FfiConverterString.checkType(library); FfiConverterOptionalString.checkType(entryPoint); const result = UniFFIScaffolding.callSync( - 106, // uniffi_suggest_fn_method_suggeststorebuilder_load_extension + 126, // uniffi_suggest_fn_method_suggeststorebuilder_load_extension FfiConverterTypeSuggestStoreBuilder.lowerReceiver(this), FfiConverterString.lower(library), FfiConverterOptionalString.lower(entryPoint), @@ -4879,7 +4879,7 @@ export class SuggestStoreBuilder extends SuggestStoreBuilderInterface { FfiConverterString.checkType(bucketName); const result = UniFFIScaffolding.callSync( - 107, // uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_bucket_name + 127, // uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_bucket_name FfiConverterTypeSuggestStoreBuilder.lowerReceiver(this), FfiConverterString.lower(bucketName), ) @@ -4900,7 +4900,7 @@ export class SuggestStoreBuilder extends SuggestStoreBuilderInterface { FfiConverterTypeRemoteSettingsServer.checkType(server); const result = UniFFIScaffolding.callSync( - 108, // uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_server + 128, // uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_server FfiConverterTypeSuggestStoreBuilder.lowerReceiver(this), FfiConverterTypeRemoteSettingsServer.lower(server), ) @@ -4921,7 +4921,7 @@ export class SuggestStoreBuilder extends SuggestStoreBuilderInterface { FfiConverterTypeRemoteSettingsService.checkType(rsService); const result = UniFFIScaffolding.callSync( - 109, // uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_service + 129, // uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_service FfiConverterTypeSuggestStoreBuilder.lowerReceiver(this), FfiConverterTypeRemoteSettingsService.lower(rsService), ) @@ -4956,11 +4956,11 @@ export class FfiConverterTypeSuggestStoreBuilder extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(16)); + return this.lift(dataStream.readPointer(18)); } static write(dataStream, value) { - dataStream.writePointer(16, this.lower(value)); + dataStream.writePointer(18, this.lower(value)); } static computeSize(value) { diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustTabs.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustTabs.sys.mjs index 2b64be9b532b3..c9195d9088918 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustTabs.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustTabs.sys.mjs @@ -1765,7 +1765,7 @@ export class RemoteCommandStore extends RemoteCommandStoreInterface { FfiConverterString.checkType(deviceId); FfiConverterTypeRemoteCommand.checkType(command); const result = await UniFFIScaffolding.callAsyncWrapper( - 110, // uniffi_tabs_fn_method_remotecommandstore_add_remote_command + 130, // uniffi_tabs_fn_method_remotecommandstore_add_remote_command FfiConverterTypeRemoteCommandStore.lowerReceiver(this), FfiConverterString.lower(deviceId), FfiConverterTypeRemoteCommand.lower(command), @@ -1793,7 +1793,7 @@ export class RemoteCommandStore extends RemoteCommandStoreInterface { FfiConverterTypeRemoteCommand.checkType(command); FfiConverterTypeTimestamp.checkType(when); const result = await UniFFIScaffolding.callAsyncWrapper( - 111, // uniffi_tabs_fn_method_remotecommandstore_add_remote_command_at + 131, // uniffi_tabs_fn_method_remotecommandstore_add_remote_command_at FfiConverterTypeRemoteCommandStore.lowerReceiver(this), FfiConverterString.lower(deviceId), FfiConverterTypeRemoteCommand.lower(command), @@ -1813,7 +1813,7 @@ export class RemoteCommandStore extends RemoteCommandStoreInterface { async getUnsentCommands() { const result = await UniFFIScaffolding.callAsyncWrapper( - 112, // uniffi_tabs_fn_method_remotecommandstore_get_unsent_commands + 132, // uniffi_tabs_fn_method_remotecommandstore_get_unsent_commands FfiConverterTypeRemoteCommandStore.lowerReceiver(this), ) return handleRustResult( @@ -1837,7 +1837,7 @@ export class RemoteCommandStore extends RemoteCommandStoreInterface { FfiConverterString.checkType(deviceId); FfiConverterTypeRemoteCommand.checkType(command); const result = await UniFFIScaffolding.callAsyncWrapper( - 113, // uniffi_tabs_fn_method_remotecommandstore_remove_remote_command + 133, // uniffi_tabs_fn_method_remotecommandstore_remove_remote_command FfiConverterTypeRemoteCommandStore.lowerReceiver(this), FfiConverterString.lower(deviceId), FfiConverterTypeRemoteCommand.lower(command), @@ -1859,7 +1859,7 @@ export class RemoteCommandStore extends RemoteCommandStoreInterface { FfiConverterTypePendingCommand.checkType(command); const result = await UniFFIScaffolding.callAsyncWrapper( - 114, // uniffi_tabs_fn_method_remotecommandstore_set_pending_command_sent + 134, // uniffi_tabs_fn_method_remotecommandstore_set_pending_command_sent FfiConverterTypeRemoteCommandStore.lowerReceiver(this), FfiConverterTypePendingCommand.lower(command), ) @@ -1894,11 +1894,11 @@ export class FfiConverterTypeRemoteCommandStore extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(17)); + return this.lift(dataStream.readPointer(19)); } static write(dataStream, value) { - dataStream.writePointer(17, this.lower(value)); + dataStream.writePointer(19, this.lower(value)); } static computeSize(value) { @@ -2081,7 +2081,7 @@ export class TabsBridgedEngine extends TabsBridgedEngineInterface { async apply() { const result = await UniFFIScaffolding.callAsyncWrapper( - 115, // uniffi_tabs_fn_method_tabsbridgedengine_apply + 135, // uniffi_tabs_fn_method_tabsbridgedengine_apply FfiConverterTypeTabsBridgedEngine.lowerReceiver(this), ) return handleRustResult( @@ -2101,7 +2101,7 @@ export class TabsBridgedEngine extends TabsBridgedEngineInterface { FfiConverterString.checkType(newSyncId); const result = await UniFFIScaffolding.callAsyncWrapper( - 116, // uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id + 136, // uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id FfiConverterTypeTabsBridgedEngine.lowerReceiver(this), FfiConverterString.lower(newSyncId), ) @@ -2119,7 +2119,7 @@ export class TabsBridgedEngine extends TabsBridgedEngineInterface { async lastSync() { const result = await UniFFIScaffolding.callAsyncWrapper( - 117, // uniffi_tabs_fn_method_tabsbridgedengine_last_sync + 137, // uniffi_tabs_fn_method_tabsbridgedengine_last_sync FfiConverterTypeTabsBridgedEngine.lowerReceiver(this), ) return handleRustResult( @@ -2138,7 +2138,7 @@ export class TabsBridgedEngine extends TabsBridgedEngineInterface { FfiConverterString.checkType(clientData); const result = await UniFFIScaffolding.callAsyncWrapper( - 118, // uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync + 138, // uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync FfiConverterTypeTabsBridgedEngine.lowerReceiver(this), FfiConverterString.lower(clientData), ) @@ -2155,7 +2155,7 @@ export class TabsBridgedEngine extends TabsBridgedEngineInterface { async reset() { const result = await UniFFIScaffolding.callAsyncWrapper( - 119, // uniffi_tabs_fn_method_tabsbridgedengine_reset + 139, // uniffi_tabs_fn_method_tabsbridgedengine_reset FfiConverterTypeTabsBridgedEngine.lowerReceiver(this), ) return handleRustResult( @@ -2172,7 +2172,7 @@ export class TabsBridgedEngine extends TabsBridgedEngineInterface { async resetSyncId() { const result = await UniFFIScaffolding.callAsyncWrapper( - 120, // uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id + 140, // uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id FfiConverterTypeTabsBridgedEngine.lowerReceiver(this), ) return handleRustResult( @@ -2191,7 +2191,7 @@ export class TabsBridgedEngine extends TabsBridgedEngineInterface { FfiConverterInt64.checkType(lastSync); const result = await UniFFIScaffolding.callAsyncWrapper( - 121, // uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync + 141, // uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync FfiConverterTypeTabsBridgedEngine.lowerReceiver(this), FfiConverterInt64.lower(lastSync), ) @@ -2214,7 +2214,7 @@ export class TabsBridgedEngine extends TabsBridgedEngineInterface { FfiConverterInt64.checkType(newTimestamp); FfiConverterSequenceTypeTabsGuid.checkType(uploadedIds); const result = await UniFFIScaffolding.callAsyncWrapper( - 122, // uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded + 142, // uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded FfiConverterTypeTabsBridgedEngine.lowerReceiver(this), FfiConverterInt64.lower(newTimestamp), FfiConverterSequenceTypeTabsGuid.lower(uploadedIds), @@ -2235,7 +2235,7 @@ export class TabsBridgedEngine extends TabsBridgedEngineInterface { FfiConverterSequenceString.checkType(incomingEnvelopesAsJson); const result = await UniFFIScaffolding.callAsyncWrapper( - 123, // uniffi_tabs_fn_method_tabsbridgedengine_store_incoming + 143, // uniffi_tabs_fn_method_tabsbridgedengine_store_incoming FfiConverterTypeTabsBridgedEngine.lowerReceiver(this), FfiConverterSequenceString.lower(incomingEnvelopesAsJson), ) @@ -2252,7 +2252,7 @@ export class TabsBridgedEngine extends TabsBridgedEngineInterface { async syncFinished() { const result = await UniFFIScaffolding.callAsyncWrapper( - 124, // uniffi_tabs_fn_method_tabsbridgedengine_sync_finished + 144, // uniffi_tabs_fn_method_tabsbridgedengine_sync_finished FfiConverterTypeTabsBridgedEngine.lowerReceiver(this), ) return handleRustResult( @@ -2269,7 +2269,7 @@ export class TabsBridgedEngine extends TabsBridgedEngineInterface { async syncId() { const result = await UniFFIScaffolding.callAsyncWrapper( - 125, // uniffi_tabs_fn_method_tabsbridgedengine_sync_id + 145, // uniffi_tabs_fn_method_tabsbridgedengine_sync_id FfiConverterTypeTabsBridgedEngine.lowerReceiver(this), ) return handleRustResult( @@ -2285,7 +2285,7 @@ export class TabsBridgedEngine extends TabsBridgedEngineInterface { async syncStarted() { const result = await UniFFIScaffolding.callAsyncWrapper( - 126, // uniffi_tabs_fn_method_tabsbridgedengine_sync_started + 146, // uniffi_tabs_fn_method_tabsbridgedengine_sync_started FfiConverterTypeTabsBridgedEngine.lowerReceiver(this), ) return handleRustResult( @@ -2301,7 +2301,7 @@ export class TabsBridgedEngine extends TabsBridgedEngineInterface { async wipe() { const result = await UniFFIScaffolding.callAsyncWrapper( - 127, // uniffi_tabs_fn_method_tabsbridgedengine_wipe + 147, // uniffi_tabs_fn_method_tabsbridgedengine_wipe FfiConverterTypeTabsBridgedEngine.lowerReceiver(this), ) return handleRustResult( @@ -2335,11 +2335,11 @@ export class FfiConverterTypeTabsBridgedEngine extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(18)); + return this.lift(dataStream.readPointer(20)); } static write(dataStream, value) { - dataStream.writePointer(18, this.lower(value)); + dataStream.writePointer(20, this.lower(value)); } static computeSize(value) { @@ -2474,7 +2474,7 @@ export class TabsStore extends TabsStoreInterface { FfiConverterString.checkType(path); const result = await UniFFIScaffolding.callAsyncWrapper( - 128, // uniffi_tabs_fn_constructor_tabsstore_new + 148, // uniffi_tabs_fn_constructor_tabsstore_new FfiConverterString.lower(path), ) return handleRustResult( @@ -2491,7 +2491,7 @@ export class TabsStore extends TabsStoreInterface { async bridgedEngine() { const result = await UniFFIScaffolding.callAsyncWrapper( - 129, // uniffi_tabs_fn_method_tabsstore_bridged_engine + 149, // uniffi_tabs_fn_method_tabsstore_bridged_engine FfiConverterTypeTabsStore.lowerReceiver(this), ) return handleRustResult( @@ -2507,7 +2507,7 @@ export class TabsStore extends TabsStoreInterface { async closeConnection() { const result = await UniFFIScaffolding.callAsyncWrapper( - 130, // uniffi_tabs_fn_method_tabsstore_close_connection + 150, // uniffi_tabs_fn_method_tabsstore_close_connection FfiConverterTypeTabsStore.lowerReceiver(this), ) return handleRustResult( @@ -2524,7 +2524,7 @@ export class TabsStore extends TabsStoreInterface { async getAll() { const result = await UniFFIScaffolding.callAsyncWrapper( - 131, // uniffi_tabs_fn_method_tabsstore_get_all + 151, // uniffi_tabs_fn_method_tabsstore_get_all FfiConverterTypeTabsStore.lowerReceiver(this), ) return handleRustResult( @@ -2541,7 +2541,7 @@ export class TabsStore extends TabsStoreInterface { async newRemoteCommandStore() { const result = await UniFFIScaffolding.callAsyncWrapper( - 132, // uniffi_tabs_fn_method_tabsstore_new_remote_command_store + 152, // uniffi_tabs_fn_method_tabsstore_new_remote_command_store FfiConverterTypeTabsStore.lowerReceiver(this), ) return handleRustResult( @@ -2557,7 +2557,7 @@ export class TabsStore extends TabsStoreInterface { async registerWithSyncManager() { const result = await UniFFIScaffolding.callAsyncWrapper( - 133, // uniffi_tabs_fn_method_tabsstore_register_with_sync_manager + 153, // uniffi_tabs_fn_method_tabsstore_register_with_sync_manager FfiConverterTypeTabsStore.lowerReceiver(this), ) return handleRustResult( @@ -2576,7 +2576,7 @@ export class TabsStore extends TabsStoreInterface { FfiConverterSequenceTypeRemoteTabRecord.checkType(remoteTabs); const result = await UniFFIScaffolding.callAsyncWrapper( - 134, // uniffi_tabs_fn_method_tabsstore_set_local_tabs + 154, // uniffi_tabs_fn_method_tabsstore_set_local_tabs FfiConverterTypeTabsStore.lowerReceiver(this), FfiConverterSequenceTypeRemoteTabRecord.lower(remoteTabs), ) @@ -2596,7 +2596,7 @@ export class TabsStore extends TabsStoreInterface { FfiConverterTypeLocalTabsInfo.checkType(info); const result = await UniFFIScaffolding.callAsyncWrapper( - 135, // uniffi_tabs_fn_method_tabsstore_set_local_tabs_info + 155, // uniffi_tabs_fn_method_tabsstore_set_local_tabs_info FfiConverterTypeTabsStore.lowerReceiver(this), FfiConverterTypeLocalTabsInfo.lower(info), ) @@ -2631,11 +2631,11 @@ export class FfiConverterTypeTabsStore extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(19)); + return this.lift(dataStream.readPointer(21)); } static write(dataStream, value) { - dataStream.writePointer(19, this.lower(value)); + dataStream.writePointer(21, this.lower(value)); } static computeSize(value) { diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustTracing.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustTracing.sys.mjs index 52c46eeaa22bd..6b7a43432f897 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustTracing.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustTracing.sys.mjs @@ -47,7 +47,7 @@ FfiConverterString.checkType(target); FfiConverterTypeTracingLevel.checkType(level); FfiConverterTypeEventSink.checkType(sink); const result = UniFFIScaffolding.callSync( - 136, // uniffi_tracing_support_fn_func_register_event_sink + 156, // uniffi_tracing_support_fn_func_register_event_sink FfiConverterString.lower(target), FfiConverterTypeTracingLevel.lower(level), FfiConverterTypeEventSink.lower(sink), @@ -71,7 +71,7 @@ export function registerMinLevelEventSink( FfiConverterTypeTracingLevel.checkType(level); FfiConverterTypeEventSink.checkType(sink); const result = UniFFIScaffolding.callSync( - 137, // uniffi_tracing_support_fn_func_register_min_level_event_sink + 157, // uniffi_tracing_support_fn_func_register_min_level_event_sink FfiConverterTypeTracingLevel.lower(level), FfiConverterTypeEventSink.lower(sink), ) @@ -91,7 +91,7 @@ export function unregisterEventSink( FfiConverterString.checkType(target); const result = UniFFIScaffolding.callSync( - 138, // uniffi_tracing_support_fn_func_unregister_event_sink + 158, // uniffi_tracing_support_fn_func_unregister_event_sink FfiConverterString.lower(target), ) return handleRustResult( @@ -107,7 +107,7 @@ return handleRustResult( export function unregisterMinLevelEventSink() { const result = UniFFIScaffolding.callSync( - 139, // uniffi_tracing_support_fn_func_unregister_min_level_event_sink + 159, // uniffi_tracing_support_fn_func_unregister_min_level_event_sink ) return handleRustResult( result, @@ -444,7 +444,7 @@ export class FfiConverterTypeEventSink extends FfiConverter { } const uniffiCallbackHandlerTracingEventSink = new UniFFICallbackHandler( "EventSink", - 5, + 6, [ new UniFFICallbackMethodHandler( "onEvent", diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustViaduct.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustViaduct.sys.mjs index c96a40ff7c578..112073c62ec71 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustViaduct.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustViaduct.sys.mjs @@ -38,7 +38,7 @@ export var UnitTestObjs = { export function allowAndroidEmulatorLoopback() { const result = UniFFIScaffolding.callSync( - 140, // uniffi_viaduct_fn_func_allow_android_emulator_loopback + 160, // uniffi_viaduct_fn_func_allow_android_emulator_loopback ) return handleRustResult( result, @@ -56,7 +56,7 @@ export function initBackend( FfiConverterTypeBackend.checkType(backend); const result = UniFFIScaffolding.callSync( - 141, // uniffi_viaduct_fn_func_init_backend + 161, // uniffi_viaduct_fn_func_init_backend FfiConverterTypeBackend.lower(backend), ) return handleRustResult( @@ -1199,7 +1199,7 @@ export class BackendImpl extends Backend { FfiConverterTypeRequest.checkType(request); FfiConverterTypeClientSettings.checkType(settings); const result = await UniFFIScaffolding.callAsync( - 142, // uniffi_viaduct_fn_method_backend_send_request + 162, // uniffi_viaduct_fn_method_backend_send_request FfiConverterTypeBackend.lowerReceiver(this), FfiConverterTypeRequest.lower(request), FfiConverterTypeClientSettings.lower(settings), @@ -1244,11 +1244,11 @@ export class FfiConverterTypeBackend extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(20)); + return this.lift(dataStream.readPointer(22)); } static write(dataStream, value) { - dataStream.writePointer(20, this.lower(value)); + dataStream.writePointer(22, this.lower(value)); } static computeSize(value) { @@ -1258,7 +1258,7 @@ export class FfiConverterTypeBackend extends FfiConverter { const uniffiCallbackHandlerViaductBackend = new UniFFICallbackHandler( "Backend", - 6, + 7, [ new UniFFICallbackMethodHandler( "sendRequest", 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 index 9bc2cebb35ac3..0295bd0107b90 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustWebextstorage.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustWebextstorage.sys.mjs @@ -877,7 +877,7 @@ export class WebExtStorageBridgedEngine extends WebExtStorageBridgedEngineInterf async apply() { const result = await UniFFIScaffolding.callAsyncWrapper( - 143, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_apply + 163, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_apply FfiConverterTypeWebExtStorageBridgedEngine.lowerReceiver(this), ) return handleRustResult( @@ -897,7 +897,7 @@ export class WebExtStorageBridgedEngine extends WebExtStorageBridgedEngineInterf FfiConverterString.checkType(newSyncId); const result = await UniFFIScaffolding.callAsyncWrapper( - 144, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_ensure_current_sync_id + 164, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_ensure_current_sync_id FfiConverterTypeWebExtStorageBridgedEngine.lowerReceiver(this), FfiConverterString.lower(newSyncId), ) @@ -915,7 +915,7 @@ export class WebExtStorageBridgedEngine extends WebExtStorageBridgedEngineInterf async lastSync() { const result = await UniFFIScaffolding.callAsyncWrapper( - 145, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_last_sync + 165, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_last_sync FfiConverterTypeWebExtStorageBridgedEngine.lowerReceiver(this), ) return handleRustResult( @@ -934,7 +934,7 @@ export class WebExtStorageBridgedEngine extends WebExtStorageBridgedEngineInterf FfiConverterString.checkType(clientData); const result = await UniFFIScaffolding.callAsyncWrapper( - 146, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_prepare_for_sync + 166, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_prepare_for_sync FfiConverterTypeWebExtStorageBridgedEngine.lowerReceiver(this), FfiConverterString.lower(clientData), ) @@ -951,7 +951,7 @@ export class WebExtStorageBridgedEngine extends WebExtStorageBridgedEngineInterf async reset() { const result = await UniFFIScaffolding.callAsyncWrapper( - 147, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_reset + 167, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_reset FfiConverterTypeWebExtStorageBridgedEngine.lowerReceiver(this), ) return handleRustResult( @@ -968,7 +968,7 @@ export class WebExtStorageBridgedEngine extends WebExtStorageBridgedEngineInterf async resetSyncId() { const result = await UniFFIScaffolding.callAsyncWrapper( - 148, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_reset_sync_id + 168, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_reset_sync_id FfiConverterTypeWebExtStorageBridgedEngine.lowerReceiver(this), ) return handleRustResult( @@ -987,7 +987,7 @@ export class WebExtStorageBridgedEngine extends WebExtStorageBridgedEngineInterf FfiConverterInt64.checkType(lastSync); const result = await UniFFIScaffolding.callAsyncWrapper( - 149, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_set_last_sync + 169, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_set_last_sync FfiConverterTypeWebExtStorageBridgedEngine.lowerReceiver(this), FfiConverterInt64.lower(lastSync), ) @@ -1010,7 +1010,7 @@ export class WebExtStorageBridgedEngine extends WebExtStorageBridgedEngineInterf FfiConverterInt64.checkType(serverModifiedMillis); FfiConverterSequenceTypeGuid.checkType(guids); const result = await UniFFIScaffolding.callAsyncWrapper( - 150, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_set_uploaded + 170, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_set_uploaded FfiConverterTypeWebExtStorageBridgedEngine.lowerReceiver(this), FfiConverterInt64.lower(serverModifiedMillis), FfiConverterSequenceTypeGuid.lower(guids), @@ -1031,7 +1031,7 @@ export class WebExtStorageBridgedEngine extends WebExtStorageBridgedEngineInterf FfiConverterSequenceString.checkType(incoming); const result = await UniFFIScaffolding.callAsyncWrapper( - 151, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_store_incoming + 171, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_store_incoming FfiConverterTypeWebExtStorageBridgedEngine.lowerReceiver(this), FfiConverterSequenceString.lower(incoming), ) @@ -1048,7 +1048,7 @@ export class WebExtStorageBridgedEngine extends WebExtStorageBridgedEngineInterf async syncFinished() { const result = await UniFFIScaffolding.callAsyncWrapper( - 152, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_finished + 172, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_finished FfiConverterTypeWebExtStorageBridgedEngine.lowerReceiver(this), ) return handleRustResult( @@ -1065,7 +1065,7 @@ export class WebExtStorageBridgedEngine extends WebExtStorageBridgedEngineInterf async syncId() { const result = await UniFFIScaffolding.callAsyncWrapper( - 153, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_id + 173, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_id FfiConverterTypeWebExtStorageBridgedEngine.lowerReceiver(this), ) return handleRustResult( @@ -1081,7 +1081,7 @@ export class WebExtStorageBridgedEngine extends WebExtStorageBridgedEngineInterf async syncStarted() { const result = await UniFFIScaffolding.callAsyncWrapper( - 154, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_started + 174, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_started FfiConverterTypeWebExtStorageBridgedEngine.lowerReceiver(this), ) return handleRustResult( @@ -1097,7 +1097,7 @@ export class WebExtStorageBridgedEngine extends WebExtStorageBridgedEngineInterf async wipe() { const result = await UniFFIScaffolding.callAsyncWrapper( - 155, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_wipe + 175, // uniffi_webext_storage_fn_method_webextstoragebridgedengine_wipe FfiConverterTypeWebExtStorageBridgedEngine.lowerReceiver(this), ) return handleRustResult( @@ -1131,11 +1131,11 @@ export class FfiConverterTypeWebExtStorageBridgedEngine extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(21)); + return this.lift(dataStream.readPointer(23)); } static write(dataStream, value) { - dataStream.writePointer(21, this.lower(value)); + dataStream.writePointer(23, this.lower(value)); } static computeSize(value) { @@ -1305,7 +1305,7 @@ export class WebExtStorageStore extends WebExtStorageStoreInterface { FfiConverterString.checkType(path); const result = await UniFFIScaffolding.callAsyncWrapper( - 156, // uniffi_webext_storage_fn_constructor_webextstoragestore_new + 176, // uniffi_webext_storage_fn_constructor_webextstoragestore_new FfiConverterString.lower(path), ) return handleRustResult( @@ -1322,7 +1322,7 @@ export class WebExtStorageStore extends WebExtStorageStoreInterface { async bridgedEngine() { const result = await UniFFIScaffolding.callAsyncWrapper( - 157, // uniffi_webext_storage_fn_method_webextstoragestore_bridged_engine + 177, // uniffi_webext_storage_fn_method_webextstoragestore_bridged_engine FfiConverterTypeWebExtStorageStore.lowerReceiver(this), ) return handleRustResult( @@ -1342,7 +1342,7 @@ export class WebExtStorageStore extends WebExtStorageStoreInterface { FfiConverterString.checkType(extId); const result = await UniFFIScaffolding.callAsyncWrapper( - 158, // uniffi_webext_storage_fn_method_webextstoragestore_clear + 178, // uniffi_webext_storage_fn_method_webextstoragestore_clear FfiConverterTypeWebExtStorageStore.lowerReceiver(this), FfiConverterString.lower(extId), ) @@ -1359,7 +1359,7 @@ export class WebExtStorageStore extends WebExtStorageStoreInterface { async close() { const result = await UniFFIScaffolding.callAsyncWrapper( - 159, // uniffi_webext_storage_fn_method_webextstoragestore_close + 179, // uniffi_webext_storage_fn_method_webextstoragestore_close FfiConverterTypeWebExtStorageStore.lowerReceiver(this), ) return handleRustResult( @@ -1382,7 +1382,7 @@ export class WebExtStorageStore extends WebExtStorageStoreInterface { FfiConverterString.checkType(extId); FfiConverterTypeJsonValue.checkType(keys); const result = await UniFFIScaffolding.callAsyncWrapper( - 160, // uniffi_webext_storage_fn_method_webextstoragestore_get + 180, // uniffi_webext_storage_fn_method_webextstoragestore_get FfiConverterTypeWebExtStorageStore.lowerReceiver(this), FfiConverterString.lower(extId), FfiConverterTypeJsonValue.lower(keys), @@ -1407,7 +1407,7 @@ export class WebExtStorageStore extends WebExtStorageStoreInterface { FfiConverterString.checkType(extId); FfiConverterTypeJsonValue.checkType(keys); const result = await UniFFIScaffolding.callAsyncWrapper( - 161, // uniffi_webext_storage_fn_method_webextstoragestore_get_bytes_in_use + 181, // uniffi_webext_storage_fn_method_webextstoragestore_get_bytes_in_use FfiConverterTypeWebExtStorageStore.lowerReceiver(this), FfiConverterString.lower(extId), FfiConverterTypeJsonValue.lower(keys), @@ -1429,7 +1429,7 @@ export class WebExtStorageStore extends WebExtStorageStoreInterface { FfiConverterString.checkType(extId); const result = await UniFFIScaffolding.callAsyncWrapper( - 162, // uniffi_webext_storage_fn_method_webextstoragestore_get_keys + 182, // uniffi_webext_storage_fn_method_webextstoragestore_get_keys FfiConverterTypeWebExtStorageStore.lowerReceiver(this), FfiConverterString.lower(extId), ) @@ -1447,7 +1447,7 @@ export class WebExtStorageStore extends WebExtStorageStoreInterface { async getSyncedChanges() { const result = await UniFFIScaffolding.callAsyncWrapper( - 163, // uniffi_webext_storage_fn_method_webextstoragestore_get_synced_changes + 183, // uniffi_webext_storage_fn_method_webextstoragestore_get_synced_changes FfiConverterTypeWebExtStorageStore.lowerReceiver(this), ) return handleRustResult( @@ -1470,7 +1470,7 @@ export class WebExtStorageStore extends WebExtStorageStoreInterface { FfiConverterString.checkType(extId); FfiConverterTypeJsonValue.checkType(keys); const result = await UniFFIScaffolding.callAsyncWrapper( - 164, // uniffi_webext_storage_fn_method_webextstoragestore_remove + 184, // uniffi_webext_storage_fn_method_webextstoragestore_remove FfiConverterTypeWebExtStorageStore.lowerReceiver(this), FfiConverterString.lower(extId), FfiConverterTypeJsonValue.lower(keys), @@ -1495,7 +1495,7 @@ export class WebExtStorageStore extends WebExtStorageStoreInterface { FfiConverterString.checkType(extId); FfiConverterTypeJsonValue.checkType(val); const result = await UniFFIScaffolding.callAsyncWrapper( - 165, // uniffi_webext_storage_fn_method_webextstoragestore_set + 185, // uniffi_webext_storage_fn_method_webextstoragestore_set FfiConverterTypeWebExtStorageStore.lowerReceiver(this), FfiConverterString.lower(extId), FfiConverterTypeJsonValue.lower(val), @@ -1531,11 +1531,11 @@ export class FfiConverterTypeWebExtStorageStore extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(22)); + return this.lift(dataStream.readPointer(24)); } static write(dataStream, value) { - dataStream.writePointer(22, this.lower(value)); + dataStream.writePointer(24, this.lower(value)); } static computeSize(value) { diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/lib.rs b/toolkit/components/uniffi-bindgen-gecko-js/components/lib.rs index 93fe80dac51f2..b566421be06e0 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/lib.rs +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/lib.rs @@ -3,6 +3,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. mod reexport_appservices_uniffi_scaffolding { + ads_client::uniffi_reexport_scaffolding!(); tabs::uniffi_reexport_scaffolding!(); relevancy::uniffi_reexport_scaffolding!(); suggest::uniffi_reexport_scaffolding!(); diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build b/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build index 71a84acb54dc2..9e406454d6894 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build @@ -5,6 +5,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. MOZ_SRC_FILES += [ + "generated/RustAdsClient.sys.mjs", "generated/RustContextId.sys.mjs", "generated/RustFilterAdult.sys.mjs", "generated/RustInitRustComponents.sys.mjs", diff --git a/toolkit/components/uniffi-bindgen-gecko-js/config.toml b/toolkit/components/uniffi-bindgen-gecko-js/config.toml index 5032511b93ee1..4e4282dd7a30e 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/config.toml +++ b/toolkit/components/uniffi-bindgen-gecko-js/config.toml @@ -9,6 +9,23 @@ # TODO: Upgrade the TOML crate and switch to array of tables syntax. +[ads_client.async_wrappers] +MozAdsClient = "AsyncWrapped" +"MozAdsClient.new" = "Sync" +"MozAdsClient.clear_cache" = "Sync" +"MozAdsClient.cycle_context_id" = "Sync" +"MozAdsClient.record_click" = "AsyncWrapped" +"MozAdsClient.record_impression" = "AsyncWrapped" +"MozAdsClient.report_ad" = "AsyncWrapped" +"MozAdsClient.request_image_ads" = "AsyncWrapped" +"MozAdsClient.request_spoc_ads" = "AsyncWrapped" +"MozAdsClient.request_tile_ads" = "AsyncWrapped" +"MozAdsTelemetry.record_build_cache_error" = "Sync" +"MozAdsTelemetry.record_client_error" = "Sync" +"MozAdsTelemetry.record_client_operation_total" = "Sync" +"MozAdsTelemetry.record_deserialization_error" = "Sync" +"MozAdsTelemetry.record_http_cache_outcome" = "Sync" + [context_id.async_wrappers] ContextIDComponent = "AsyncWrapped" "ContextIDComponent.new" = "Sync" @@ -201,6 +218,12 @@ lower = "{}.getTime() / 1000" "LoginStore.touch" = "Sync" "LoginStore.update" = "Sync" "LoginStore.wipe_local" = "Sync" +"LoginStore.is_breach_alert_dismissed" = "Sync" +"LoginStore.is_potentially_breached" = "Sync" +"LoginStore.record_breach" = "Sync" +"LoginStore.record_breach_alert_dismissal" = "Sync" +"LoginStore.record_breach_alert_dismissal_time" = "Sync" +"LoginStore.reset_all_breaches" = "Sync" "ManagedEncryptorDecryptor.new" = "Sync" "NSSKeyManager.into_dyn_key_manager" = "Sync" "NSSKeyManager.new" = "Sync" diff --git a/toolkit/components/uniffi-bindgen-gecko-js/tests/generated/RustUniffiBindingsTests.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/tests/generated/RustUniffiBindingsTests.sys.mjs index a3678558b3227..c55abd2a3c8d2 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/tests/generated/RustUniffiBindingsTests.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/tests/generated/RustUniffiBindingsTests.sys.mjs @@ -46,7 +46,7 @@ if (v instanceof UniffiSkipJsTypeCheck) { FfiConverterFloat32.checkType(v); } const result = await UniFFIScaffolding.callAsync( - 166, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_f32 + 186, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_f32 FfiConverterFloat32.lower(v), ) return handleRustResult( @@ -70,7 +70,7 @@ if (v instanceof UniffiSkipJsTypeCheck) { FfiConverterFloat64.checkType(v); } const result = await UniFFIScaffolding.callAsync( - 167, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_f64 + 187, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_f64 FfiConverterFloat64.lower(v), ) return handleRustResult( @@ -94,7 +94,7 @@ if (v instanceof UniffiSkipJsTypeCheck) { FfiConverterInt16.checkType(v); } const result = await UniFFIScaffolding.callAsync( - 168, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_i16 + 188, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_i16 FfiConverterInt16.lower(v), ) return handleRustResult( @@ -118,7 +118,7 @@ if (v instanceof UniffiSkipJsTypeCheck) { FfiConverterInt32.checkType(v); } const result = await UniFFIScaffolding.callAsync( - 169, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_i32 + 189, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_i32 FfiConverterInt32.lower(v), ) return handleRustResult( @@ -142,7 +142,7 @@ if (v instanceof UniffiSkipJsTypeCheck) { FfiConverterInt64.checkType(v); } const result = await UniFFIScaffolding.callAsync( - 170, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_i64 + 190, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_i64 FfiConverterInt64.lower(v), ) return handleRustResult( @@ -166,7 +166,7 @@ if (v instanceof UniffiSkipJsTypeCheck) { FfiConverterInt8.checkType(v); } const result = await UniFFIScaffolding.callAsync( - 171, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_i8 + 191, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_i8 FfiConverterInt8.lower(v), ) return handleRustResult( @@ -190,7 +190,7 @@ if (v instanceof UniffiSkipJsTypeCheck) { FfiConverterMapStringString.checkType(v); } const result = await UniFFIScaffolding.callAsync( - 172, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_map + 192, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_map FfiConverterMapStringString.lower(v), ) return handleRustResult( @@ -214,7 +214,7 @@ if (v instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeAsyncInterface.checkType(v); } const result = await UniFFIScaffolding.callAsync( - 173, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_obj + 193, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_obj FfiConverterTypeAsyncInterface.lower(v), ) return handleRustResult( @@ -238,7 +238,7 @@ if (v instanceof UniffiSkipJsTypeCheck) { FfiConverterString.checkType(v); } const result = await UniFFIScaffolding.callAsync( - 174, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_string + 194, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_string FfiConverterString.lower(v), ) return handleRustResult( @@ -262,7 +262,7 @@ if (v instanceof UniffiSkipJsTypeCheck) { FfiConverterUInt16.checkType(v); } const result = await UniFFIScaffolding.callAsync( - 175, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_u16 + 195, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_u16 FfiConverterUInt16.lower(v), ) return handleRustResult( @@ -286,7 +286,7 @@ if (v instanceof UniffiSkipJsTypeCheck) { FfiConverterUInt32.checkType(v); } const result = await UniFFIScaffolding.callAsync( - 176, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_u32 + 196, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_u32 FfiConverterUInt32.lower(v), ) return handleRustResult( @@ -310,7 +310,7 @@ if (v instanceof UniffiSkipJsTypeCheck) { FfiConverterUInt64.checkType(v); } const result = await UniFFIScaffolding.callAsync( - 177, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_u64 + 197, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_u64 FfiConverterUInt64.lower(v), ) return handleRustResult( @@ -334,7 +334,7 @@ if (v instanceof UniffiSkipJsTypeCheck) { FfiConverterUInt8.checkType(v); } const result = await UniFFIScaffolding.callAsync( - 178, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_u8 + 198, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_u8 FfiConverterUInt8.lower(v), ) return handleRustResult( @@ -358,7 +358,7 @@ if (v instanceof UniffiSkipJsTypeCheck) { FfiConverterSequenceUInt32.checkType(v); } const result = await UniFFIScaffolding.callAsync( - 179, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_vec + 199, // uniffi_uniffi_bindings_tests_fn_func_async_roundtrip_vec FfiConverterSequenceUInt32.lower(v), ) return handleRustResult( @@ -374,7 +374,7 @@ return handleRustResult( export async function asyncThrowError() { const result = await UniFFIScaffolding.callAsync( - 180, // uniffi_uniffi_bindings_tests_fn_func_async_throw_error + 200, // uniffi_uniffi_bindings_tests_fn_func_async_throw_error ) return handleRustResult( result, @@ -397,7 +397,7 @@ if (int instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeTestInterface.checkType(int); } const result = UniFFIScaffolding.callSync( - 181, // uniffi_uniffi_bindings_tests_fn_func_clone_interface + 201, // uniffi_uniffi_bindings_tests_fn_func_clone_interface FfiConverterTypeTestInterface.lower(int), ) return handleRustResult( @@ -421,7 +421,7 @@ if (value instanceof UniffiSkipJsTypeCheck) { FfiConverterUInt32.checkType(value); } const result = await UniFFIScaffolding.callAsyncWrapper( - 182, // uniffi_uniffi_bindings_tests_fn_func_create_async_test_trait_interface + 202, // uniffi_uniffi_bindings_tests_fn_func_create_async_test_trait_interface FfiConverterUInt32.lower(value), ) return handleRustResult( @@ -445,7 +445,7 @@ if (value instanceof UniffiSkipJsTypeCheck) { FfiConverterUInt32.checkType(value); } const result = UniFFIScaffolding.callSync( - 183, // uniffi_uniffi_bindings_tests_fn_func_create_test_trait_interface + 203, // uniffi_uniffi_bindings_tests_fn_func_create_test_trait_interface FfiConverterUInt32.lower(value), ) return handleRustResult( @@ -469,7 +469,7 @@ if (arg instanceof UniffiSkipJsTypeCheck) { FfiConverterString.checkType(arg); } const result = UniFFIScaffolding.callSync( - 184, // uniffi_uniffi_bindings_tests_fn_func_func_with_default + 204, // uniffi_uniffi_bindings_tests_fn_func_func_with_default FfiConverterString.lower(arg), ) return handleRustResult( @@ -492,7 +492,7 @@ if (input instanceof UniffiSkipJsTypeCheck) { FfiConverterUInt32.checkType(input); } const result = UniFFIScaffolding.callSync( - 185, // uniffi_uniffi_bindings_tests_fn_func_func_with_error + 205, // uniffi_uniffi_bindings_tests_fn_func_func_with_error FfiConverterUInt32.lower(input), ) return handleRustResult( @@ -515,7 +515,7 @@ if (input instanceof UniffiSkipJsTypeCheck) { FfiConverterUInt32.checkType(input); } const result = UniFFIScaffolding.callSync( - 186, // uniffi_uniffi_bindings_tests_fn_func_func_with_flat_error + 206, // uniffi_uniffi_bindings_tests_fn_func_func_with_flat_error FfiConverterUInt32.lower(input), ) return handleRustResult( @@ -540,7 +540,7 @@ if (theArgument instanceof UniffiSkipJsTypeCheck) { FfiConverterString.checkType(theArgument); } const result = UniFFIScaffolding.callSync( - 187, // uniffi_uniffi_bindings_tests_fn_func_func_with_multi_word_arg + 207, // uniffi_uniffi_bindings_tests_fn_func_func_with_multi_word_arg FfiConverterString.lower(theArgument), ) return handleRustResult( @@ -557,7 +557,7 @@ return handleRustResult( export async function getCustomTypesDemo() { const result = await UniFFIScaffolding.callAsyncWrapper( - 188, // uniffi_uniffi_bindings_tests_fn_func_get_custom_types_demo + 208, // uniffi_uniffi_bindings_tests_fn_func_get_custom_types_demo ) return handleRustResult( result, @@ -580,7 +580,7 @@ if (int instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeAsyncTestTraitInterface.checkType(int); } const result = await UniFFIScaffolding.callAsync( - 189, // uniffi_uniffi_bindings_tests_fn_func_invoke_async_test_trait_interface_get_value + 209, // uniffi_uniffi_bindings_tests_fn_func_invoke_async_test_trait_interface_get_value FfiConverterTypeAsyncTestTraitInterface.lower(int), ) return handleRustResult( @@ -603,7 +603,7 @@ if (int instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeAsyncTestTraitInterface.checkType(int); } const result = await UniFFIScaffolding.callAsync( - 190, // uniffi_uniffi_bindings_tests_fn_func_invoke_async_test_trait_interface_noop + 210, // uniffi_uniffi_bindings_tests_fn_func_invoke_async_test_trait_interface_noop FfiConverterTypeAsyncTestTraitInterface.lower(int), ) return handleRustResult( @@ -633,7 +633,7 @@ if (value instanceof UniffiSkipJsTypeCheck) { FfiConverterUInt32.checkType(value); } const result = await UniFFIScaffolding.callAsync( - 191, // uniffi_uniffi_bindings_tests_fn_func_invoke_async_test_trait_interface_set_value + 211, // uniffi_uniffi_bindings_tests_fn_func_invoke_async_test_trait_interface_set_value FfiConverterTypeAsyncTestTraitInterface.lower(int), FfiConverterUInt32.lower(value), ) @@ -665,7 +665,7 @@ if (numbers instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeCallbackInterfaceNumbers.checkType(numbers); } const result = await UniFFIScaffolding.callAsync( - 192, // uniffi_uniffi_bindings_tests_fn_func_invoke_async_test_trait_interface_throw_if_equal + 212, // uniffi_uniffi_bindings_tests_fn_func_invoke_async_test_trait_interface_throw_if_equal FfiConverterTypeAsyncTestTraitInterface.lower(int), FfiConverterTypeCallbackInterfaceNumbers.lower(numbers), ) @@ -690,7 +690,7 @@ if (cbi instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeTestAsyncCallbackInterface.checkType(cbi); } const result = await UniFFIScaffolding.callAsync( - 193, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_async_callback_interface_get_value + 213, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_async_callback_interface_get_value FfiConverterTypeTestAsyncCallbackInterface.lower(cbi), ) return handleRustResult( @@ -713,7 +713,7 @@ if (cbi instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeTestAsyncCallbackInterface.checkType(cbi); } const result = await UniFFIScaffolding.callAsync( - 194, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_async_callback_interface_noop + 214, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_async_callback_interface_noop FfiConverterTypeTestAsyncCallbackInterface.lower(cbi), ) return handleRustResult( @@ -743,7 +743,7 @@ if (value instanceof UniffiSkipJsTypeCheck) { FfiConverterUInt32.checkType(value); } const result = await UniFFIScaffolding.callAsync( - 195, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_async_callback_interface_set_value + 215, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_async_callback_interface_set_value FfiConverterTypeTestAsyncCallbackInterface.lower(cbi), FfiConverterUInt32.lower(value), ) @@ -775,7 +775,7 @@ if (numbers instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeCallbackInterfaceNumbers.checkType(numbers); } const result = await UniFFIScaffolding.callAsync( - 196, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_async_callback_interface_throw_if_equal + 216, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_async_callback_interface_throw_if_equal FfiConverterTypeTestAsyncCallbackInterface.lower(cbi), FfiConverterTypeCallbackInterfaceNumbers.lower(numbers), ) @@ -800,7 +800,7 @@ if (cbi instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeTestCallbackInterface.checkType(cbi); } const result = UniFFIScaffolding.callSync( - 197, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_callback_interface_get_value + 217, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_callback_interface_get_value FfiConverterTypeTestCallbackInterface.lower(cbi), ) return handleRustResult( @@ -823,7 +823,7 @@ if (cbi instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeTestCallbackInterface.checkType(cbi); } const result = UniFFIScaffolding.callSync( - 198, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_callback_interface_noop + 218, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_callback_interface_noop FfiConverterTypeTestCallbackInterface.lower(cbi), ) return handleRustResult( @@ -853,7 +853,7 @@ if (value instanceof UniffiSkipJsTypeCheck) { FfiConverterUInt32.checkType(value); } const result = UniFFIScaffolding.callSync( - 199, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_callback_interface_set_value + 219, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_callback_interface_set_value FfiConverterTypeTestCallbackInterface.lower(cbi), FfiConverterUInt32.lower(value), ) @@ -885,7 +885,7 @@ if (numbers instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeCallbackInterfaceNumbers.checkType(numbers); } const result = UniFFIScaffolding.callSync( - 200, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_callback_interface_throw_if_equal + 220, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_callback_interface_throw_if_equal FfiConverterTypeTestCallbackInterface.lower(cbi), FfiConverterTypeCallbackInterfaceNumbers.lower(numbers), ) @@ -910,7 +910,7 @@ if (int instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeTestTraitInterface.checkType(int); } const result = UniFFIScaffolding.callSync( - 201, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_trait_interface_get_value + 221, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_trait_interface_get_value FfiConverterTypeTestTraitInterface.lower(int), ) return handleRustResult( @@ -933,7 +933,7 @@ if (int instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeTestTraitInterface.checkType(int); } const result = UniFFIScaffolding.callSync( - 202, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_trait_interface_noop + 222, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_trait_interface_noop FfiConverterTypeTestTraitInterface.lower(int), ) return handleRustResult( @@ -963,7 +963,7 @@ if (value instanceof UniffiSkipJsTypeCheck) { FfiConverterUInt32.checkType(value); } const result = UniFFIScaffolding.callSync( - 203, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_trait_interface_set_value + 223, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_trait_interface_set_value FfiConverterTypeTestTraitInterface.lower(int), FfiConverterUInt32.lower(value), ) @@ -995,7 +995,7 @@ if (numbers instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeCallbackInterfaceNumbers.checkType(numbers); } const result = UniFFIScaffolding.callSync( - 204, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_trait_interface_throw_if_equal + 224, // uniffi_uniffi_bindings_tests_fn_func_invoke_test_trait_interface_throw_if_equal FfiConverterTypeTestTraitInterface.lower(int), FfiConverterTypeCallbackInterfaceNumbers.lower(numbers), ) @@ -1020,7 +1020,7 @@ if (a instanceof UniffiSkipJsTypeCheck) { FfiConverterBoolean.checkType(a); } const result = UniFFIScaffolding.callSync( - 205, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_bool + 225, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_bool FfiConverterBoolean.lower(a), ) return handleRustResult( @@ -1044,7 +1044,7 @@ if (a instanceof UniffiSkipJsTypeCheck) { FfiConverterOptionalSequenceMapStringUInt32.checkType(a); } const result = UniFFIScaffolding.callSync( - 206, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_complex_compound + 226, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_complex_compound FfiConverterOptionalSequenceMapStringUInt32.lower(a), ) return handleRustResult( @@ -1068,7 +1068,7 @@ if (en instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeComplexEnum.checkType(en); } const result = UniFFIScaffolding.callSync( - 207, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_complex_enum + 227, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_complex_enum FfiConverterTypeComplexEnum.lower(en), ) return handleRustResult( @@ -1092,7 +1092,7 @@ if (rec instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeComplexRec.checkType(rec); } const result = UniFFIScaffolding.callSync( - 208, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_complex_rec + 228, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_complex_rec FfiConverterTypeComplexRec.lower(rec), ) return handleRustResult( @@ -1116,7 +1116,7 @@ if (handle instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeHandle.checkType(handle); } const result = UniFFIScaffolding.callSync( - 209, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_custom_type + 229, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_custom_type FfiConverterTypeHandle.lower(handle), ) return handleRustResult( @@ -1140,7 +1140,7 @@ if (en instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeEnumNoData.checkType(en); } const result = UniFFIScaffolding.callSync( - 210, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_enum_no_data + 230, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_enum_no_data FfiConverterTypeEnumNoData.lower(en), ) return handleRustResult( @@ -1164,7 +1164,7 @@ if (en instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeEnumWithData.checkType(en); } const result = UniFFIScaffolding.callSync( - 211, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_enum_with_data + 231, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_enum_with_data FfiConverterTypeEnumWithData.lower(en), ) return handleRustResult( @@ -1188,7 +1188,7 @@ if (a instanceof UniffiSkipJsTypeCheck) { FfiConverterFloat32.checkType(a); } const result = UniFFIScaffolding.callSync( - 212, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_f32 + 232, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_f32 FfiConverterFloat32.lower(a), ) return handleRustResult( @@ -1212,7 +1212,7 @@ if (a instanceof UniffiSkipJsTypeCheck) { FfiConverterFloat64.checkType(a); } const result = UniFFIScaffolding.callSync( - 213, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_f64 + 233, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_f64 FfiConverterFloat64.lower(a), ) return handleRustResult( @@ -1236,7 +1236,7 @@ if (a instanceof UniffiSkipJsTypeCheck) { FfiConverterMapStringUInt32.checkType(a); } const result = UniFFIScaffolding.callSync( - 214, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_hash_map + 234, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_hash_map FfiConverterMapStringUInt32.lower(a), ) return handleRustResult( @@ -1260,7 +1260,7 @@ if (a instanceof UniffiSkipJsTypeCheck) { FfiConverterInt16.checkType(a); } const result = UniFFIScaffolding.callSync( - 215, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_i16 + 235, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_i16 FfiConverterInt16.lower(a), ) return handleRustResult( @@ -1284,7 +1284,7 @@ if (a instanceof UniffiSkipJsTypeCheck) { FfiConverterInt32.checkType(a); } const result = UniFFIScaffolding.callSync( - 216, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_i32 + 236, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_i32 FfiConverterInt32.lower(a), ) return handleRustResult( @@ -1308,7 +1308,7 @@ if (a instanceof UniffiSkipJsTypeCheck) { FfiConverterInt64.checkType(a); } const result = UniFFIScaffolding.callSync( - 217, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_i64 + 237, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_i64 FfiConverterInt64.lower(a), ) return handleRustResult( @@ -1332,7 +1332,7 @@ if (a instanceof UniffiSkipJsTypeCheck) { FfiConverterInt8.checkType(a); } const result = UniFFIScaffolding.callSync( - 218, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_i8 + 238, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_i8 FfiConverterInt8.lower(a), ) return handleRustResult( @@ -1356,7 +1356,7 @@ if (a instanceof UniffiSkipJsTypeCheck) { FfiConverterOptionalUInt32.checkType(a); } const result = UniFFIScaffolding.callSync( - 219, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_option + 239, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_option FfiConverterOptionalUInt32.lower(a), ) return handleRustResult( @@ -1380,7 +1380,7 @@ if (rec instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeSimpleRec.checkType(rec); } const result = await UniFFIScaffolding.callAsyncWrapper( - 220, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_simple_rec + 240, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_simple_rec FfiConverterTypeSimpleRec.lower(rec), ) return handleRustResult( @@ -1404,7 +1404,7 @@ if (a instanceof UniffiSkipJsTypeCheck) { FfiConverterString.checkType(a); } const result = UniFFIScaffolding.callSync( - 221, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_string + 241, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_string FfiConverterString.lower(a), ) return handleRustResult( @@ -1428,7 +1428,7 @@ if (time instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeTimeIntervalMs.checkType(time); } const result = await UniFFIScaffolding.callAsyncWrapper( - 222, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_time_interval_ms + 242, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_time_interval_ms FfiConverterTypeTimeIntervalMs.lower(time), ) return handleRustResult( @@ -1452,7 +1452,7 @@ if (time instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeTimeIntervalSecDbl.checkType(time); } const result = await UniFFIScaffolding.callAsyncWrapper( - 223, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_time_interval_sec_dbl + 243, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_time_interval_sec_dbl FfiConverterTypeTimeIntervalSecDbl.lower(time), ) return handleRustResult( @@ -1476,7 +1476,7 @@ if (time instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeTimeIntervalSecFlt.checkType(time); } const result = await UniFFIScaffolding.callAsyncWrapper( - 224, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_time_interval_sec_flt + 244, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_time_interval_sec_flt FfiConverterTypeTimeIntervalSecFlt.lower(time), ) return handleRustResult( @@ -1500,7 +1500,7 @@ if (a instanceof UniffiSkipJsTypeCheck) { FfiConverterUInt16.checkType(a); } const result = UniFFIScaffolding.callSync( - 225, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_u16 + 245, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_u16 FfiConverterUInt16.lower(a), ) return handleRustResult( @@ -1524,7 +1524,7 @@ if (a instanceof UniffiSkipJsTypeCheck) { FfiConverterUInt32.checkType(a); } const result = UniFFIScaffolding.callSync( - 226, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_u32 + 246, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_u32 FfiConverterUInt32.lower(a), ) return handleRustResult( @@ -1548,7 +1548,7 @@ if (a instanceof UniffiSkipJsTypeCheck) { FfiConverterUInt64.checkType(a); } const result = UniFFIScaffolding.callSync( - 227, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_u64 + 247, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_u64 FfiConverterUInt64.lower(a), ) return handleRustResult( @@ -1572,7 +1572,7 @@ if (a instanceof UniffiSkipJsTypeCheck) { FfiConverterUInt8.checkType(a); } const result = UniFFIScaffolding.callSync( - 228, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_u8 + 248, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_u8 FfiConverterUInt8.lower(a), ) return handleRustResult( @@ -1596,7 +1596,7 @@ if (url instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeUrl.checkType(url); } const result = await UniFFIScaffolding.callAsyncWrapper( - 229, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_url + 249, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_url FfiConverterTypeUrl.lower(url), ) return handleRustResult( @@ -1620,7 +1620,7 @@ if (a instanceof UniffiSkipJsTypeCheck) { FfiConverterSequenceUInt32.checkType(a); } const result = UniFFIScaffolding.callSync( - 230, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_vec + 250, // uniffi_uniffi_bindings_tests_fn_func_roundtrip_vec FfiConverterSequenceUInt32.lower(a), ) return handleRustResult( @@ -1714,7 +1714,7 @@ if (negate instanceof UniffiSkipJsTypeCheck) { FfiConverterBoolean.checkType(negate); } const result = UniFFIScaffolding.callSync( - 231, // uniffi_uniffi_bindings_tests_fn_func_sum_with_many_types + 251, // uniffi_uniffi_bindings_tests_fn_func_sum_with_many_types FfiConverterUInt8.lower(a), FfiConverterInt8.lower(b), FfiConverterUInt16.lower(c), @@ -1748,7 +1748,7 @@ if (interfaces instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeTwoTestInterfaces.checkType(interfaces); } const result = UniFFIScaffolding.callSync( - 232, // uniffi_uniffi_bindings_tests_fn_func_swap_test_interfaces + 252, // uniffi_uniffi_bindings_tests_fn_func_swap_test_interfaces FfiConverterTypeTwoTestInterfaces.lower(interfaces), ) return handleRustResult( @@ -1764,7 +1764,7 @@ return handleRustResult( export function testFunc() { const result = UniFFIScaffolding.callSync( - 233, // uniffi_uniffi_bindings_tests_fn_func_test_func + 253, // uniffi_uniffi_bindings_tests_fn_func_test_func ) return handleRustResult( result, @@ -2748,7 +2748,7 @@ export class TestInterface extends TestInterfaceInterface { FfiConverterUInt32.checkType(value); } const result = UniFFIScaffolding.callSync( - 234, // uniffi_uniffi_bindings_tests_fn_constructor_testinterface_new + 254, // uniffi_uniffi_bindings_tests_fn_constructor_testinterface_new FfiConverterUInt32.lower(value), ) return handleRustResult( @@ -2765,7 +2765,7 @@ export class TestInterface extends TestInterfaceInterface { getValue() { const result = UniFFIScaffolding.callSync( - 235, // uniffi_uniffi_bindings_tests_fn_method_testinterface_get_value + 255, // uniffi_uniffi_bindings_tests_fn_method_testinterface_get_value FfiConverterTypeTestInterface.lowerReceiver(this), ) return handleRustResult( @@ -2784,7 +2784,7 @@ export class TestInterface extends TestInterfaceInterface { refCount() { const result = UniFFIScaffolding.callSync( - 236, // uniffi_uniffi_bindings_tests_fn_method_testinterface_ref_count + 256, // uniffi_uniffi_bindings_tests_fn_method_testinterface_ref_count FfiConverterTypeTestInterface.lowerReceiver(this), ) return handleRustResult( @@ -2818,11 +2818,11 @@ export class FfiConverterTypeTestInterface extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(23)); + return this.lift(dataStream.readPointer(25)); } static write(dataStream, value) { - dataStream.writePointer(23, this.lower(value)); + dataStream.writePointer(25, this.lower(value)); } static computeSize(value) { @@ -3563,7 +3563,7 @@ export class AsyncInterface extends AsyncInterfaceInterface { FfiConverterString.checkType(name); } const result = UniFFIScaffolding.callSync( - 237, // uniffi_uniffi_bindings_tests_fn_constructor_asyncinterface_new + 257, // uniffi_uniffi_bindings_tests_fn_constructor_asyncinterface_new FfiConverterString.lower(name), ) return handleRustResult( @@ -3580,7 +3580,7 @@ export class AsyncInterface extends AsyncInterfaceInterface { async name() { const result = await UniFFIScaffolding.callAsync( - 238, // uniffi_uniffi_bindings_tests_fn_method_asyncinterface_name + 258, // uniffi_uniffi_bindings_tests_fn_method_asyncinterface_name FfiConverterTypeAsyncInterface.lowerReceiver(this), ) return handleRustResult( @@ -3614,11 +3614,11 @@ export class FfiConverterTypeAsyncInterface extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(24)); + return this.lift(dataStream.readPointer(26)); } static write(dataStream, value) { - dataStream.writePointer(24, this.lower(value)); + dataStream.writePointer(26, this.lower(value)); } static computeSize(value) { @@ -3691,7 +3691,7 @@ export class AsyncTestTraitInterfaceImpl extends AsyncTestTraitInterface { async noop() { const result = await UniFFIScaffolding.callAsync( - 239, // uniffi_uniffi_bindings_tests_fn_method_asynctesttraitinterface_noop + 259, // uniffi_uniffi_bindings_tests_fn_method_asynctesttraitinterface_noop FfiConverterTypeAsyncTestTraitInterface.lowerReceiver(this), ) return handleRustResult( @@ -3708,7 +3708,7 @@ export class AsyncTestTraitInterfaceImpl extends AsyncTestTraitInterface { async getValue() { const result = await UniFFIScaffolding.callAsync( - 240, // uniffi_uniffi_bindings_tests_fn_method_asynctesttraitinterface_get_value + 260, // uniffi_uniffi_bindings_tests_fn_method_asynctesttraitinterface_get_value FfiConverterTypeAsyncTestTraitInterface.lowerReceiver(this), ) return handleRustResult( @@ -3731,7 +3731,7 @@ export class AsyncTestTraitInterfaceImpl extends AsyncTestTraitInterface { FfiConverterUInt32.checkType(value); } const result = await UniFFIScaffolding.callAsync( - 241, // uniffi_uniffi_bindings_tests_fn_method_asynctesttraitinterface_set_value + 261, // uniffi_uniffi_bindings_tests_fn_method_asynctesttraitinterface_set_value FfiConverterTypeAsyncTestTraitInterface.lowerReceiver(this), FfiConverterUInt32.lower(value), ) @@ -3759,7 +3759,7 @@ export class AsyncTestTraitInterfaceImpl extends AsyncTestTraitInterface { FfiConverterTypeCallbackInterfaceNumbers.checkType(numbers); } const result = await UniFFIScaffolding.callAsync( - 242, // uniffi_uniffi_bindings_tests_fn_method_asynctesttraitinterface_throw_if_equal + 262, // uniffi_uniffi_bindings_tests_fn_method_asynctesttraitinterface_throw_if_equal FfiConverterTypeAsyncTestTraitInterface.lowerReceiver(this), FfiConverterTypeCallbackInterfaceNumbers.lower(numbers), ) @@ -3803,11 +3803,11 @@ export class FfiConverterTypeAsyncTestTraitInterface extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(25)); + return this.lift(dataStream.readPointer(27)); } static write(dataStream, value) { - dataStream.writePointer(25, this.lower(value)); + dataStream.writePointer(27, this.lower(value)); } static computeSize(value) { @@ -3817,7 +3817,7 @@ export class FfiConverterTypeAsyncTestTraitInterface extends FfiConverter { const uniffiCallbackHandlerUniffiBindingsTestsAsyncTestTraitInterface = new UniFFICallbackHandler( "AsyncTestTraitInterface", - 9, + 10, [ new UniFFICallbackMethodHandler( "noop", @@ -3915,7 +3915,7 @@ export class ComplexMethods extends ComplexMethodsInterface { static init() { const result = UniFFIScaffolding.callSync( - 243, // uniffi_uniffi_bindings_tests_fn_constructor_complexmethods_new + 263, // uniffi_uniffi_bindings_tests_fn_constructor_complexmethods_new ) return handleRustResult( result, @@ -3938,7 +3938,7 @@ export class ComplexMethods extends ComplexMethodsInterface { FfiConverterString.checkType(arg); } const result = UniFFIScaffolding.callSync( - 244, // uniffi_uniffi_bindings_tests_fn_method_complexmethods_method_with_default + 264, // uniffi_uniffi_bindings_tests_fn_method_complexmethods_method_with_default FfiConverterTypeComplexMethods.lowerReceiver(this), FfiConverterString.lower(arg), ) @@ -3963,7 +3963,7 @@ export class ComplexMethods extends ComplexMethodsInterface { FfiConverterString.checkType(theArgument); } const result = UniFFIScaffolding.callSync( - 245, // uniffi_uniffi_bindings_tests_fn_method_complexmethods_method_with_multi_word_arg + 265, // uniffi_uniffi_bindings_tests_fn_method_complexmethods_method_with_multi_word_arg FfiConverterTypeComplexMethods.lowerReceiver(this), FfiConverterString.lower(theArgument), ) @@ -3998,11 +3998,11 @@ export class FfiConverterTypeComplexMethods extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(26)); + return this.lift(dataStream.readPointer(28)); } static write(dataStream, value) { - dataStream.writePointer(26, this.lower(value)); + dataStream.writePointer(28, this.lower(value)); } static computeSize(value) { @@ -4075,7 +4075,7 @@ export class TestTraitInterfaceImpl extends TestTraitInterface { noop() { const result = UniFFIScaffolding.callSync( - 246, // uniffi_uniffi_bindings_tests_fn_method_testtraitinterface_noop + 266, // uniffi_uniffi_bindings_tests_fn_method_testtraitinterface_noop FfiConverterTypeTestTraitInterface.lowerReceiver(this), ) return handleRustResult( @@ -4092,7 +4092,7 @@ export class TestTraitInterfaceImpl extends TestTraitInterface { getValue() { const result = UniFFIScaffolding.callSync( - 247, // uniffi_uniffi_bindings_tests_fn_method_testtraitinterface_get_value + 267, // uniffi_uniffi_bindings_tests_fn_method_testtraitinterface_get_value FfiConverterTypeTestTraitInterface.lowerReceiver(this), ) return handleRustResult( @@ -4115,7 +4115,7 @@ export class TestTraitInterfaceImpl extends TestTraitInterface { FfiConverterUInt32.checkType(value); } const result = UniFFIScaffolding.callSync( - 248, // uniffi_uniffi_bindings_tests_fn_method_testtraitinterface_set_value + 268, // uniffi_uniffi_bindings_tests_fn_method_testtraitinterface_set_value FfiConverterTypeTestTraitInterface.lowerReceiver(this), FfiConverterUInt32.lower(value), ) @@ -4143,7 +4143,7 @@ export class TestTraitInterfaceImpl extends TestTraitInterface { FfiConverterTypeCallbackInterfaceNumbers.checkType(numbers); } const result = UniFFIScaffolding.callSync( - 249, // uniffi_uniffi_bindings_tests_fn_method_testtraitinterface_throw_if_equal + 269, // uniffi_uniffi_bindings_tests_fn_method_testtraitinterface_throw_if_equal FfiConverterTypeTestTraitInterface.lowerReceiver(this), FfiConverterTypeCallbackInterfaceNumbers.lower(numbers), ) @@ -4187,11 +4187,11 @@ export class FfiConverterTypeTestTraitInterface extends FfiConverter { } static read(dataStream) { - return this.lift(dataStream.readPointer(27)); + return this.lift(dataStream.readPointer(29)); } static write(dataStream, value) { - dataStream.writePointer(27, this.lower(value)); + dataStream.writePointer(29, this.lower(value)); } static computeSize(value) { @@ -4201,7 +4201,7 @@ export class FfiConverterTypeTestTraitInterface extends FfiConverter { const uniffiCallbackHandlerUniffiBindingsTestsTestTraitInterface = new UniFFICallbackHandler( "TestTraitInterface", - 10, + 11, [ new UniFFICallbackMethodHandler( "noop", @@ -4314,7 +4314,7 @@ export class FfiConverterTypeTestAsyncCallbackInterface extends FfiConverter { } const uniffiCallbackHandlerUniffiBindingsTestsTestAsyncCallbackInterface = new UniFFICallbackHandler( "TestAsyncCallbackInterface", - 7, + 8, [ new UniFFICallbackMethodHandler( "noop", @@ -4427,7 +4427,7 @@ export class FfiConverterTypeTestCallbackInterface extends FfiConverter { } const uniffiCallbackHandlerUniffiBindingsTestsTestCallbackInterface = new UniFFICallbackHandler( "TestCallbackInterface", - 8, + 9, [ new UniFFICallbackMethodHandler( "noop", diff --git a/toolkit/components/uniffi-bindgen-gecko-js/tests/generated/RustUniffiBindingsTestsCollision.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/tests/generated/RustUniffiBindingsTestsCollision.sys.mjs index 83da36618e443..c46d742124274 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/tests/generated/RustUniffiBindingsTestsCollision.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/tests/generated/RustUniffiBindingsTestsCollision.sys.mjs @@ -46,7 +46,7 @@ if (cb instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeTestCallbackInterface.checkType(cb); } const result = UniFFIScaffolding.callSync( - 250, // uniffi_uniffi_bindings_tests_collision_fn_func_invoke_collision_callback + 270, // uniffi_uniffi_bindings_tests_collision_fn_func_invoke_collision_callback FfiConverterTypeTestCallbackInterface.lower(cb), ) return handleRustResult( @@ -101,7 +101,7 @@ export class FfiConverterTypeTestCallbackInterface extends FfiConverter { } const uniffiCallbackHandlerUniffiBindingsTestsCollisionTestCallbackInterface = new UniFFICallbackHandler( "TestCallbackInterface", - 11, + 12, [ new UniFFICallbackMethodHandler( "getValue", diff --git a/toolkit/components/uniffi-bindgen-gecko-js/tests/generated/RustUniffiBindingsTestsExternalTypes.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/tests/generated/RustUniffiBindingsTestsExternalTypes.sys.mjs index baf445e5a865e..1c14759a0d4da 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/tests/generated/RustUniffiBindingsTestsExternalTypes.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/tests/generated/RustUniffiBindingsTestsExternalTypes.sys.mjs @@ -46,7 +46,7 @@ if (custom instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeHandle.checkType(custom); } const result = UniFFIScaffolding.callSync( - 251, // uniffi_uniffi_bindings_tests_external_types_fn_func_roundtrip_ext_custom_type + 271, // uniffi_uniffi_bindings_tests_external_types_fn_func_roundtrip_ext_custom_type FfiConverterTypeHandle.lower(custom), ) return handleRustResult( @@ -70,7 +70,7 @@ if (en instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeEnumWithData.checkType(en); } const result = UniFFIScaffolding.callSync( - 252, // uniffi_uniffi_bindings_tests_external_types_fn_func_roundtrip_ext_enum + 272, // uniffi_uniffi_bindings_tests_external_types_fn_func_roundtrip_ext_enum FfiConverterTypeEnumWithData.lower(en), ) return handleRustResult( @@ -94,7 +94,7 @@ if (int instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeTestInterface.checkType(int); } const result = UniFFIScaffolding.callSync( - 253, // uniffi_uniffi_bindings_tests_external_types_fn_func_roundtrip_ext_interface + 273, // uniffi_uniffi_bindings_tests_external_types_fn_func_roundtrip_ext_interface FfiConverterTypeTestInterface.lower(int), ) return handleRustResult( @@ -118,7 +118,7 @@ if (rec instanceof UniffiSkipJsTypeCheck) { FfiConverterTypeSimpleRec.checkType(rec); } const result = UniFFIScaffolding.callSync( - 254, // uniffi_uniffi_bindings_tests_external_types_fn_func_roundtrip_ext_record + 274, // uniffi_uniffi_bindings_tests_external_types_fn_func_roundtrip_ext_record FfiConverterTypeSimpleRec.lower(rec), ) return handleRustResult( diff --git a/toolkit/components/uniffi-js/GeneratedScaffolding.cpp b/toolkit/components/uniffi-js/GeneratedScaffolding.cpp index a317ea701be79..f9247e9c62070 100644 --- a/toolkit/components/uniffi-js/GeneratedScaffolding.cpp +++ b/toolkit/components/uniffi-js/GeneratedScaffolding.cpp @@ -40,16 +40,120 @@ using dom::UniFFIScaffoldingCallResult; extern "C" { - RustBuffer ffi_context_id_rustbuffer_alloc(uint64_t, RustCallStatus*); - RustBuffer ffi_context_id_rustbuffer_from_bytes(ForeignBytes, RustCallStatus*); - void ffi_context_id_rustbuffer_free(RustBuffer, RustCallStatus*); - RustBuffer ffi_context_id_rustbuffer_reserve(RustBuffer, uint64_t, RustCallStatus*); + RustBuffer ffi_ads_client_rustbuffer_alloc(uint64_t, RustCallStatus*); + RustBuffer ffi_ads_client_rustbuffer_from_bytes(ForeignBytes, RustCallStatus*); + void ffi_ads_client_rustbuffer_free(RustBuffer, RustCallStatus*); + RustBuffer ffi_ads_client_rustbuffer_reserve(RustBuffer, uint64_t, RustCallStatus*); typedef void (*RustFutureContinuationCallback)(uint64_t, int8_t); typedef void (*ForeignFutureFree)(uint64_t); struct ForeignFuture { uint64_t handle; ForeignFutureFree free; }; + void ffi_ads_client_rust_future_poll_u8(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_ads_client_rust_future_cancel_u8(uint64_t); + uint8_t ffi_ads_client_rust_future_complete_u8(uint64_t, RustCallStatus*); + void ffi_ads_client_rust_future_free_u8(uint64_t); + void ffi_ads_client_rust_future_poll_i8(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_ads_client_rust_future_cancel_i8(uint64_t); + int8_t ffi_ads_client_rust_future_complete_i8(uint64_t, RustCallStatus*); + void ffi_ads_client_rust_future_free_i8(uint64_t); + void ffi_ads_client_rust_future_poll_u16(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_ads_client_rust_future_cancel_u16(uint64_t); + uint16_t ffi_ads_client_rust_future_complete_u16(uint64_t, RustCallStatus*); + void ffi_ads_client_rust_future_free_u16(uint64_t); + void ffi_ads_client_rust_future_poll_i16(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_ads_client_rust_future_cancel_i16(uint64_t); + int16_t ffi_ads_client_rust_future_complete_i16(uint64_t, RustCallStatus*); + void ffi_ads_client_rust_future_free_i16(uint64_t); + void ffi_ads_client_rust_future_poll_u32(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_ads_client_rust_future_cancel_u32(uint64_t); + uint32_t ffi_ads_client_rust_future_complete_u32(uint64_t, RustCallStatus*); + void ffi_ads_client_rust_future_free_u32(uint64_t); + void ffi_ads_client_rust_future_poll_i32(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_ads_client_rust_future_cancel_i32(uint64_t); + int32_t ffi_ads_client_rust_future_complete_i32(uint64_t, RustCallStatus*); + void ffi_ads_client_rust_future_free_i32(uint64_t); + void ffi_ads_client_rust_future_poll_u64(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_ads_client_rust_future_cancel_u64(uint64_t); + uint64_t ffi_ads_client_rust_future_complete_u64(uint64_t, RustCallStatus*); + void ffi_ads_client_rust_future_free_u64(uint64_t); + void ffi_ads_client_rust_future_poll_i64(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_ads_client_rust_future_cancel_i64(uint64_t); + int64_t ffi_ads_client_rust_future_complete_i64(uint64_t, RustCallStatus*); + void ffi_ads_client_rust_future_free_i64(uint64_t); + void ffi_ads_client_rust_future_poll_f32(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_ads_client_rust_future_cancel_f32(uint64_t); + float ffi_ads_client_rust_future_complete_f32(uint64_t, RustCallStatus*); + void ffi_ads_client_rust_future_free_f32(uint64_t); + void ffi_ads_client_rust_future_poll_f64(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_ads_client_rust_future_cancel_f64(uint64_t); + double ffi_ads_client_rust_future_complete_f64(uint64_t, RustCallStatus*); + void ffi_ads_client_rust_future_free_f64(uint64_t); + void ffi_ads_client_rust_future_poll_pointer(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_ads_client_rust_future_cancel_pointer(uint64_t); + void* ffi_ads_client_rust_future_complete_pointer(uint64_t, RustCallStatus*); + void ffi_ads_client_rust_future_free_pointer(uint64_t); + void ffi_ads_client_rust_future_poll_rust_buffer(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_ads_client_rust_future_cancel_rust_buffer(uint64_t); + RustBuffer ffi_ads_client_rust_future_complete_rust_buffer(uint64_t, RustCallStatus*); + void ffi_ads_client_rust_future_free_rust_buffer(uint64_t); + void ffi_ads_client_rust_future_poll_void(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_ads_client_rust_future_cancel_void(uint64_t); + void ffi_ads_client_rust_future_complete_void(uint64_t, RustCallStatus*); + void ffi_ads_client_rust_future_free_void(uint64_t); + void* uniffi_ads_client_fn_clone_mozadsclient(void*, RustCallStatus*); + void uniffi_ads_client_fn_free_mozadsclient(void*, RustCallStatus*); + void* uniffi_ads_client_fn_clone_mozadstelemetry(void*, RustCallStatus*); + void uniffi_ads_client_fn_free_mozadstelemetry(void*, RustCallStatus*); + typedef void (*CallbackInterfaceAdsClientMozAdsTelemetryMethod0)(uint64_t, RustBuffer, RustBuffer, void*, RustCallStatus*); + typedef void (*CallbackInterfaceAdsClientMozAdsTelemetryMethod1)(uint64_t, RustBuffer, RustBuffer, void*, RustCallStatus*); + typedef void (*CallbackInterfaceAdsClientMozAdsTelemetryMethod2)(uint64_t, RustBuffer, void*, RustCallStatus*); + typedef void (*CallbackInterfaceAdsClientMozAdsTelemetryMethod3)(uint64_t, RustBuffer, RustBuffer, void*, RustCallStatus*); + typedef void (*CallbackInterfaceAdsClientMozAdsTelemetryMethod4)(uint64_t, RustBuffer, RustBuffer, void*, RustCallStatus*); + typedef void (*CallbackInterfaceFreeAdsClient_MozAdsTelemetry)(uint64_t); + struct VTableCallbackInterfaceAdsClientMozAdsTelemetry { + CallbackInterfaceAdsClientMozAdsTelemetryMethod0 record_build_cache_error; + CallbackInterfaceAdsClientMozAdsTelemetryMethod1 record_client_error; + CallbackInterfaceAdsClientMozAdsTelemetryMethod2 record_client_operation_total; + CallbackInterfaceAdsClientMozAdsTelemetryMethod3 record_deserialization_error; + CallbackInterfaceAdsClientMozAdsTelemetryMethod4 record_http_cache_outcome; + CallbackInterfaceFreeAdsClient_MozAdsTelemetry uniffi_free; + }; + void uniffi_ads_client_fn_init_callback_vtable_mozadstelemetry(VTableCallbackInterfaceAdsClientMozAdsTelemetry*); + void* uniffi_ads_client_fn_constructor_mozadsclient_new(RustBuffer, RustCallStatus*); + void uniffi_ads_client_fn_method_mozadsclient_clear_cache(void*, RustCallStatus*); + RustBuffer uniffi_ads_client_fn_method_mozadsclient_cycle_context_id(void*, RustCallStatus*); + void uniffi_ads_client_fn_method_mozadsclient_record_click(void*, RustBuffer, RustCallStatus*); + void uniffi_ads_client_fn_method_mozadsclient_record_impression(void*, RustBuffer, RustCallStatus*); + void uniffi_ads_client_fn_method_mozadsclient_report_ad(void*, RustBuffer, RustCallStatus*); + RustBuffer uniffi_ads_client_fn_method_mozadsclient_request_image_ads(void*, RustBuffer, RustBuffer, RustCallStatus*); + RustBuffer uniffi_ads_client_fn_method_mozadsclient_request_spoc_ads(void*, RustBuffer, RustBuffer, RustCallStatus*); + RustBuffer uniffi_ads_client_fn_method_mozadsclient_request_tile_ads(void*, RustBuffer, RustBuffer, RustCallStatus*); + void uniffi_ads_client_fn_method_mozadstelemetry_record_build_cache_error(void*, RustBuffer, RustBuffer, RustCallStatus*); + void uniffi_ads_client_fn_method_mozadstelemetry_record_client_error(void*, RustBuffer, RustBuffer, RustCallStatus*); + void uniffi_ads_client_fn_method_mozadstelemetry_record_client_operation_total(void*, RustBuffer, RustCallStatus*); + void uniffi_ads_client_fn_method_mozadstelemetry_record_deserialization_error(void*, RustBuffer, RustBuffer, RustCallStatus*); + void uniffi_ads_client_fn_method_mozadstelemetry_record_http_cache_outcome(void*, RustBuffer, RustBuffer, RustCallStatus*); + uint32_t ffi_ads_client_uniffi_contract_version(); + uint16_t uniffi_ads_client_checksum_constructor_mozadsclient_new(); + uint16_t uniffi_ads_client_checksum_method_mozadsclient_clear_cache(); + uint16_t uniffi_ads_client_checksum_method_mozadsclient_cycle_context_id(); + uint16_t uniffi_ads_client_checksum_method_mozadsclient_record_click(); + uint16_t uniffi_ads_client_checksum_method_mozadsclient_record_impression(); + uint16_t uniffi_ads_client_checksum_method_mozadsclient_report_ad(); + uint16_t uniffi_ads_client_checksum_method_mozadsclient_request_image_ads(); + uint16_t uniffi_ads_client_checksum_method_mozadsclient_request_spoc_ads(); + uint16_t uniffi_ads_client_checksum_method_mozadsclient_request_tile_ads(); + uint16_t uniffi_ads_client_checksum_method_mozadstelemetry_record_build_cache_error(); + uint16_t uniffi_ads_client_checksum_method_mozadstelemetry_record_client_error(); + uint16_t uniffi_ads_client_checksum_method_mozadstelemetry_record_client_operation_total(); + uint16_t uniffi_ads_client_checksum_method_mozadstelemetry_record_deserialization_error(); + uint16_t uniffi_ads_client_checksum_method_mozadstelemetry_record_http_cache_outcome(); + RustBuffer ffi_context_id_rustbuffer_alloc(uint64_t, RustCallStatus*); + RustBuffer ffi_context_id_rustbuffer_from_bytes(ForeignBytes, RustCallStatus*); + void ffi_context_id_rustbuffer_free(RustBuffer, RustCallStatus*); + RustBuffer ffi_context_id_rustbuffer_reserve(RustBuffer, uint64_t, RustCallStatus*); void ffi_context_id_rust_future_poll_u8(uint64_t, RustFutureContinuationCallback, uint64_t); void ffi_context_id_rust_future_cancel_u8(uint64_t); uint8_t ffi_context_id_rust_future_complete_u8(uint64_t, RustCallStatus*); @@ -434,10 +538,16 @@ extern "C" { RustBuffer uniffi_logins_fn_method_loginstore_get_by_base_domain(void*, RustBuffer, RustCallStatus*); RustBuffer uniffi_logins_fn_method_loginstore_get_checkpoint(void*, RustCallStatus*); int8_t uniffi_logins_fn_method_loginstore_has_logins_by_base_domain(void*, RustBuffer, RustCallStatus*); + int8_t uniffi_logins_fn_method_loginstore_is_breach_alert_dismissed(void*, RustBuffer, RustCallStatus*); int8_t uniffi_logins_fn_method_loginstore_is_empty(void*, RustCallStatus*); + int8_t uniffi_logins_fn_method_loginstore_is_potentially_breached(void*, RustBuffer, RustCallStatus*); RustBuffer uniffi_logins_fn_method_loginstore_list(void*, RustCallStatus*); + void uniffi_logins_fn_method_loginstore_record_breach(void*, RustBuffer, int64_t, RustCallStatus*); + void uniffi_logins_fn_method_loginstore_record_breach_alert_dismissal(void*, RustBuffer, RustCallStatus*); + void uniffi_logins_fn_method_loginstore_record_breach_alert_dismissal_time(void*, RustBuffer, int64_t, RustCallStatus*); void uniffi_logins_fn_method_loginstore_register_with_sync_manager(void*, RustCallStatus*); void uniffi_logins_fn_method_loginstore_reset(void*, RustCallStatus*); + void uniffi_logins_fn_method_loginstore_reset_all_breaches(void*, RustCallStatus*); void uniffi_logins_fn_method_loginstore_run_maintenance(void*, RustCallStatus*); void uniffi_logins_fn_method_loginstore_set_checkpoint(void*, RustBuffer, RustCallStatus*); void uniffi_logins_fn_method_loginstore_shutdown(void*, RustCallStatus*); @@ -479,10 +589,16 @@ extern "C" { uint16_t uniffi_logins_checksum_method_loginstore_get_by_base_domain(); uint16_t uniffi_logins_checksum_method_loginstore_get_checkpoint(); uint16_t uniffi_logins_checksum_method_loginstore_has_logins_by_base_domain(); + uint16_t uniffi_logins_checksum_method_loginstore_is_breach_alert_dismissed(); uint16_t uniffi_logins_checksum_method_loginstore_is_empty(); + uint16_t uniffi_logins_checksum_method_loginstore_is_potentially_breached(); uint16_t uniffi_logins_checksum_method_loginstore_list(); + uint16_t uniffi_logins_checksum_method_loginstore_record_breach(); + uint16_t uniffi_logins_checksum_method_loginstore_record_breach_alert_dismissal(); + uint16_t uniffi_logins_checksum_method_loginstore_record_breach_alert_dismissal_time(); uint16_t uniffi_logins_checksum_method_loginstore_register_with_sync_manager(); uint16_t uniffi_logins_checksum_method_loginstore_reset(); + uint16_t uniffi_logins_checksum_method_loginstore_reset_all_breaches(); uint16_t uniffi_logins_checksum_method_loginstore_run_maintenance(); uint16_t uniffi_logins_checksum_method_loginstore_set_checkpoint(); uint16_t uniffi_logins_checksum_method_loginstore_shutdown(); @@ -1712,6 +1828,204 @@ extern "C" { // Define pointer types +const static mozilla::uniffi::UniFFIPointerType kAdsClientMozAdsTelemetryPointerType { + "ads_client::MozAdsTelemetry"_ns, + uniffi_ads_client_fn_clone_mozadstelemetry, + uniffi_ads_client_fn_free_mozadstelemetry, +}; +// Forward declare the free function, which is defined later on in `CallbackInterfaces.cpp` +extern "C" void callback_free_ads_client_moz_ads_telemetry(uint64_t uniffiHandle); + +// Trait interface FFI value class. This is a hybrid between the one for interfaces and callback +// interface version +class FfiValueObjectHandleAdsClientMozAdsTelemetry { + private: + // Did we lower a callback interface, rather than lift an object interface? + // This is weird, but it's a needed work until something like + // https://github.com/mozilla/uniffi-rs/pull/1823 lands. + bool mLoweredCallbackInterface = false; + // The raw FFI value is a pointer. + // For callback interfaces, the uint64_t handle gets casted to a pointer. Callback interface + // handles are incremented by one at a time, so even on a 32-bit system this + // shouldn't overflow. + void* mValue = nullptr; + + public: + FfiValueObjectHandleAdsClientMozAdsTelemetry() = default; + explicit FfiValueObjectHandleAdsClientMozAdsTelemetry(void* aValue) : mValue(aValue) {} + + // Delete copy constructor and assignment as this type is non-copyable. + FfiValueObjectHandleAdsClientMozAdsTelemetry(const FfiValueObjectHandleAdsClientMozAdsTelemetry&) = delete; + FfiValueObjectHandleAdsClientMozAdsTelemetry& operator=(const FfiValueObjectHandleAdsClientMozAdsTelemetry&) = delete; + + FfiValueObjectHandleAdsClientMozAdsTelemetry& operator=(FfiValueObjectHandleAdsClientMozAdsTelemetry&& aOther) { + FreeHandle(); + mValue = aOther.mValue; + mLoweredCallbackInterface = aOther.mLoweredCallbackInterface; + aOther.mValue = nullptr; + aOther.mLoweredCallbackInterface = false; + return *this; + } + + // Lower treats `aValue` as a callback interface + void Lower(const dom::OwningUniFFIScaffoldingValue& aValue, + ErrorResult& aError) { + if (!aValue.IsDouble()) { + aError.ThrowTypeError("Bad argument type"_ns); + return; + } + double floatValue = aValue.GetAsDouble(); + uint64_t intValue = static_cast(floatValue); + if (intValue != floatValue) { + aError.ThrowTypeError("Not an integer"_ns); + return; + } + FreeHandle(); + mValue = reinterpret_cast(intValue); + mLoweredCallbackInterface = true; + } + + // LowerReceiver is used for method receivers. It treats `aValue` as an object pointer. + void LowerReciever(const dom::OwningUniFFIScaffoldingValue& aValue, + ErrorResult& aError) { + if (!aValue.IsUniFFIPointer()) { + aError.ThrowTypeError("Expected UniFFI pointer argument"_ns); + return; + } + dom::UniFFIPointer& value = aValue.GetAsUniFFIPointer(); + if (!value.IsSamePtrType(&kAdsClientMozAdsTelemetryPointerType)) { + aError.ThrowTypeError("Incorrect UniFFI pointer type"_ns); + return; + } + FreeHandle(); + mValue = value.ClonePtr(); + mLoweredCallbackInterface = false; + } + + // Lift treats `aDest` as a regular interface + void Lift(JSContext* aContext, dom::OwningUniFFIScaffoldingValue* aDest, + ErrorResult& aError) { + aDest->SetAsUniFFIPointer() = + dom::UniFFIPointer::Create(mValue, &kAdsClientMozAdsTelemetryPointerType); + mValue = nullptr; + mLoweredCallbackInterface = false; + } + + void* IntoRust() { + auto temp = mValue; + mValue = nullptr; + mLoweredCallbackInterface = false; + return temp; + } + + static FfiValueObjectHandleAdsClientMozAdsTelemetry FromRust(void* aValue) { + return FfiValueObjectHandleAdsClientMozAdsTelemetry(aValue); + } + + void FreeHandle() { + // This behavior depends on if we lowered a callback interface handle or lifted an interface + // pointer. + if (mLoweredCallbackInterface && reinterpret_cast(mValue) != 0) { + printf("FREEING CB %p\n", mValue); + callback_free_ads_client_moz_ads_telemetry(reinterpret_cast(mValue)); + mValue = reinterpret_cast(0); + } else if (!mLoweredCallbackInterface && mValue != nullptr) { + printf("FREEING interface %p\n", mValue); + RustCallStatus callStatus{}; + (uniffi_ads_client_fn_free_mozadstelemetry)(mValue, &callStatus); + // No need to check `RustCallStatus`, it's only part of the API to match + // other FFI calls. The free function can never fail. + } + mValue = nullptr; + mLoweredCallbackInterface = false; + } + + ~FfiValueObjectHandleAdsClientMozAdsTelemetry() { + // If the pointer is non-null, this means Lift/IntoRust was never called + // because there was some failure along the way. Free the pointer to avoid a + // leak + FreeHandle(); + } +}; +const static mozilla::uniffi::UniFFIPointerType kAdsClientMozAdsClientPointerType { + "ads_client::MozAdsClient"_ns, + uniffi_ads_client_fn_clone_mozadsclient, + uniffi_ads_client_fn_free_mozadsclient, +}; +class FfiValueObjectHandleAdsClientMozAdsClient { + private: + void* mValue = nullptr; + + public: + FfiValueObjectHandleAdsClientMozAdsClient() = default; + explicit FfiValueObjectHandleAdsClientMozAdsClient(void* aValue) : mValue(aValue) {} + + // Delete copy constructor and assignment as this type is non-copyable. + FfiValueObjectHandleAdsClientMozAdsClient(const FfiValueObjectHandleAdsClientMozAdsClient&) = delete; + FfiValueObjectHandleAdsClientMozAdsClient& operator=(const FfiValueObjectHandleAdsClientMozAdsClient&) = delete; + + FfiValueObjectHandleAdsClientMozAdsClient& operator=(FfiValueObjectHandleAdsClientMozAdsClient&& aOther) { + FreeHandle(); + mValue = aOther.mValue; + aOther.mValue = nullptr; + return *this; + } + + void Lower(const dom::OwningUniFFIScaffoldingValue& aValue, + ErrorResult& aError) { + if (!aValue.IsUniFFIPointer()) { + aError.ThrowTypeError("Expected UniFFI pointer argument"_ns); + return; + } + dom::UniFFIPointer& value = aValue.GetAsUniFFIPointer(); + if (!value.IsSamePtrType(&kAdsClientMozAdsClientPointerType)) { + aError.ThrowTypeError("Incorrect UniFFI pointer type"_ns); + return; + } + FreeHandle(); + mValue = value.ClonePtr(); + } + + // LowerReceiver is used for method receivers. For non-trait interfaces, it works exactly the + // same as `Lower` + void LowerReciever(const dom::OwningUniFFIScaffoldingValue& aValue, + ErrorResult& aError) { + Lower(aValue, aError); + } + + void Lift(JSContext* aContext, dom::OwningUniFFIScaffoldingValue* aDest, + ErrorResult& aError) { + aDest->SetAsUniFFIPointer() = + dom::UniFFIPointer::Create(mValue, &kAdsClientMozAdsClientPointerType); + mValue = nullptr; + } + + void* IntoRust() { + auto temp = mValue; + mValue = nullptr; + return temp; + } + + static FfiValueObjectHandleAdsClientMozAdsClient FromRust(void* aValue) { + return FfiValueObjectHandleAdsClientMozAdsClient(aValue); + } + + void FreeHandle() { + if (mValue) { + RustCallStatus callStatus{}; + (uniffi_ads_client_fn_free_mozadsclient)(mValue, &callStatus); + // No need to check `RustCallStatus`, it's only part of the API to match + // other FFI calls. The free function can never fail. + } + } + + ~FfiValueObjectHandleAdsClientMozAdsClient() { + // If the pointer is non-null, this means Lift/IntoRust was never called + // because there was some failure along the way. Free the pointer to avoid a + // leak + FreeHandle(); + } +}; const static mozilla::uniffi::UniFFIPointerType kContextIdContextIdComponentPointerType { "context_id::ContextIDComponent"_ns, uniffi_context_id_fn_clone_contextidcomponent, @@ -4094,112 +4408,120 @@ Maybe> ReadPointer(const GlobalObject& aGlobal, switch (aId) { case 1: { - type = &kContextIdContextIdComponentPointerType; + type = &kAdsClientMozAdsTelemetryPointerType; break; } case 2: { - type = &kFilterAdultFilterAdultComponentPointerType; + type = &kAdsClientMozAdsClientPointerType; break; } case 3: { - type = &kLoginsEncryptorDecryptorPointerType; + type = &kContextIdContextIdComponentPointerType; break; } case 4: { - type = &kLoginsKeyManagerPointerType; + type = &kFilterAdultFilterAdultComponentPointerType; break; } case 5: { - type = &kLoginsLoginStorePointerType; + type = &kLoginsEncryptorDecryptorPointerType; break; } case 6: { - type = &kLoginsManagedEncryptorDecryptorPointerType; + type = &kLoginsKeyManagerPointerType; break; } case 7: { - type = &kLoginsNssKeyManagerPointerType; + type = &kLoginsLoginStorePointerType; break; } case 8: { - type = &kLoginsPrimaryPasswordAuthenticatorPointerType; + type = &kLoginsManagedEncryptorDecryptorPointerType; break; } case 9: { - type = &kLoginsStaticKeyManagerPointerType; + type = &kLoginsNssKeyManagerPointerType; break; } case 10: { - type = &kRelevancyRelevancyStorePointerType; + type = &kLoginsPrimaryPasswordAuthenticatorPointerType; break; } case 11: { - type = &kRemoteSettingsRemoteSettingsPointerType; + type = &kLoginsStaticKeyManagerPointerType; break; } case 12: { - type = &kRemoteSettingsRemoteSettingsClientPointerType; + type = &kRelevancyRelevancyStorePointerType; break; } case 13: { - type = &kRemoteSettingsRemoteSettingsServicePointerType; + type = &kRemoteSettingsRemoteSettingsPointerType; break; } case 14: { - type = &kSearchSearchEngineSelectorPointerType; + type = &kRemoteSettingsRemoteSettingsClientPointerType; break; } case 15: { - type = &kSuggestSuggestStorePointerType; + type = &kRemoteSettingsRemoteSettingsServicePointerType; break; } case 16: { - type = &kSuggestSuggestStoreBuilderPointerType; + type = &kSearchSearchEngineSelectorPointerType; break; } case 17: { - type = &kTabsRemoteCommandStorePointerType; + type = &kSuggestSuggestStorePointerType; break; } case 18: { - type = &kTabsTabsBridgedEnginePointerType; + type = &kSuggestSuggestStoreBuilderPointerType; break; } case 19: { - type = &kTabsTabsStorePointerType; + type = &kTabsRemoteCommandStorePointerType; break; } case 20: { - type = &kViaductBackendPointerType; + type = &kTabsTabsBridgedEnginePointerType; break; } case 21: { - type = &kWebextstorageWebExtStorageBridgedEnginePointerType; + type = &kTabsTabsStorePointerType; break; } case 22: { + type = &kViaductBackendPointerType; + break; + } + case 23: { + type = &kWebextstorageWebExtStorageBridgedEnginePointerType; + break; + } + case 24: { type = &kWebextstorageWebExtStorageStorePointerType; break; } #ifdef MOZ_UNIFFI_FIXTURES - case 23: { + case 25: { type = &kUniffiBindingsTestsTestInterfacePointerType; break; } - case 24: { + case 26: { type = &kUniffiBindingsTestsAsyncInterfacePointerType; break; } - case 25: { + case 27: { type = &kUniffiBindingsTestsAsyncTestTraitInterfacePointerType; break; } - case 26: { + case 28: { type = &kUniffiBindingsTestsComplexMethodsPointerType; break; } - case 27: { + case 29: { type = &kUniffiBindingsTestsTestTraitInterfacePointerType; break; } @@ -4215,112 +4537,120 @@ bool WritePointer(const GlobalObject& aGlobal, uint64_t aId, const UniFFIPointer switch (aId) { case 1: { - type = &kContextIdContextIdComponentPointerType; + type = &kAdsClientMozAdsTelemetryPointerType; break; } case 2: { - type = &kFilterAdultFilterAdultComponentPointerType; + type = &kAdsClientMozAdsClientPointerType; break; } case 3: { - type = &kLoginsEncryptorDecryptorPointerType; + type = &kContextIdContextIdComponentPointerType; break; } case 4: { - type = &kLoginsKeyManagerPointerType; + type = &kFilterAdultFilterAdultComponentPointerType; break; } case 5: { - type = &kLoginsLoginStorePointerType; + type = &kLoginsEncryptorDecryptorPointerType; break; } case 6: { - type = &kLoginsManagedEncryptorDecryptorPointerType; + type = &kLoginsKeyManagerPointerType; break; } case 7: { - type = &kLoginsNssKeyManagerPointerType; + type = &kLoginsLoginStorePointerType; break; } case 8: { - type = &kLoginsPrimaryPasswordAuthenticatorPointerType; + type = &kLoginsManagedEncryptorDecryptorPointerType; break; } case 9: { - type = &kLoginsStaticKeyManagerPointerType; + type = &kLoginsNssKeyManagerPointerType; break; } case 10: { - type = &kRelevancyRelevancyStorePointerType; + type = &kLoginsPrimaryPasswordAuthenticatorPointerType; break; } case 11: { - type = &kRemoteSettingsRemoteSettingsPointerType; + type = &kLoginsStaticKeyManagerPointerType; break; } case 12: { - type = &kRemoteSettingsRemoteSettingsClientPointerType; + type = &kRelevancyRelevancyStorePointerType; break; } case 13: { - type = &kRemoteSettingsRemoteSettingsServicePointerType; + type = &kRemoteSettingsRemoteSettingsPointerType; break; } case 14: { - type = &kSearchSearchEngineSelectorPointerType; + type = &kRemoteSettingsRemoteSettingsClientPointerType; break; } case 15: { - type = &kSuggestSuggestStorePointerType; + type = &kRemoteSettingsRemoteSettingsServicePointerType; break; } case 16: { - type = &kSuggestSuggestStoreBuilderPointerType; + type = &kSearchSearchEngineSelectorPointerType; break; } case 17: { - type = &kTabsRemoteCommandStorePointerType; + type = &kSuggestSuggestStorePointerType; break; } case 18: { - type = &kTabsTabsBridgedEnginePointerType; + type = &kSuggestSuggestStoreBuilderPointerType; break; } case 19: { - type = &kTabsTabsStorePointerType; + type = &kTabsRemoteCommandStorePointerType; break; } case 20: { - type = &kViaductBackendPointerType; + type = &kTabsTabsBridgedEnginePointerType; break; } case 21: { - type = &kWebextstorageWebExtStorageBridgedEnginePointerType; + type = &kTabsTabsStorePointerType; break; } case 22: { + type = &kViaductBackendPointerType; + break; + } + case 23: { + type = &kWebextstorageWebExtStorageBridgedEnginePointerType; + break; + } + case 24: { type = &kWebextstorageWebExtStorageStorePointerType; break; } #ifdef MOZ_UNIFFI_FIXTURES - case 23: { + case 25: { type = &kUniffiBindingsTestsTestInterfacePointerType; break; } - case 24: { + case 26: { type = &kUniffiBindingsTestsAsyncInterfacePointerType; break; } - case 25: { + case 27: { type = &kUniffiBindingsTestsAsyncTestTraitInterfacePointerType; break; } - case 26: { + case 28: { type = &kUniffiBindingsTestsComplexMethodsPointerType; break; } - case 27: { + case 29: { type = &kUniffiBindingsTestsTestTraitInterfacePointerType; break; } @@ -4676,83 +5006,81 @@ class FfiValueCallbackInterfaceuniffi_bindings_tests_collision_TestCallbackInter // Define scaffolding call classes for each combination of return/argument types -class ScaffoldingCallHandlerUniffiContextIdFnConstructorContextidcomponentNew : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiAdsClientFnMethodMozadstelemetryRecordBuildCacheError : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueRustBuffer mInitContextId{}; - FfiValueInt mCreationTimestampS{}; - FfiValueInt mRunningInTestAutomation{}; - FfiValueCallbackInterfacecontext_id_ContextIdCallback mCallback{}; + FfiValueObjectHandleAdsClientMozAdsTelemetry mUniffiPtr{}; + FfiValueRustBuffer mLabel{}; + FfiValueRustBuffer mValue{}; // MakeRustCall stores the result of the call in these fields - FfiValueObjectHandleContextIdContextIdComponent mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 4) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_context_id_fn_constructor_contextidcomponent_new (expected: 4, actual: %zu)", aArgs.Length())); - return; - } - mInitContextId.Lower(aArgs[0], aError); - if (aError.Failed()) { + if (aArgs.Length() < 3) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_ads_client_fn_method_mozadstelemetry_record_build_cache_error (expected: 3, actual: %zu)", aArgs.Length())); return; } - mCreationTimestampS.Lower(aArgs[1], aError); + mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } - mRunningInTestAutomation.Lower(aArgs[2], aError); + mLabel.Lower(aArgs[1], aError); if (aError.Failed()) { return; } - mCallback.Lower(aArgs[3], aError); + mValue.Lower(aArgs[2], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueObjectHandleContextIdContextIdComponent::FromRust( - uniffi_context_id_fn_constructor_contextidcomponent_new( - mInitContextId.IntoRust(), - mCreationTimestampS.IntoRust(), - mRunningInTestAutomation.IntoRust(), - mCallback.IntoRust(), - aOutStatus - ) + uniffi_ads_client_fn_method_mozadstelemetry_record_build_cache_error( + mUniffiPtr.IntoRust(), + mLabel.IntoRust(), + mValue.IntoRust(), + aOutStatus ); } virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { - mUniffiReturnValue.Lift( - aCx, - &aDest.Construct(), - aError - ); } }; -class ScaffoldingCallHandlerUniffiContextIdFnMethodContextidcomponentForceRotation : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiAdsClientFnMethodMozadstelemetryRecordClientError : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleContextIdContextIdComponent mUniffiPtr{}; + FfiValueObjectHandleAdsClientMozAdsTelemetry mUniffiPtr{}; + FfiValueRustBuffer mLabel{}; + FfiValueRustBuffer mValue{}; // MakeRustCall stores the result of the call in these fields public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_context_id_fn_method_contextidcomponent_force_rotation (expected: 1, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 3) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_ads_client_fn_method_mozadstelemetry_record_client_error (expected: 3, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } + mLabel.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + mValue.Lower(aArgs[2], aError); + if (aError.Failed()) { + return; + } } void MakeRustCall(RustCallStatus* aOutStatus) override { - uniffi_context_id_fn_method_contextidcomponent_force_rotation( + uniffi_ads_client_fn_method_mozadstelemetry_record_client_error( mUniffiPtr.IntoRust(), + mLabel.IntoRust(), + mValue.IntoRust(), aOutStatus ); } @@ -4760,71 +5088,75 @@ class ScaffoldingCallHandlerUniffiContextIdFnMethodContextidcomponentForceRotati virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { } }; -class ScaffoldingCallHandlerUniffiContextIdFnMethodContextidcomponentRequest : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiAdsClientFnMethodMozadstelemetryRecordClientOperationTotal : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleContextIdContextIdComponent mUniffiPtr{}; - FfiValueInt mRotationDaysInS{}; + FfiValueObjectHandleAdsClientMozAdsTelemetry mUniffiPtr{}; + FfiValueRustBuffer mLabel{}; // MakeRustCall stores the result of the call in these fields - FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_context_id_fn_method_contextidcomponent_request (expected: 2, actual: %zu)", aArgs.Length())); + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_ads_client_fn_method_mozadstelemetry_record_client_operation_total (expected: 2, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } - mRotationDaysInS.Lower(aArgs[1], aError); + mLabel.Lower(aArgs[1], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_context_id_fn_method_contextidcomponent_request( - mUniffiPtr.IntoRust(), - mRotationDaysInS.IntoRust(), - aOutStatus - ) + uniffi_ads_client_fn_method_mozadstelemetry_record_client_operation_total( + mUniffiPtr.IntoRust(), + mLabel.IntoRust(), + aOutStatus ); } virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { - mUniffiReturnValue.Lift( - aCx, - &aDest.Construct(), - aError - ); } }; -class ScaffoldingCallHandlerUniffiContextIdFnMethodContextidcomponentUnsetCallback : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiAdsClientFnMethodMozadstelemetryRecordDeserializationError : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleContextIdContextIdComponent mUniffiPtr{}; + FfiValueObjectHandleAdsClientMozAdsTelemetry mUniffiPtr{}; + FfiValueRustBuffer mLabel{}; + FfiValueRustBuffer mValue{}; // MakeRustCall stores the result of the call in these fields public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_context_id_fn_method_contextidcomponent_unset_callback (expected: 1, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 3) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_ads_client_fn_method_mozadstelemetry_record_deserialization_error (expected: 3, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } + mLabel.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + mValue.Lower(aArgs[2], aError); + if (aError.Failed()) { + return; + } } void MakeRustCall(RustCallStatus* aOutStatus) override { - uniffi_context_id_fn_method_contextidcomponent_unset_callback( + uniffi_ads_client_fn_method_mozadstelemetry_record_deserialization_error( mUniffiPtr.IntoRust(), + mLabel.IntoRust(), + mValue.IntoRust(), aOutStatus ); } @@ -4832,63 +5164,71 @@ class ScaffoldingCallHandlerUniffiContextIdFnMethodContextidcomponentUnsetCallba virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { } }; -class ScaffoldingCallHandlerUniffiFilterAdultFnConstructorFilteradultcomponentNew : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiAdsClientFnMethodMozadstelemetryRecordHttpCacheOutcome : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleAdsClientMozAdsTelemetry mUniffiPtr{}; + FfiValueRustBuffer mLabel{}; + FfiValueRustBuffer mValue{}; // MakeRustCall stores the result of the call in these fields - FfiValueObjectHandleFilterAdultFilterAdultComponent mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 3) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_ads_client_fn_method_mozadstelemetry_record_http_cache_outcome (expected: 3, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + mLabel.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + mValue.Lower(aArgs[2], aError); + if (aError.Failed()) { + return; + } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueObjectHandleFilterAdultFilterAdultComponent::FromRust( - uniffi_filter_adult_fn_constructor_filteradultcomponent_new( - aOutStatus - ) + uniffi_ads_client_fn_method_mozadstelemetry_record_http_cache_outcome( + mUniffiPtr.IntoRust(), + mLabel.IntoRust(), + mValue.IntoRust(), + aOutStatus ); } virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { - mUniffiReturnValue.Lift( - aCx, - &aDest.Construct(), - aError - ); } }; -class ScaffoldingCallHandlerUniffiFilterAdultFnMethodFilteradultcomponentContains : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiAdsClientFnConstructorMozadsclientNew : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleFilterAdultFilterAdultComponent mUniffiPtr{}; - FfiValueRustBuffer mBaseDomainToCheck{}; + FfiValueRustBuffer mClientConfig{}; // MakeRustCall stores the result of the call in these fields - FfiValueInt mUniffiReturnValue{}; + FfiValueObjectHandleAdsClientMozAdsClient mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_filter_adult_fn_method_filteradultcomponent_contains (expected: 2, actual: %zu)", aArgs.Length())); - return; - } - mUniffiPtr.LowerReciever(aArgs[0], aError); - if (aError.Failed()) { + if (aArgs.Length() < 1) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_ads_client_fn_constructor_mozadsclient_new (expected: 1, actual: %zu)", aArgs.Length())); return; } - mBaseDomainToCheck.Lower(aArgs[1], aError); + mClientConfig.Lower(aArgs[0], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueInt::FromRust( - uniffi_filter_adult_fn_method_filteradultcomponent_contains( - mUniffiPtr.IntoRust(), - mBaseDomainToCheck.IntoRust(), + mUniffiReturnValue = FfiValueObjectHandleAdsClientMozAdsClient::FromRust( + uniffi_ads_client_fn_constructor_mozadsclient_new( + mClientConfig.IntoRust(), aOutStatus ) ); @@ -4902,28 +5242,28 @@ class ScaffoldingCallHandlerUniffiFilterAdultFnMethodFilteradultcomponentContain ); } }; -class ScaffoldingCallHandlerUniffiInitRustComponentsFnFuncInitialize : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiAdsClientFnMethodMozadsclientClearCache : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueRustBuffer mProfilePath{}; + FfiValueObjectHandleAdsClientMozAdsClient mUniffiPtr{}; // MakeRustCall stores the result of the call in these fields public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_init_rust_components_fn_func_initialize (expected: 1, actual: %zu)", aArgs.Length())); + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_ads_client_fn_method_mozadsclient_clear_cache (expected: 1, actual: %zu)", aArgs.Length())); return; } - mProfilePath.Lower(aArgs[0], aError); + mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - uniffi_init_rust_components_fn_func_initialize( - mProfilePath.IntoRust(), + uniffi_ads_client_fn_method_mozadsclient_clear_cache( + mUniffiPtr.IntoRust(), aOutStatus ); } @@ -4931,42 +5271,30 @@ class ScaffoldingCallHandlerUniffiInitRustComponentsFnFuncInitialize : public Un virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { } }; -class ScaffoldingCallHandlerUniffiLoginsFnFuncCheckCanary : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiAdsClientFnMethodMozadsclientCycleContextId : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueRustBuffer mCanary{}; - FfiValueRustBuffer mText{}; - FfiValueRustBuffer mEncryptionKey{}; + FfiValueObjectHandleAdsClientMozAdsClient mUniffiPtr{}; // MakeRustCall stores the result of the call in these fields - FfiValueInt mUniffiReturnValue{}; + FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 3) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_func_check_canary (expected: 3, actual: %zu)", aArgs.Length())); - return; - } - mCanary.Lower(aArgs[0], aError); - if (aError.Failed()) { - return; - } - mText.Lower(aArgs[1], aError); - if (aError.Failed()) { + if (aArgs.Length() < 1) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_ads_client_fn_method_mozadsclient_cycle_context_id (expected: 1, actual: %zu)", aArgs.Length())); return; } - mEncryptionKey.Lower(aArgs[2], aError); + mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueInt::FromRust( - uniffi_logins_fn_func_check_canary( - mCanary.IntoRust(), - mText.IntoRust(), - mEncryptionKey.IntoRust(), + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_ads_client_fn_method_mozadsclient_cycle_context_id( + mUniffiPtr.IntoRust(), aOutStatus ) ); @@ -4980,149 +5308,147 @@ class ScaffoldingCallHandlerUniffiLoginsFnFuncCheckCanary : public UniffiSyncCal ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnFuncCreateCanary : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiAdsClientFnMethodMozadsclientRecordClick : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueRustBuffer mText{}; - FfiValueRustBuffer mEncryptionKey{}; + FfiValueObjectHandleAdsClientMozAdsClient mUniffiPtr{}; + FfiValueRustBuffer mClickUrl{}; // MakeRustCall stores the result of the call in these fields - FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_func_create_canary (expected: 2, actual: %zu)", aArgs.Length())); + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_ads_client_fn_method_mozadsclient_record_click (expected: 2, actual: %zu)", aArgs.Length())); return; } - mText.Lower(aArgs[0], aError); + mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } - mEncryptionKey.Lower(aArgs[1], aError); + mClickUrl.Lower(aArgs[1], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_func_create_canary( - mText.IntoRust(), - mEncryptionKey.IntoRust(), - aOutStatus - ) + uniffi_ads_client_fn_method_mozadsclient_record_click( + mUniffiPtr.IntoRust(), + mClickUrl.IntoRust(), + aOutStatus ); } virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { - mUniffiReturnValue.Lift( - aCx, - &aDest.Construct(), - aError - ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnFuncCreateKey : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiAdsClientFnMethodMozadsclientRecordImpression : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleAdsClientMozAdsClient mUniffiPtr{}; + FfiValueRustBuffer mImpressionUrl{}; // MakeRustCall stores the result of the call in these fields - FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_ads_client_fn_method_mozadsclient_record_impression (expected: 2, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + mImpressionUrl.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_func_create_key( - aOutStatus - ) + uniffi_ads_client_fn_method_mozadsclient_record_impression( + mUniffiPtr.IntoRust(), + mImpressionUrl.IntoRust(), + aOutStatus ); } virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { - mUniffiReturnValue.Lift( - aCx, - &aDest.Construct(), - aError - ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnFuncCreateLoginStoreWithNssKeymanager : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiAdsClientFnMethodMozadsclientReportAd : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueRustBuffer mPath{}; - FfiValueObjectHandleLoginsPrimaryPasswordAuthenticator mPrimaryPasswordAuthenticator{}; + FfiValueObjectHandleAdsClientMozAdsClient mUniffiPtr{}; + FfiValueRustBuffer mReportUrl{}; // MakeRustCall stores the result of the call in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_func_create_login_store_with_nss_keymanager (expected: 2, actual: %zu)", aArgs.Length())); + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_ads_client_fn_method_mozadsclient_report_ad (expected: 2, actual: %zu)", aArgs.Length())); return; } - mPath.Lower(aArgs[0], aError); + mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } - mPrimaryPasswordAuthenticator.Lower(aArgs[1], aError); + mReportUrl.Lower(aArgs[1], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueObjectHandleLoginsLoginStore::FromRust( - uniffi_logins_fn_func_create_login_store_with_nss_keymanager( - mPath.IntoRust(), - mPrimaryPasswordAuthenticator.IntoRust(), - aOutStatus - ) + uniffi_ads_client_fn_method_mozadsclient_report_ad( + mUniffiPtr.IntoRust(), + mReportUrl.IntoRust(), + aOutStatus ); } virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { - mUniffiReturnValue.Lift( - aCx, - &aDest.Construct(), - aError - ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnFuncCreateLoginStoreWithStaticKeyManager : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiAdsClientFnMethodMozadsclientRequestImageAds : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueRustBuffer mPath{}; - FfiValueRustBuffer mKey{}; + FfiValueObjectHandleAdsClientMozAdsClient mUniffiPtr{}; + FfiValueRustBuffer mMozAdRequests{}; + FfiValueRustBuffer mOptions{}; // MakeRustCall stores the result of the call in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiReturnValue{}; + FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_func_create_login_store_with_static_key_manager (expected: 2, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 3) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_ads_client_fn_method_mozadsclient_request_image_ads (expected: 3, actual: %zu)", aArgs.Length())); return; } - mPath.Lower(aArgs[0], aError); + mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } - mKey.Lower(aArgs[1], aError); + mMozAdRequests.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + mOptions.Lower(aArgs[2], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueObjectHandleLoginsLoginStore::FromRust( - uniffi_logins_fn_func_create_login_store_with_static_key_manager( - mPath.IntoRust(), - mKey.IntoRust(), + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_ads_client_fn_method_mozadsclient_request_image_ads( + mUniffiPtr.IntoRust(), + mMozAdRequests.IntoRust(), + mOptions.IntoRust(), aOutStatus ) ); @@ -5136,67 +5462,42 @@ class ScaffoldingCallHandlerUniffiLoginsFnFuncCreateLoginStoreWithStaticKeyManag ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnFuncCreateManagedEncdec : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiAdsClientFnMethodMozadsclientRequestSpocAds : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsKeyManager mKeyManager{}; + FfiValueObjectHandleAdsClientMozAdsClient mUniffiPtr{}; + FfiValueRustBuffer mMozAdRequests{}; + FfiValueRustBuffer mOptions{}; // MakeRustCall stores the result of the call in these fields - FfiValueObjectHandleLoginsEncryptorDecryptor mUniffiReturnValue{}; + FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_func_create_managed_encdec (expected: 1, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 3) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_ads_client_fn_method_mozadsclient_request_spoc_ads (expected: 3, actual: %zu)", aArgs.Length())); return; } - mKeyManager.Lower(aArgs[0], aError); + mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } - } - - void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueObjectHandleLoginsEncryptorDecryptor::FromRust( - uniffi_logins_fn_func_create_managed_encdec( - mKeyManager.IntoRust(), - aOutStatus - ) - ); - } - - virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { - mUniffiReturnValue.Lift( - aCx, - &aDest.Construct(), - aError - ); - } -}; -class ScaffoldingCallHandlerUniffiLoginsFnFuncCreateStaticKeyManager : public UniffiSyncCallHandler { -private: - // LowerRustArgs stores the resulting arguments in these fields - FfiValueRustBuffer mKey{}; - - // MakeRustCall stores the result of the call in these fields - FfiValueObjectHandleLoginsKeyManager mUniffiReturnValue{}; - -public: - void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_func_create_static_key_manager (expected: 1, actual: %zu)", aArgs.Length())); + mMozAdRequests.Lower(aArgs[1], aError); + if (aError.Failed()) { return; } - mKey.Lower(aArgs[0], aError); + mOptions.Lower(aArgs[2], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueObjectHandleLoginsKeyManager::FromRust( - uniffi_logins_fn_func_create_static_key_manager( - mKey.IntoRust(), + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_ads_client_fn_method_mozadsclient_request_spoc_ads( + mUniffiPtr.IntoRust(), + mMozAdRequests.IntoRust(), + mOptions.IntoRust(), aOutStatus ) ); @@ -5210,26 +5511,31 @@ class ScaffoldingCallHandlerUniffiLoginsFnFuncCreateStaticKeyManager : public Un ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodEncryptordecryptorDecrypt : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiAdsClientFnMethodMozadsclientRequestTileAds : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsEncryptorDecryptor mUniffiPtr{}; - FfiValueRustBuffer mCiphertext{}; + FfiValueObjectHandleAdsClientMozAdsClient mUniffiPtr{}; + FfiValueRustBuffer mMozAdRequests{}; + FfiValueRustBuffer mOptions{}; // MakeRustCall stores the result of the call in these fields FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_encryptordecryptor_decrypt (expected: 2, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 3) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_ads_client_fn_method_mozadsclient_request_tile_ads (expected: 3, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } - mCiphertext.Lower(aArgs[1], aError); + mMozAdRequests.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + mOptions.Lower(aArgs[2], aError); if (aError.Failed()) { return; } @@ -5237,9 +5543,10 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodEncryptordecryptorDecrypt : publ void MakeRustCall(RustCallStatus* aOutStatus) override { mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_method_encryptordecryptor_decrypt( + uniffi_ads_client_fn_method_mozadsclient_request_tile_ads( mUniffiPtr.IntoRust(), - mCiphertext.IntoRust(), + mMozAdRequests.IntoRust(), + mOptions.IntoRust(), aOutStatus ) ); @@ -5253,36 +5560,48 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodEncryptordecryptorDecrypt : publ ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodEncryptordecryptorEncrypt : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiContextIdFnConstructorContextidcomponentNew : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsEncryptorDecryptor mUniffiPtr{}; - FfiValueRustBuffer mCleartext{}; + FfiValueRustBuffer mInitContextId{}; + FfiValueInt mCreationTimestampS{}; + FfiValueInt mRunningInTestAutomation{}; + FfiValueCallbackInterfacecontext_id_ContextIdCallback mCallback{}; // MakeRustCall stores the result of the call in these fields - FfiValueRustBuffer mUniffiReturnValue{}; + FfiValueObjectHandleContextIdContextIdComponent mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_encryptordecryptor_encrypt (expected: 2, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 4) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_context_id_fn_constructor_contextidcomponent_new (expected: 4, actual: %zu)", aArgs.Length())); return; } - mUniffiPtr.LowerReciever(aArgs[0], aError); + mInitContextId.Lower(aArgs[0], aError); if (aError.Failed()) { return; } - mCleartext.Lower(aArgs[1], aError); + mCreationTimestampS.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + mRunningInTestAutomation.Lower(aArgs[2], aError); + if (aError.Failed()) { + return; + } + mCallback.Lower(aArgs[3], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_method_encryptordecryptor_encrypt( - mUniffiPtr.IntoRust(), - mCleartext.IntoRust(), + mUniffiReturnValue = FfiValueObjectHandleContextIdContextIdComponent::FromRust( + uniffi_context_id_fn_constructor_contextidcomponent_new( + mInitContextId.IntoRust(), + mCreationTimestampS.IntoRust(), + mRunningInTestAutomation.IntoRust(), + mCallback.IntoRust(), aOutStatus ) ); @@ -5296,18 +5615,17 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodEncryptordecryptorEncrypt : publ ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodKeymanagerGetKey : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiContextIdFnMethodContextidcomponentForceRotation : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsKeyManager mUniffiPtr{}; + FfiValueObjectHandleContextIdContextIdComponent mUniffiPtr{}; // MakeRustCall stores the result of the call in these fields - FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_keymanager_get_key (expected: 1, actual: %zu)", aArgs.Length())); + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_context_id_fn_method_contextidcomponent_force_rotation (expected: 1, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); @@ -5317,52 +5635,45 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodKeymanagerGetKey : public Uniffi } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_method_keymanager_get_key( - mUniffiPtr.IntoRust(), - aOutStatus - ) + uniffi_context_id_fn_method_contextidcomponent_force_rotation( + mUniffiPtr.IntoRust(), + aOutStatus ); } virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { - mUniffiReturnValue.Lift( - aCx, - &aDest.Construct(), - aError - ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnConstructorLoginstoreNew : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiContextIdFnMethodContextidcomponentRequest : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueRustBuffer mPath{}; - FfiValueObjectHandleLoginsEncryptorDecryptor mEncdec{}; + FfiValueObjectHandleContextIdContextIdComponent mUniffiPtr{}; + FfiValueInt mRotationDaysInS{}; // MakeRustCall stores the result of the call in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiReturnValue{}; + FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_constructor_loginstore_new (expected: 2, actual: %zu)", aArgs.Length())); + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_context_id_fn_method_contextidcomponent_request (expected: 2, actual: %zu)", aArgs.Length())); return; } - mPath.Lower(aArgs[0], aError); + mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } - mEncdec.Lower(aArgs[1], aError); + mRotationDaysInS.Lower(aArgs[1], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueObjectHandleLoginsLoginStore::FromRust( - uniffi_logins_fn_constructor_loginstore_new( - mPath.IntoRust(), - mEncdec.IntoRust(), + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_context_id_fn_method_contextidcomponent_request( + mUniffiPtr.IntoRust(), + mRotationDaysInS.IntoRust(), aOutStatus ) ); @@ -5376,79 +5687,49 @@ class ScaffoldingCallHandlerUniffiLoginsFnConstructorLoginstoreNew : public Unif ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreAdd : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiContextIdFnMethodContextidcomponentUnsetCallback : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; - FfiValueRustBuffer mLogin{}; + FfiValueObjectHandleContextIdContextIdComponent mUniffiPtr{}; // MakeRustCall stores the result of the call in these fields - FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_add (expected: 2, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 1) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_context_id_fn_method_contextidcomponent_unset_callback (expected: 1, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } - mLogin.Lower(aArgs[1], aError); - if (aError.Failed()) { - return; - } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_method_loginstore_add( - mUniffiPtr.IntoRust(), - mLogin.IntoRust(), - aOutStatus - ) + uniffi_context_id_fn_method_contextidcomponent_unset_callback( + mUniffiPtr.IntoRust(), + aOutStatus ); } virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { - mUniffiReturnValue.Lift( - aCx, - &aDest.Construct(), - aError - ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreAddMany : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiFilterAdultFnConstructorFilteradultcomponentNew : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; - FfiValueRustBuffer mLogins{}; // MakeRustCall stores the result of the call in these fields - FfiValueRustBuffer mUniffiReturnValue{}; + FfiValueObjectHandleFilterAdultFilterAdultComponent mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_add_many (expected: 2, actual: %zu)", aArgs.Length())); - return; - } - mUniffiPtr.LowerReciever(aArgs[0], aError); - if (aError.Failed()) { - return; - } - mLogins.Lower(aArgs[1], aError); - if (aError.Failed()) { - return; - } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_method_loginstore_add_many( - mUniffiPtr.IntoRust(), - mLogins.IntoRust(), + mUniffiReturnValue = FfiValueObjectHandleFilterAdultFilterAdultComponent::FromRust( + uniffi_filter_adult_fn_constructor_filteradultcomponent_new( aOutStatus ) ); @@ -5462,36 +5743,36 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreAddMany : public Uniff ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreAddManyWithMeta : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiFilterAdultFnMethodFilteradultcomponentContains : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; - FfiValueRustBuffer mEntriesWithMeta{}; + FfiValueObjectHandleFilterAdultFilterAdultComponent mUniffiPtr{}; + FfiValueRustBuffer mBaseDomainToCheck{}; // MakeRustCall stores the result of the call in these fields - FfiValueRustBuffer mUniffiReturnValue{}; + FfiValueInt mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_add_many_with_meta (expected: 2, actual: %zu)", aArgs.Length())); + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_filter_adult_fn_method_filteradultcomponent_contains (expected: 2, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } - mEntriesWithMeta.Lower(aArgs[1], aError); + mBaseDomainToCheck.Lower(aArgs[1], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_method_loginstore_add_many_with_meta( + mUniffiReturnValue = FfiValueInt::FromRust( + uniffi_filter_adult_fn_method_filteradultcomponent_contains( mUniffiPtr.IntoRust(), - mEntriesWithMeta.IntoRust(), + mBaseDomainToCheck.IntoRust(), aOutStatus ) ); @@ -5505,79 +5786,71 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreAddManyWithMeta : publ ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreAddOrUpdate : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiInitRustComponentsFnFuncInitialize : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; - FfiValueRustBuffer mLogin{}; + FfiValueRustBuffer mProfilePath{}; // MakeRustCall stores the result of the call in these fields - FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_add_or_update (expected: 2, actual: %zu)", aArgs.Length())); - return; - } - mUniffiPtr.LowerReciever(aArgs[0], aError); - if (aError.Failed()) { + if (aArgs.Length() < 1) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_init_rust_components_fn_func_initialize (expected: 1, actual: %zu)", aArgs.Length())); return; } - mLogin.Lower(aArgs[1], aError); + mProfilePath.Lower(aArgs[0], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_method_loginstore_add_or_update( - mUniffiPtr.IntoRust(), - mLogin.IntoRust(), - aOutStatus - ) + uniffi_init_rust_components_fn_func_initialize( + mProfilePath.IntoRust(), + aOutStatus ); } virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { - mUniffiReturnValue.Lift( - aCx, - &aDest.Construct(), - aError - ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreAddWithMeta : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnFuncCheckCanary : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; - FfiValueRustBuffer mEntryWithMeta{}; + FfiValueRustBuffer mCanary{}; + FfiValueRustBuffer mText{}; + FfiValueRustBuffer mEncryptionKey{}; // MakeRustCall stores the result of the call in these fields - FfiValueRustBuffer mUniffiReturnValue{}; + FfiValueInt mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_add_with_meta (expected: 2, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 3) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_func_check_canary (expected: 3, actual: %zu)", aArgs.Length())); return; } - mUniffiPtr.LowerReciever(aArgs[0], aError); + mCanary.Lower(aArgs[0], aError); if (aError.Failed()) { return; } - mEntryWithMeta.Lower(aArgs[1], aError); + mText.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + mEncryptionKey.Lower(aArgs[2], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_method_loginstore_add_with_meta( - mUniffiPtr.IntoRust(), - mEntryWithMeta.IntoRust(), + mUniffiReturnValue = FfiValueInt::FromRust( + uniffi_logins_fn_func_check_canary( + mCanary.IntoRust(), + mText.IntoRust(), + mEncryptionKey.IntoRust(), aOutStatus ) ); @@ -5591,30 +5864,36 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreAddWithMeta : public U ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreCount : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnFuncCreateCanary : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mText{}; + FfiValueRustBuffer mEncryptionKey{}; // MakeRustCall stores the result of the call in these fields - FfiValueInt mUniffiReturnValue{}; + FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_count (expected: 1, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_func_create_canary (expected: 2, actual: %zu)", aArgs.Length())); return; } - mUniffiPtr.LowerReciever(aArgs[0], aError); + mText.Lower(aArgs[0], aError); + if (aError.Failed()) { + return; + } + mEncryptionKey.Lower(aArgs[1], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueInt::FromRust( - uniffi_logins_fn_method_loginstore_count( - mUniffiPtr.IntoRust(), + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_logins_fn_func_create_canary( + mText.IntoRust(), + mEncryptionKey.IntoRust(), aOutStatus ) ); @@ -5628,36 +5907,20 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreCount : public UniffiS ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreCountByFormActionOrigin : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnFuncCreateKey : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; - FfiValueRustBuffer mFormActionOrigin{}; // MakeRustCall stores the result of the call in these fields - FfiValueInt mUniffiReturnValue{}; + FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_count_by_form_action_origin (expected: 2, actual: %zu)", aArgs.Length())); - return; - } - mUniffiPtr.LowerReciever(aArgs[0], aError); - if (aError.Failed()) { - return; - } - mFormActionOrigin.Lower(aArgs[1], aError); - if (aError.Failed()) { - return; - } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueInt::FromRust( - uniffi_logins_fn_method_loginstore_count_by_form_action_origin( - mUniffiPtr.IntoRust(), - mFormActionOrigin.IntoRust(), + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_logins_fn_func_create_key( aOutStatus ) ); @@ -5671,36 +5934,36 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreCountByFormActionOrigi ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreCountByOrigin : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnFuncCreateLoginStoreWithNssKeymanager : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; - FfiValueRustBuffer mOrigin{}; + FfiValueRustBuffer mPath{}; + FfiValueObjectHandleLoginsPrimaryPasswordAuthenticator mPrimaryPasswordAuthenticator{}; // MakeRustCall stores the result of the call in these fields - FfiValueInt mUniffiReturnValue{}; + FfiValueObjectHandleLoginsLoginStore mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_count_by_origin (expected: 2, actual: %zu)", aArgs.Length())); + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_func_create_login_store_with_nss_keymanager (expected: 2, actual: %zu)", aArgs.Length())); return; } - mUniffiPtr.LowerReciever(aArgs[0], aError); + mPath.Lower(aArgs[0], aError); if (aError.Failed()) { return; } - mOrigin.Lower(aArgs[1], aError); + mPrimaryPasswordAuthenticator.Lower(aArgs[1], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueInt::FromRust( - uniffi_logins_fn_method_loginstore_count_by_origin( - mUniffiPtr.IntoRust(), - mOrigin.IntoRust(), + mUniffiReturnValue = FfiValueObjectHandleLoginsLoginStore::FromRust( + uniffi_logins_fn_func_create_login_store_with_nss_keymanager( + mPath.IntoRust(), + mPrimaryPasswordAuthenticator.IntoRust(), aOutStatus ) ); @@ -5714,36 +5977,36 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreCountByOrigin : public ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreDelete : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnFuncCreateLoginStoreWithStaticKeyManager : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; - FfiValueRustBuffer mId{}; + FfiValueRustBuffer mPath{}; + FfiValueRustBuffer mKey{}; // MakeRustCall stores the result of the call in these fields - FfiValueInt mUniffiReturnValue{}; + FfiValueObjectHandleLoginsLoginStore mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_delete (expected: 2, actual: %zu)", aArgs.Length())); + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_func_create_login_store_with_static_key_manager (expected: 2, actual: %zu)", aArgs.Length())); return; } - mUniffiPtr.LowerReciever(aArgs[0], aError); + mPath.Lower(aArgs[0], aError); if (aError.Failed()) { return; } - mId.Lower(aArgs[1], aError); + mKey.Lower(aArgs[1], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueInt::FromRust( - uniffi_logins_fn_method_loginstore_delete( - mUniffiPtr.IntoRust(), - mId.IntoRust(), + mUniffiReturnValue = FfiValueObjectHandleLoginsLoginStore::FromRust( + uniffi_logins_fn_func_create_login_store_with_static_key_manager( + mPath.IntoRust(), + mKey.IntoRust(), aOutStatus ) ); @@ -5757,36 +6020,30 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreDelete : public Uniffi ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreDeleteMany : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnFuncCreateManagedEncdec : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; - FfiValueRustBuffer mIds{}; + FfiValueObjectHandleLoginsKeyManager mKeyManager{}; // MakeRustCall stores the result of the call in these fields - FfiValueRustBuffer mUniffiReturnValue{}; + FfiValueObjectHandleLoginsEncryptorDecryptor mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_delete_many (expected: 2, actual: %zu)", aArgs.Length())); - return; - } - mUniffiPtr.LowerReciever(aArgs[0], aError); - if (aError.Failed()) { + if (aArgs.Length() < 1) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_func_create_managed_encdec (expected: 1, actual: %zu)", aArgs.Length())); return; } - mIds.Lower(aArgs[1], aError); + mKeyManager.Lower(aArgs[0], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_method_loginstore_delete_many( - mUniffiPtr.IntoRust(), - mIds.IntoRust(), + mUniffiReturnValue = FfiValueObjectHandleLoginsEncryptorDecryptor::FromRust( + uniffi_logins_fn_func_create_managed_encdec( + mKeyManager.IntoRust(), aOutStatus ) ); @@ -5800,30 +6057,30 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreDeleteMany : public Un ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreDeleteUndecryptableRecordsForRemoteReplacement : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnFuncCreateStaticKeyManager : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mKey{}; // MakeRustCall stores the result of the call in these fields - FfiValueRustBuffer mUniffiReturnValue{}; + FfiValueObjectHandleLoginsKeyManager mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_delete_undecryptable_records_for_remote_replacement (expected: 1, actual: %zu)", aArgs.Length())); + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_func_create_static_key_manager (expected: 1, actual: %zu)", aArgs.Length())); return; } - mUniffiPtr.LowerReciever(aArgs[0], aError); + mKey.Lower(aArgs[0], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_method_loginstore_delete_undecryptable_records_for_remote_replacement( - mUniffiPtr.IntoRust(), + mUniffiReturnValue = FfiValueObjectHandleLoginsKeyManager::FromRust( + uniffi_logins_fn_func_create_static_key_manager( + mKey.IntoRust(), aOutStatus ) ); @@ -5837,11 +6094,11 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreDeleteUndecryptableRec ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreFindLoginToUpdate : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnMethodEncryptordecryptorDecrypt : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; - FfiValueRustBuffer mLook{}; + FfiValueObjectHandleLoginsEncryptorDecryptor mUniffiPtr{}; + FfiValueRustBuffer mCiphertext{}; // MakeRustCall stores the result of the call in these fields FfiValueRustBuffer mUniffiReturnValue{}; @@ -5849,14 +6106,14 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreFindLoginToUpdate : pu public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_find_login_to_update (expected: 2, actual: %zu)", aArgs.Length())); + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_encryptordecryptor_decrypt (expected: 2, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } - mLook.Lower(aArgs[1], aError); + mCiphertext.Lower(aArgs[1], aError); if (aError.Failed()) { return; } @@ -5864,9 +6121,9 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreFindLoginToUpdate : pu void MakeRustCall(RustCallStatus* aOutStatus) override { mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_method_loginstore_find_login_to_update( + uniffi_logins_fn_method_encryptordecryptor_decrypt( mUniffiPtr.IntoRust(), - mLook.IntoRust(), + mCiphertext.IntoRust(), aOutStatus ) ); @@ -5880,11 +6137,11 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreFindLoginToUpdate : pu ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreGet : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnMethodEncryptordecryptorEncrypt : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; - FfiValueRustBuffer mId{}; + FfiValueObjectHandleLoginsEncryptorDecryptor mUniffiPtr{}; + FfiValueRustBuffer mCleartext{}; // MakeRustCall stores the result of the call in these fields FfiValueRustBuffer mUniffiReturnValue{}; @@ -5892,14 +6149,14 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreGet : public UniffiSyn public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_get (expected: 2, actual: %zu)", aArgs.Length())); + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_encryptordecryptor_encrypt (expected: 2, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } - mId.Lower(aArgs[1], aError); + mCleartext.Lower(aArgs[1], aError); if (aError.Failed()) { return; } @@ -5907,9 +6164,9 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreGet : public UniffiSyn void MakeRustCall(RustCallStatus* aOutStatus) override { mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_method_loginstore_get( + uniffi_logins_fn_method_encryptordecryptor_encrypt( mUniffiPtr.IntoRust(), - mId.IntoRust(), + mCleartext.IntoRust(), aOutStatus ) ); @@ -5923,36 +6180,30 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreGet : public UniffiSyn ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreGetByBaseDomain : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnMethodKeymanagerGetKey : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; - FfiValueRustBuffer mBaseDomain{}; + FfiValueObjectHandleLoginsKeyManager mUniffiPtr{}; // MakeRustCall stores the result of the call in these fields FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_get_by_base_domain (expected: 2, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 1) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_keymanager_get_key (expected: 1, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } - mBaseDomain.Lower(aArgs[1], aError); - if (aError.Failed()) { - return; - } } void MakeRustCall(RustCallStatus* aOutStatus) override { mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_method_loginstore_get_by_base_domain( + uniffi_logins_fn_method_keymanager_get_key( mUniffiPtr.IntoRust(), - mBaseDomain.IntoRust(), aOutStatus ) ); @@ -5966,30 +6217,36 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreGetByBaseDomain : publ ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreGetCheckpoint : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnConstructorLoginstoreNew : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mPath{}; + FfiValueObjectHandleLoginsEncryptorDecryptor mEncdec{}; // MakeRustCall stores the result of the call in these fields - FfiValueRustBuffer mUniffiReturnValue{}; + FfiValueObjectHandleLoginsLoginStore mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_get_checkpoint (expected: 1, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_constructor_loginstore_new (expected: 2, actual: %zu)", aArgs.Length())); return; } - mUniffiPtr.LowerReciever(aArgs[0], aError); + mPath.Lower(aArgs[0], aError); + if (aError.Failed()) { + return; + } + mEncdec.Lower(aArgs[1], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_method_loginstore_get_checkpoint( - mUniffiPtr.IntoRust(), + mUniffiReturnValue = FfiValueObjectHandleLoginsLoginStore::FromRust( + uniffi_logins_fn_constructor_loginstore_new( + mPath.IntoRust(), + mEncdec.IntoRust(), aOutStatus ) ); @@ -6003,36 +6260,36 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreGetCheckpoint : public ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreHasLoginsByBaseDomain : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreAdd : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; - FfiValueRustBuffer mBaseDomain{}; + FfiValueRustBuffer mLogin{}; // MakeRustCall stores the result of the call in these fields - FfiValueInt mUniffiReturnValue{}; + FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_has_logins_by_base_domain (expected: 2, actual: %zu)", aArgs.Length())); + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_add (expected: 2, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } - mBaseDomain.Lower(aArgs[1], aError); + mLogin.Lower(aArgs[1], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueInt::FromRust( - uniffi_logins_fn_method_loginstore_has_logins_by_base_domain( + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_logins_fn_method_loginstore_add( mUniffiPtr.IntoRust(), - mBaseDomain.IntoRust(), + mLogin.IntoRust(), aOutStatus ) ); @@ -6046,30 +6303,36 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreHasLoginsByBaseDomain ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreIsEmpty : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreAddMany : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mLogins{}; // MakeRustCall stores the result of the call in these fields - FfiValueInt mUniffiReturnValue{}; + FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_is_empty (expected: 1, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_add_many (expected: 2, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } - } - - void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueInt::FromRust( - uniffi_logins_fn_method_loginstore_is_empty( + mLogins.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_logins_fn_method_loginstore_add_many( mUniffiPtr.IntoRust(), + mLogins.IntoRust(), aOutStatus ) ); @@ -6083,30 +6346,36 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreIsEmpty : public Uniff ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreList : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreAddManyWithMeta : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mEntriesWithMeta{}; // MakeRustCall stores the result of the call in these fields FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_list (expected: 1, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_add_many_with_meta (expected: 2, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } + mEntriesWithMeta.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } } void MakeRustCall(RustCallStatus* aOutStatus) override { mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_method_loginstore_list( + uniffi_logins_fn_method_loginstore_add_many_with_meta( mUniffiPtr.IntoRust(), + mEntriesWithMeta.IntoRust(), aOutStatus ) ); @@ -6120,75 +6389,104 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreList : public UniffiSy ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreRegisterWithSyncManager : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreAddOrUpdate : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mLogin{}; // MakeRustCall stores the result of the call in these fields + FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_register_with_sync_manager (expected: 1, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_add_or_update (expected: 2, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } + mLogin.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } } void MakeRustCall(RustCallStatus* aOutStatus) override { - uniffi_logins_fn_method_loginstore_register_with_sync_manager( - mUniffiPtr.IntoRust(), - aOutStatus + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_logins_fn_method_loginstore_add_or_update( + mUniffiPtr.IntoRust(), + mLogin.IntoRust(), + aOutStatus + ) ); } virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreReset : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreAddWithMeta : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mEntryWithMeta{}; // MakeRustCall stores the result of the call in these fields + FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_reset (expected: 1, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_add_with_meta (expected: 2, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } + mEntryWithMeta.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } } void MakeRustCall(RustCallStatus* aOutStatus) override { - uniffi_logins_fn_method_loginstore_reset( - mUniffiPtr.IntoRust(), - aOutStatus + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_logins_fn_method_loginstore_add_with_meta( + mUniffiPtr.IntoRust(), + mEntryWithMeta.IntoRust(), + aOutStatus + ) ); } virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreRunMaintenance : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreCount : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; // MakeRustCall stores the result of the call in these fields + FfiValueInt mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_run_maintenance (expected: 1, actual: %zu)", aArgs.Length())); + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_count (expected: 1, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); @@ -6198,91 +6496,121 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreRunMaintenance : publi } void MakeRustCall(RustCallStatus* aOutStatus) override { - uniffi_logins_fn_method_loginstore_run_maintenance( - mUniffiPtr.IntoRust(), - aOutStatus + mUniffiReturnValue = FfiValueInt::FromRust( + uniffi_logins_fn_method_loginstore_count( + mUniffiPtr.IntoRust(), + aOutStatus + ) ); } virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreSetCheckpoint : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreCountByFormActionOrigin : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; - FfiValueRustBuffer mCheckpoint{}; + FfiValueRustBuffer mFormActionOrigin{}; // MakeRustCall stores the result of the call in these fields + FfiValueInt mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_set_checkpoint (expected: 2, actual: %zu)", aArgs.Length())); + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_count_by_form_action_origin (expected: 2, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } - mCheckpoint.Lower(aArgs[1], aError); + mFormActionOrigin.Lower(aArgs[1], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - uniffi_logins_fn_method_loginstore_set_checkpoint( - mUniffiPtr.IntoRust(), - mCheckpoint.IntoRust(), - aOutStatus + mUniffiReturnValue = FfiValueInt::FromRust( + uniffi_logins_fn_method_loginstore_count_by_form_action_origin( + mUniffiPtr.IntoRust(), + mFormActionOrigin.IntoRust(), + aOutStatus + ) ); } virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreShutdown : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreCountByOrigin : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mOrigin{}; // MakeRustCall stores the result of the call in these fields + FfiValueInt mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_shutdown (expected: 1, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_count_by_origin (expected: 2, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } + mOrigin.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } } void MakeRustCall(RustCallStatus* aOutStatus) override { - uniffi_logins_fn_method_loginstore_shutdown( - mUniffiPtr.IntoRust(), - aOutStatus + mUniffiReturnValue = FfiValueInt::FromRust( + uniffi_logins_fn_method_loginstore_count_by_origin( + mUniffiPtr.IntoRust(), + mOrigin.IntoRust(), + aOutStatus + ) ); } virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreTouch : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreDelete : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; FfiValueRustBuffer mId{}; // MakeRustCall stores the result of the call in these fields + FfiValueInt mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { if (aArgs.Length() < 2) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_touch (expected: 2, actual: %zu)", aArgs.Length())); + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_delete (expected: 2, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); @@ -6296,41 +6624,43 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreTouch : public UniffiS } void MakeRustCall(RustCallStatus* aOutStatus) override { - uniffi_logins_fn_method_loginstore_touch( - mUniffiPtr.IntoRust(), - mId.IntoRust(), - aOutStatus + mUniffiReturnValue = FfiValueInt::FromRust( + uniffi_logins_fn_method_loginstore_delete( + mUniffiPtr.IntoRust(), + mId.IntoRust(), + aOutStatus + ) ); } virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreUpdate : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreDeleteMany : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; - FfiValueRustBuffer mId{}; - FfiValueRustBuffer mLogin{}; + FfiValueRustBuffer mIds{}; // MakeRustCall stores the result of the call in these fields FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 3) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_update (expected: 3, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_delete_many (expected: 2, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); if (aError.Failed()) { return; } - mId.Lower(aArgs[1], aError); - if (aError.Failed()) { - return; - } - mLogin.Lower(aArgs[2], aError); + mIds.Lower(aArgs[1], aError); if (aError.Failed()) { return; } @@ -6338,10 +6668,9 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreUpdate : public Uniffi void MakeRustCall(RustCallStatus* aOutStatus) override { mUniffiReturnValue = FfiValueRustBuffer::FromRust( - uniffi_logins_fn_method_loginstore_update( + uniffi_logins_fn_method_loginstore_delete_many( mUniffiPtr.IntoRust(), - mId.IntoRust(), - mLogin.IntoRust(), + mIds.IntoRust(), aOutStatus ) ); @@ -6355,17 +6684,18 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreUpdate : public Uniffi ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreWipeLocal : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreDeleteUndecryptableRecordsForRemoteReplacement : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; // MakeRustCall stores the result of the call in these fields + FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_wipe_local (expected: 1, actual: %zu)", aArgs.Length())); + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_delete_undecryptable_records_for_remote_replacement (expected: 1, actual: %zu)", aArgs.Length())); return; } mUniffiPtr.LowerReciever(aArgs[0], aError); @@ -6375,39 +6705,52 @@ class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreWipeLocal : public Uni } void MakeRustCall(RustCallStatus* aOutStatus) override { - uniffi_logins_fn_method_loginstore_wipe_local( - mUniffiPtr.IntoRust(), - aOutStatus + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_logins_fn_method_loginstore_delete_undecryptable_records_for_remote_replacement( + mUniffiPtr.IntoRust(), + aOutStatus + ) ); } virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnConstructorManagedencryptordecryptorNew : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreFindLoginToUpdate : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsKeyManager mKeyManager{}; + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mLook{}; // MakeRustCall stores the result of the call in these fields - FfiValueObjectHandleLoginsManagedEncryptorDecryptor mUniffiReturnValue{}; + FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_constructor_managedencryptordecryptor_new (expected: 1, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_find_login_to_update (expected: 2, actual: %zu)", aArgs.Length())); return; } - mKeyManager.Lower(aArgs[0], aError); + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + mLook.Lower(aArgs[1], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueObjectHandleLoginsManagedEncryptorDecryptor::FromRust( - uniffi_logins_fn_constructor_managedencryptordecryptor_new( - mKeyManager.IntoRust(), + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_logins_fn_method_loginstore_find_login_to_update( + mUniffiPtr.IntoRust(), + mLook.IntoRust(), aOutStatus ) ); @@ -6421,30 +6764,36 @@ class ScaffoldingCallHandlerUniffiLoginsFnConstructorManagedencryptordecryptorNe ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnConstructorNsskeymanagerNew : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreGet : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsPrimaryPasswordAuthenticator mPrimaryPasswordAuthenticator{}; + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mId{}; // MakeRustCall stores the result of the call in these fields - FfiValueObjectHandleLoginsNssKeyManager mUniffiReturnValue{}; + FfiValueRustBuffer mUniffiReturnValue{}; public: void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { - if (aArgs.Length() < 1) { - aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_constructor_nsskeymanager_new (expected: 1, actual: %zu)", aArgs.Length())); + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_get (expected: 2, actual: %zu)", aArgs.Length())); return; } - mPrimaryPasswordAuthenticator.Lower(aArgs[0], aError); + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + mId.Lower(aArgs[1], aError); if (aError.Failed()) { return; } } void MakeRustCall(RustCallStatus* aOutStatus) override { - mUniffiReturnValue = FfiValueObjectHandleLoginsNssKeyManager::FromRust( - uniffi_logins_fn_constructor_nsskeymanager_new( - mPrimaryPasswordAuthenticator.IntoRust(), + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_logins_fn_method_loginstore_get( + mUniffiPtr.IntoRust(), + mId.IntoRust(), aOutStatus ) ); @@ -6458,11 +6807,778 @@ class ScaffoldingCallHandlerUniffiLoginsFnConstructorNsskeymanagerNew : public U ); } }; -class ScaffoldingCallHandlerUniffiLoginsFnMethodNsskeymanagerIntoDynKeyManager : public UniffiSyncCallHandler { +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreGetByBaseDomain : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields - FfiValueObjectHandleLoginsNssKeyManager mUniffiPtr{}; - + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mBaseDomain{}; + + // MakeRustCall stores the result of the call in these fields + FfiValueRustBuffer mUniffiReturnValue{}; + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_get_by_base_domain (expected: 2, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + mBaseDomain.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_logins_fn_method_loginstore_get_by_base_domain( + mUniffiPtr.IntoRust(), + mBaseDomain.IntoRust(), + aOutStatus + ) + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreGetCheckpoint : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + + // MakeRustCall stores the result of the call in these fields + FfiValueRustBuffer mUniffiReturnValue{}; + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 1) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_get_checkpoint (expected: 1, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_logins_fn_method_loginstore_get_checkpoint( + mUniffiPtr.IntoRust(), + aOutStatus + ) + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreHasLoginsByBaseDomain : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mBaseDomain{}; + + // MakeRustCall stores the result of the call in these fields + FfiValueInt mUniffiReturnValue{}; + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_has_logins_by_base_domain (expected: 2, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + mBaseDomain.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + mUniffiReturnValue = FfiValueInt::FromRust( + uniffi_logins_fn_method_loginstore_has_logins_by_base_domain( + mUniffiPtr.IntoRust(), + mBaseDomain.IntoRust(), + aOutStatus + ) + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreIsBreachAlertDismissed : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mId{}; + + // MakeRustCall stores the result of the call in these fields + FfiValueInt mUniffiReturnValue{}; + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_is_breach_alert_dismissed (expected: 2, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + mId.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + mUniffiReturnValue = FfiValueInt::FromRust( + uniffi_logins_fn_method_loginstore_is_breach_alert_dismissed( + mUniffiPtr.IntoRust(), + mId.IntoRust(), + aOutStatus + ) + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreIsEmpty : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + + // MakeRustCall stores the result of the call in these fields + FfiValueInt mUniffiReturnValue{}; + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 1) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_is_empty (expected: 1, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + mUniffiReturnValue = FfiValueInt::FromRust( + uniffi_logins_fn_method_loginstore_is_empty( + mUniffiPtr.IntoRust(), + aOutStatus + ) + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreIsPotentiallyBreached : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mId{}; + + // MakeRustCall stores the result of the call in these fields + FfiValueInt mUniffiReturnValue{}; + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_is_potentially_breached (expected: 2, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + mId.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + mUniffiReturnValue = FfiValueInt::FromRust( + uniffi_logins_fn_method_loginstore_is_potentially_breached( + mUniffiPtr.IntoRust(), + mId.IntoRust(), + aOutStatus + ) + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreList : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + + // MakeRustCall stores the result of the call in these fields + FfiValueRustBuffer mUniffiReturnValue{}; + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 1) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_list (expected: 1, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_logins_fn_method_loginstore_list( + mUniffiPtr.IntoRust(), + aOutStatus + ) + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreRecordBreach : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mId{}; + FfiValueInt mTimestamp{}; + + // MakeRustCall stores the result of the call in these fields + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 3) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_record_breach (expected: 3, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + mId.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + mTimestamp.Lower(aArgs[2], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + uniffi_logins_fn_method_loginstore_record_breach( + mUniffiPtr.IntoRust(), + mId.IntoRust(), + mTimestamp.IntoRust(), + aOutStatus + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreRecordBreachAlertDismissal : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mId{}; + + // MakeRustCall stores the result of the call in these fields + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_record_breach_alert_dismissal (expected: 2, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + mId.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + uniffi_logins_fn_method_loginstore_record_breach_alert_dismissal( + mUniffiPtr.IntoRust(), + mId.IntoRust(), + aOutStatus + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreRecordBreachAlertDismissalTime : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mId{}; + FfiValueInt mTimestamp{}; + + // MakeRustCall stores the result of the call in these fields + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 3) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_record_breach_alert_dismissal_time (expected: 3, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + mId.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + mTimestamp.Lower(aArgs[2], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + uniffi_logins_fn_method_loginstore_record_breach_alert_dismissal_time( + mUniffiPtr.IntoRust(), + mId.IntoRust(), + mTimestamp.IntoRust(), + aOutStatus + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreRegisterWithSyncManager : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + + // MakeRustCall stores the result of the call in these fields + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 1) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_register_with_sync_manager (expected: 1, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + uniffi_logins_fn_method_loginstore_register_with_sync_manager( + mUniffiPtr.IntoRust(), + aOutStatus + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreReset : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + + // MakeRustCall stores the result of the call in these fields + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 1) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_reset (expected: 1, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + uniffi_logins_fn_method_loginstore_reset( + mUniffiPtr.IntoRust(), + aOutStatus + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreResetAllBreaches : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + + // MakeRustCall stores the result of the call in these fields + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 1) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_reset_all_breaches (expected: 1, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + uniffi_logins_fn_method_loginstore_reset_all_breaches( + mUniffiPtr.IntoRust(), + aOutStatus + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreRunMaintenance : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + + // MakeRustCall stores the result of the call in these fields + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 1) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_run_maintenance (expected: 1, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + uniffi_logins_fn_method_loginstore_run_maintenance( + mUniffiPtr.IntoRust(), + aOutStatus + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreSetCheckpoint : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mCheckpoint{}; + + // MakeRustCall stores the result of the call in these fields + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_set_checkpoint (expected: 2, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + mCheckpoint.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + uniffi_logins_fn_method_loginstore_set_checkpoint( + mUniffiPtr.IntoRust(), + mCheckpoint.IntoRust(), + aOutStatus + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreShutdown : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + + // MakeRustCall stores the result of the call in these fields + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 1) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_shutdown (expected: 1, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + uniffi_logins_fn_method_loginstore_shutdown( + mUniffiPtr.IntoRust(), + aOutStatus + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreTouch : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mId{}; + + // MakeRustCall stores the result of the call in these fields + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 2) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_touch (expected: 2, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + mId.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + uniffi_logins_fn_method_loginstore_touch( + mUniffiPtr.IntoRust(), + mId.IntoRust(), + aOutStatus + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreUpdate : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + FfiValueRustBuffer mId{}; + FfiValueRustBuffer mLogin{}; + + // MakeRustCall stores the result of the call in these fields + FfiValueRustBuffer mUniffiReturnValue{}; + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 3) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_update (expected: 3, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + mId.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + mLogin.Lower(aArgs[2], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_logins_fn_method_loginstore_update( + mUniffiPtr.IntoRust(), + mId.IntoRust(), + mLogin.IntoRust(), + aOutStatus + ) + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodLoginstoreWipeLocal : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsLoginStore mUniffiPtr{}; + + // MakeRustCall stores the result of the call in these fields + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 1) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_method_loginstore_wipe_local (expected: 1, actual: %zu)", aArgs.Length())); + return; + } + mUniffiPtr.LowerReciever(aArgs[0], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + uniffi_logins_fn_method_loginstore_wipe_local( + mUniffiPtr.IntoRust(), + aOutStatus + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnConstructorManagedencryptordecryptorNew : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsKeyManager mKeyManager{}; + + // MakeRustCall stores the result of the call in these fields + FfiValueObjectHandleLoginsManagedEncryptorDecryptor mUniffiReturnValue{}; + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 1) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_constructor_managedencryptordecryptor_new (expected: 1, actual: %zu)", aArgs.Length())); + return; + } + mKeyManager.Lower(aArgs[0], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + mUniffiReturnValue = FfiValueObjectHandleLoginsManagedEncryptorDecryptor::FromRust( + uniffi_logins_fn_constructor_managedencryptordecryptor_new( + mKeyManager.IntoRust(), + aOutStatus + ) + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnConstructorNsskeymanagerNew : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsPrimaryPasswordAuthenticator mPrimaryPasswordAuthenticator{}; + + // MakeRustCall stores the result of the call in these fields + FfiValueObjectHandleLoginsNssKeyManager mUniffiReturnValue{}; + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + if (aArgs.Length() < 1) { + aError.ThrowUnknownError(nsPrintfCString("LowerRustArgs: Incorrect argument length for uniffi_logins_fn_constructor_nsskeymanager_new (expected: 1, actual: %zu)", aArgs.Length())); + return; + } + mPrimaryPasswordAuthenticator.Lower(aArgs[0], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + mUniffiReturnValue = FfiValueObjectHandleLoginsNssKeyManager::FromRust( + uniffi_logins_fn_constructor_nsskeymanager_new( + mPrimaryPasswordAuthenticator.IntoRust(), + aOutStatus + ) + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); + } +}; +class ScaffoldingCallHandlerUniffiLoginsFnMethodNsskeymanagerIntoDynKeyManager : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleLoginsNssKeyManager mUniffiPtr{}; + // MakeRustCall stores the result of the call in these fields FfiValueObjectHandleLoginsKeyManager mUniffiReturnValue{}; @@ -14371,671 +15487,731 @@ UniquePtr GetSyncCallHandler(uint64_t aId) { switch (aId) { case 1: { - return MakeUnique(); + return MakeUnique(); } case 2: { - return MakeUnique(); + return MakeUnique(); } case 3: { - return MakeUnique(); + return MakeUnique(); } case 4: { - return MakeUnique(); + return MakeUnique(); } case 5: { - return MakeUnique(); + return MakeUnique(); } case 6: { - return MakeUnique(); + return MakeUnique(); } case 7: { - return MakeUnique(); + return MakeUnique(); } case 8: { - return MakeUnique(); + return MakeUnique(); } case 9: { - return MakeUnique(); + return MakeUnique(); } case 10: { - return MakeUnique(); + return MakeUnique(); } case 11: { - return MakeUnique(); + return MakeUnique(); } case 12: { - return MakeUnique(); + return MakeUnique(); } case 13: { - return MakeUnique(); + return MakeUnique(); } case 14: { - return MakeUnique(); + return MakeUnique(); } case 15: { - return MakeUnique(); + return MakeUnique(); } case 16: { - return MakeUnique(); + return MakeUnique(); } case 17: { - return MakeUnique(); + return MakeUnique(); } case 18: { - return MakeUnique(); + return MakeUnique(); } case 19: { - return MakeUnique(); + return MakeUnique(); } case 20: { - return MakeUnique(); + return MakeUnique(); } case 21: { - return MakeUnique(); + return MakeUnique(); } case 22: { - return MakeUnique(); + return MakeUnique(); } case 23: { - return MakeUnique(); + return MakeUnique(); } case 24: { - return MakeUnique(); + return MakeUnique(); } case 25: { - return MakeUnique(); + return MakeUnique(); } case 26: { - return MakeUnique(); + return MakeUnique(); } case 27: { - return MakeUnique(); + return MakeUnique(); } case 28: { - return MakeUnique(); + return MakeUnique(); } case 29: { - return MakeUnique(); + return MakeUnique(); } case 30: { - return MakeUnique(); + return MakeUnique(); } case 31: { - return MakeUnique(); + return MakeUnique(); } case 32: { - return MakeUnique(); + return MakeUnique(); } case 33: { - return MakeUnique(); + return MakeUnique(); } case 34: { - return MakeUnique(); + return MakeUnique(); } case 35: { - return MakeUnique(); + return MakeUnique(); } case 36: { - return MakeUnique(); + return MakeUnique(); } case 37: { - return MakeUnique(); + return MakeUnique(); } case 38: { - return MakeUnique(); + return MakeUnique(); } case 39: { - return MakeUnique(); + return MakeUnique(); } case 40: { - return MakeUnique(); + return MakeUnique(); } case 41: { - return MakeUnique(); + return MakeUnique(); } case 42: { - return MakeUnique(); + return MakeUnique(); } case 43: { - return MakeUnique(); + return MakeUnique(); } case 44: { - return MakeUnique(); + return MakeUnique(); } case 45: { - return MakeUnique(); + return MakeUnique(); } case 46: { - return MakeUnique(); + return MakeUnique(); } case 47: { - return MakeUnique(); + return MakeUnique(); + } + case 48: { + return MakeUnique(); + } + case 49: { + return MakeUnique(); + } + case 50: { + return MakeUnique(); } case 51: { - return MakeUnique(); + return MakeUnique(); } case 52: { - return MakeUnique(); + return MakeUnique(); } case 53: { - return MakeUnique(); + return MakeUnique(); } case 54: { - return MakeUnique(); + return MakeUnique(); } case 55: { - return MakeUnique(); + return MakeUnique(); } case 56: { - return MakeUnique(); + return MakeUnique(); } case 57: { - return MakeUnique(); + return MakeUnique(); } case 58: { - return MakeUnique(); + return MakeUnique(); } case 59: { - return MakeUnique(); + return MakeUnique(); } case 60: { - return MakeUnique(); + return MakeUnique(); } case 61: { - return MakeUnique(); + return MakeUnique(); } case 62: { - return MakeUnique(); + return MakeUnique(); } case 63: { - return MakeUnique(); + return MakeUnique(); } case 64: { - return MakeUnique(); + return MakeUnique(); } case 65: { + return MakeUnique(); + } + case 66: { + return MakeUnique(); + } + case 67: { + return MakeUnique(); + } + case 71: { + return MakeUnique(); + } + case 72: { + return MakeUnique(); + } + case 73: { + 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(); + } + case 82: { + return MakeUnique(); + } + case 83: { + return MakeUnique(); + } + case 84: { + return MakeUnique(); + } + case 85: { return MakeUnique(); } - case 66: { + case 86: { return MakeUnique(); } - case 67: { + case 87: { return MakeUnique(); } - case 68: { + case 88: { return MakeUnique(); } - case 69: { + case 89: { return MakeUnique(); } - case 70: { + case 90: { return MakeUnique(); } - case 71: { + case 91: { return MakeUnique(); } - case 72: { + case 92: { return MakeUnique(); } - case 73: { + case 93: { return MakeUnique(); } - case 74: { + case 94: { return MakeUnique(); } - case 75: { + case 95: { return MakeUnique(); } - case 76: { + case 96: { return MakeUnique(); } - case 77: { + case 97: { return MakeUnique(); } - case 78: { + case 98: { return MakeUnique(); } - case 79: { + case 99: { return MakeUnique(); } - case 80: { + case 100: { return MakeUnique(); } - case 81: { + case 101: { return MakeUnique(); } - case 82: { + case 102: { return MakeUnique(); } - case 83: { + case 103: { return MakeUnique(); } - case 84: { + case 104: { return MakeUnique(); } - case 85: { + case 105: { return MakeUnique(); } - case 86: { + case 106: { return MakeUnique(); } - case 87: { + case 107: { return MakeUnique(); } - case 88: { + case 108: { return MakeUnique(); } - case 89: { + case 109: { return MakeUnique(); } - case 90: { + case 110: { return MakeUnique(); } - case 91: { + case 111: { return MakeUnique(); } - case 92: { + case 112: { return MakeUnique(); } - case 93: { + case 113: { return MakeUnique(); } - case 94: { + case 114: { return MakeUnique(); } - case 95: { + case 115: { return MakeUnique(); } - case 96: { + case 116: { return MakeUnique(); } - case 97: { + case 117: { return MakeUnique(); } - case 98: { + case 118: { return MakeUnique(); } - case 99: { + case 119: { return MakeUnique(); } - case 100: { + case 120: { return MakeUnique(); } - case 101: { + case 121: { return MakeUnique(); } - case 102: { + case 122: { return MakeUnique(); } - case 103: { + case 123: { return MakeUnique(); } - case 104: { + case 124: { return MakeUnique(); } - case 105: { + case 125: { return MakeUnique(); } - case 106: { + case 126: { return MakeUnique(); } - case 107: { + case 127: { return MakeUnique(); } - case 108: { + case 128: { return MakeUnique(); } - case 109: { + case 129: { return MakeUnique(); } - case 110: { + case 130: { return MakeUnique(); } - case 111: { + case 131: { return MakeUnique(); } - case 112: { + case 132: { return MakeUnique(); } - case 113: { + case 133: { return MakeUnique(); } - case 114: { + case 134: { return MakeUnique(); } - case 115: { + case 135: { return MakeUnique(); } - case 116: { + case 136: { return MakeUnique(); } - case 117: { + case 137: { return MakeUnique(); } - case 118: { + case 138: { return MakeUnique(); } - case 119: { + case 139: { return MakeUnique(); } - case 120: { + case 140: { return MakeUnique(); } - case 121: { + case 141: { return MakeUnique(); } - case 122: { + case 142: { return MakeUnique(); } - case 123: { + case 143: { return MakeUnique(); } - case 124: { + case 144: { return MakeUnique(); } - case 125: { + case 145: { return MakeUnique(); } - case 126: { + case 146: { return MakeUnique(); } - case 127: { + case 147: { return MakeUnique(); } - case 128: { + case 148: { return MakeUnique(); } - case 129: { + case 149: { return MakeUnique(); } - case 130: { + case 150: { return MakeUnique(); } - case 131: { + case 151: { return MakeUnique(); } - case 132: { + case 152: { return MakeUnique(); } - case 133: { + case 153: { return MakeUnique(); } - case 134: { + case 154: { return MakeUnique(); } - case 135: { + case 155: { return MakeUnique(); } - case 136: { + case 156: { return MakeUnique(); } - case 137: { + case 157: { return MakeUnique(); } - case 138: { + case 158: { return MakeUnique(); } - case 139: { + case 159: { return MakeUnique(); } - case 140: { + case 160: { return MakeUnique(); } - case 141: { + case 161: { return MakeUnique(); } - case 143: { + case 163: { return MakeUnique(); } - case 144: { + case 164: { return MakeUnique(); } - case 145: { + case 165: { return MakeUnique(); } - case 146: { + case 166: { return MakeUnique(); } - case 147: { + case 167: { return MakeUnique(); } - case 148: { + case 168: { return MakeUnique(); } - case 149: { + case 169: { return MakeUnique(); } - case 150: { + case 170: { return MakeUnique(); } - case 151: { + case 171: { return MakeUnique(); } - case 152: { + case 172: { return MakeUnique(); } - case 153: { + case 173: { return MakeUnique(); } - case 154: { + case 174: { return MakeUnique(); } - case 155: { + case 175: { return MakeUnique(); } - case 156: { + case 176: { return MakeUnique(); } - case 157: { + case 177: { return MakeUnique(); } - case 158: { + case 178: { return MakeUnique(); } - case 159: { + case 179: { return MakeUnique(); } - case 160: { + case 180: { return MakeUnique(); } - case 161: { + case 181: { return MakeUnique(); } - case 162: { + case 182: { return MakeUnique(); } - case 163: { + case 183: { return MakeUnique(); } - case 164: { + case 184: { return MakeUnique(); } - case 165: { + case 185: { return MakeUnique(); } #ifdef MOZ_UNIFFI_FIXTURES - case 181: { + case 201: { return MakeUnique(); } - case 182: { + case 202: { return MakeUnique(); } - case 183: { + case 203: { return MakeUnique(); } - case 184: { + case 204: { return MakeUnique(); } - case 185: { + case 205: { return MakeUnique(); } - case 186: { + case 206: { return MakeUnique(); } - case 187: { + case 207: { return MakeUnique(); } - case 188: { + case 208: { return MakeUnique(); } - case 197: { + case 217: { return MakeUnique(); } - case 198: { + case 218: { return MakeUnique(); } - case 199: { + case 219: { return MakeUnique(); } - case 200: { + case 220: { return MakeUnique(); } - case 201: { + case 221: { return MakeUnique(); } - case 202: { + case 222: { return MakeUnique(); } - case 203: { + case 223: { return MakeUnique(); } - case 204: { + case 224: { return MakeUnique(); } - case 205: { + case 225: { return MakeUnique(); } - case 206: { + case 226: { return MakeUnique(); } - case 207: { + case 227: { return MakeUnique(); } - case 208: { + case 228: { return MakeUnique(); } - case 209: { + case 229: { return MakeUnique(); } - case 210: { + case 230: { return MakeUnique(); } - case 211: { + case 231: { return MakeUnique(); } - case 212: { + case 232: { return MakeUnique(); } - case 213: { + case 233: { return MakeUnique(); } - case 214: { + case 234: { return MakeUnique(); } - case 215: { + case 235: { return MakeUnique(); } - case 216: { + case 236: { return MakeUnique(); } - case 217: { + case 237: { return MakeUnique(); } - case 218: { + case 238: { return MakeUnique(); } - case 219: { + case 239: { return MakeUnique(); } - case 220: { + case 240: { return MakeUnique(); } - case 221: { + case 241: { return MakeUnique(); } - case 222: { + case 242: { return MakeUnique(); } - case 223: { + case 243: { return MakeUnique(); } - case 224: { + case 244: { return MakeUnique(); } - case 225: { + case 245: { return MakeUnique(); } - case 226: { + case 246: { return MakeUnique(); } - case 227: { + case 247: { return MakeUnique(); } - case 228: { + case 248: { return MakeUnique(); } - case 229: { + case 249: { return MakeUnique(); } - case 230: { + case 250: { return MakeUnique(); } - case 231: { + case 251: { return MakeUnique(); } - case 232: { + case 252: { return MakeUnique(); } - case 233: { + case 253: { return MakeUnique(); } - case 234: { + case 254: { return MakeUnique(); } - case 235: { + case 255: { return MakeUnique(); } - case 236: { + case 256: { return MakeUnique(); } - case 237: { + case 257: { return MakeUnique(); } - case 243: { + case 263: { return MakeUnique(); } - case 244: { + case 264: { return MakeUnique(); } - case 245: { + case 265: { return MakeUnique(); } - case 246: { + case 266: { return MakeUnique(); } - case 247: { + case 267: { return MakeUnique(); } - case 248: { + case 268: { return MakeUnique(); } - case 249: { + case 269: { return MakeUnique(); } - case 250: { + case 270: { return MakeUnique(); } - case 251: { + case 271: { return MakeUnique(); } - case 252: { + case 272: { return MakeUnique(); } - case 253: { + case 273: { return MakeUnique(); } - case 254: { + case 274: { return MakeUnique(); } #endif /* MOZ_UNIFFI_FIXTURES */ @@ -15048,102 +16224,102 @@ UniquePtr GetSyncCallHandler(uint64_t aId) { UniquePtr GetAsyncCallHandler(uint64_t aId) { switch (aId) { - case 48: { + case 68: { return MakeUnique(); } - case 49: { + case 69: { return MakeUnique(); } - case 50: { + case 70: { return MakeUnique(); } - case 142: { + case 162: { return MakeUnique(); } #ifdef MOZ_UNIFFI_FIXTURES - case 166: { + case 186: { return MakeUnique(); } - case 167: { + case 187: { return MakeUnique(); } - case 168: { + case 188: { return MakeUnique(); } - case 169: { + case 189: { return MakeUnique(); } - case 170: { + case 190: { return MakeUnique(); } - case 171: { + case 191: { return MakeUnique(); } - case 172: { + case 192: { return MakeUnique(); } - case 173: { + case 193: { return MakeUnique(); } - case 174: { + case 194: { return MakeUnique(); } - case 175: { + case 195: { return MakeUnique(); } - case 176: { + case 196: { return MakeUnique(); } - case 177: { + case 197: { return MakeUnique(); } - case 178: { + case 198: { return MakeUnique(); } - case 179: { + case 199: { return MakeUnique(); } - case 180: { + case 200: { return MakeUnique(); } - case 189: { + case 209: { return MakeUnique(); } - case 190: { + case 210: { return MakeUnique(); } - case 191: { + case 211: { return MakeUnique(); } - case 192: { + case 212: { return MakeUnique(); } - case 193: { + case 213: { return MakeUnique(); } - case 194: { + case 214: { return MakeUnique(); } - case 195: { + case 215: { return MakeUnique(); } - case 196: { + case 216: { return MakeUnique(); } - case 238: { + case 258: { return MakeUnique(); } - case 239: { + case 259: { return MakeUnique(); } - case 240: { + case 260: { return MakeUnique(); } - case 241: { + case 261: { return MakeUnique(); } - case 242: { + case 262: { return MakeUnique(); } #endif /* MOZ_UNIFFI_FIXTURES */ @@ -15256,86 +16432,385 @@ class CallbackLowerReturnRustBuffer { break; } - aOutCallStatus->error_buf = errorBuf.IntoRust(); - aOutCallStatus->code = RUST_CALL_ERROR; - break; - } + aOutCallStatus->error_buf = errorBuf.IntoRust(); + aOutCallStatus->code = RUST_CALL_ERROR; + break; + } + + default: { + break; + } + } + + return returnValue.IntoRust(); + } +}; + +#ifdef MOZ_UNIFFI_FIXTURES + +/** + * Handle callback interface return values for a single return type + */ +class CallbackLowerReturnUInt32 { +public: + /** + * Lower return values + * + * This inputs a UniFFIScaffoldingCallResult from JS and converts it to + * something that can be passed to Rust. + * + * - On success, it returns the FFI return value + * - On error, it updates the `RustCallStatus` struct and returns a default FFI value. + */ + static uint32_t + Lower(const RootedDictionary& aCallResult, + RustCallStatus* aOutCallStatus, + ErrorResult& aRv) { + aOutCallStatus->code = RUST_CALL_INTERNAL_ERROR; + FfiValueInt returnValue; + switch (aCallResult.mCode) { + case UniFFIScaffoldingCallCode::Success: { + if (!aCallResult.mData.WasPassed()) { + MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[CallbackLowerReturnUInt32] No data passed")); + break; + } + returnValue.Lower(aCallResult.mData.Value(), aRv); + if (aRv.Failed()) { + MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[CallbackLowerReturnUInt32] Failed to lower return value")); + break; + } + aOutCallStatus->code = RUST_CALL_SUCCESS; + break; + } + + case UniFFIScaffoldingCallCode::Error: { + if (!aCallResult.mData.WasPassed()) { + MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[CallbackLowerReturnUInt32] No data passed")); + break; + } + FfiValueRustBuffer errorBuf; + errorBuf.Lower(aCallResult.mData.Value(), aRv); + if (aRv.Failed()) { + MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[CallbackLowerReturnUInt32] Failed to lower error buffer")); + break; + } + + aOutCallStatus->error_buf = errorBuf.IntoRust(); + aOutCallStatus->code = RUST_CALL_ERROR; + break; + } + + default: { + break; + } + } + + return returnValue.IntoRust(); + } +}; +#endif /* MOZ_UNIFFI_FIXTURES */ + +// Callback interface method handlers, vtables, etc. + +static StaticRefPtr gUniffiCallbackHandlerAdsClientMozAdsTelemetry; +/** + * callback_interface_ads_client_moz_ads_telemetry_record_build_cache_error -- C function to handle the callback method + * + * This is what Rust calls when it invokes a callback method. + */ +extern "C" void callback_interface_ads_client_moz_ads_telemetry_record_build_cache_error( + uint64_t aUniffiHandle, + RustBuffer aLabel, + RustBuffer aValue, + void* aUniffiOutReturn, + RustCallStatus* aUniffiOutStatus +) { + MOZ_RELEASE_ASSERT(NS_IsMainThread()); + // Take our own reference to the callback handler to ensure that it + // stays alive for the duration of this call + RefPtr jsHandler = gUniffiCallbackHandlerAdsClientMozAdsTelemetry; + // Create a JS context for the call + JSObject* global = jsHandler->CallbackGlobalOrNull(); + if (!global) { + MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[callback_interface_ads_client_moz_ads_telemetry_record_build_cache_error] JS handler has null global")); + return; + } + dom::AutoEntryScript aes(global, "callback_interface_ads_client_moz_ads_telemetry_record_build_cache_error"); + + // Convert arguments + nsTArray uniffiArgs; + if (!uniffiArgs.AppendElements(2, mozilla::fallible)) { + MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[callback_interface_ads_client_moz_ads_telemetry_record_build_cache_error] Failed to allocate arguments")); + return; + } + IgnoredErrorResult error; + FfiValueRustBuffer label = FfiValueRustBuffer::FromRust(aLabel); + label.Lift(aes.cx(), &uniffiArgs[0], error); + if (error.Failed()) { + MOZ_LOG( + gUniffiLogger, LogLevel::Error, + ("[callback_interface_ads_client_moz_ads_telemetry_record_build_cache_error] Failed to lift aLabel")); + return; + } + FfiValueRustBuffer value = FfiValueRustBuffer::FromRust(aValue); + value.Lift(aes.cx(), &uniffiArgs[1], error); + if (error.Failed()) { + MOZ_LOG( + gUniffiLogger, LogLevel::Error, + ("[callback_interface_ads_client_moz_ads_telemetry_record_build_cache_error] Failed to lift aValue")); + return; + } + + RootedDictionary callResult(aes.cx()); + jsHandler->CallSync(aUniffiHandle, 0, uniffiArgs, callResult, error); + if (error.Failed()) { + MOZ_LOG( + gUniffiLogger, LogLevel::Error, + ("[callback_interface_ads_client_moz_ads_telemetry_record_build_cache_error] Error invoking JS handler")); + return; + } + CallbackLowerReturnVoid::Lower(callResult, aUniffiOutStatus, error); + } +/** + * callback_interface_ads_client_moz_ads_telemetry_record_client_error -- C function to handle the callback method + * + * This is what Rust calls when it invokes a callback method. + */ +extern "C" void callback_interface_ads_client_moz_ads_telemetry_record_client_error( + uint64_t aUniffiHandle, + RustBuffer aLabel, + RustBuffer aValue, + void* aUniffiOutReturn, + RustCallStatus* aUniffiOutStatus +) { + MOZ_RELEASE_ASSERT(NS_IsMainThread()); + // Take our own reference to the callback handler to ensure that it + // stays alive for the duration of this call + RefPtr jsHandler = gUniffiCallbackHandlerAdsClientMozAdsTelemetry; + // Create a JS context for the call + JSObject* global = jsHandler->CallbackGlobalOrNull(); + if (!global) { + MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[callback_interface_ads_client_moz_ads_telemetry_record_client_error] JS handler has null global")); + return; + } + dom::AutoEntryScript aes(global, "callback_interface_ads_client_moz_ads_telemetry_record_client_error"); + + // Convert arguments + nsTArray uniffiArgs; + if (!uniffiArgs.AppendElements(2, mozilla::fallible)) { + MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[callback_interface_ads_client_moz_ads_telemetry_record_client_error] Failed to allocate arguments")); + return; + } + IgnoredErrorResult error; + FfiValueRustBuffer label = FfiValueRustBuffer::FromRust(aLabel); + label.Lift(aes.cx(), &uniffiArgs[0], error); + if (error.Failed()) { + MOZ_LOG( + gUniffiLogger, LogLevel::Error, + ("[callback_interface_ads_client_moz_ads_telemetry_record_client_error] Failed to lift aLabel")); + return; + } + FfiValueRustBuffer value = FfiValueRustBuffer::FromRust(aValue); + value.Lift(aes.cx(), &uniffiArgs[1], error); + if (error.Failed()) { + MOZ_LOG( + gUniffiLogger, LogLevel::Error, + ("[callback_interface_ads_client_moz_ads_telemetry_record_client_error] Failed to lift aValue")); + return; + } + + RootedDictionary callResult(aes.cx()); + jsHandler->CallSync(aUniffiHandle, 1, uniffiArgs, callResult, error); + if (error.Failed()) { + MOZ_LOG( + gUniffiLogger, LogLevel::Error, + ("[callback_interface_ads_client_moz_ads_telemetry_record_client_error] Error invoking JS handler")); + return; + } + CallbackLowerReturnVoid::Lower(callResult, aUniffiOutStatus, error); + } +/** + * callback_interface_ads_client_moz_ads_telemetry_record_client_operation_total -- C function to handle the callback method + * + * This is what Rust calls when it invokes a callback method. + */ +extern "C" void callback_interface_ads_client_moz_ads_telemetry_record_client_operation_total( + uint64_t aUniffiHandle, + RustBuffer aLabel, + void* aUniffiOutReturn, + RustCallStatus* aUniffiOutStatus +) { + MOZ_RELEASE_ASSERT(NS_IsMainThread()); + // Take our own reference to the callback handler to ensure that it + // stays alive for the duration of this call + RefPtr jsHandler = gUniffiCallbackHandlerAdsClientMozAdsTelemetry; + // Create a JS context for the call + JSObject* global = jsHandler->CallbackGlobalOrNull(); + if (!global) { + MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[callback_interface_ads_client_moz_ads_telemetry_record_client_operation_total] JS handler has null global")); + return; + } + dom::AutoEntryScript aes(global, "callback_interface_ads_client_moz_ads_telemetry_record_client_operation_total"); - default: { - break; - } - } + // Convert arguments + nsTArray uniffiArgs; + if (!uniffiArgs.AppendElements(1, mozilla::fallible)) { + MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[callback_interface_ads_client_moz_ads_telemetry_record_client_operation_total] Failed to allocate arguments")); + return; + } + IgnoredErrorResult error; + FfiValueRustBuffer label = FfiValueRustBuffer::FromRust(aLabel); + label.Lift(aes.cx(), &uniffiArgs[0], error); + if (error.Failed()) { + MOZ_LOG( + gUniffiLogger, LogLevel::Error, + ("[callback_interface_ads_client_moz_ads_telemetry_record_client_operation_total] Failed to lift aLabel")); + return; + } - return returnValue.IntoRust(); - } -}; + RootedDictionary callResult(aes.cx()); + jsHandler->CallSync(aUniffiHandle, 2, uniffiArgs, callResult, error); + if (error.Failed()) { + MOZ_LOG( + gUniffiLogger, LogLevel::Error, + ("[callback_interface_ads_client_moz_ads_telemetry_record_client_operation_total] Error invoking JS handler")); + return; + } + CallbackLowerReturnVoid::Lower(callResult, aUniffiOutStatus, error); + } +/** + * callback_interface_ads_client_moz_ads_telemetry_record_deserialization_error -- C function to handle the callback method + * + * This is what Rust calls when it invokes a callback method. + */ +extern "C" void callback_interface_ads_client_moz_ads_telemetry_record_deserialization_error( + uint64_t aUniffiHandle, + RustBuffer aLabel, + RustBuffer aValue, + void* aUniffiOutReturn, + RustCallStatus* aUniffiOutStatus +) { + MOZ_RELEASE_ASSERT(NS_IsMainThread()); + // Take our own reference to the callback handler to ensure that it + // stays alive for the duration of this call + RefPtr jsHandler = gUniffiCallbackHandlerAdsClientMozAdsTelemetry; + // Create a JS context for the call + JSObject* global = jsHandler->CallbackGlobalOrNull(); + if (!global) { + MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[callback_interface_ads_client_moz_ads_telemetry_record_deserialization_error] JS handler has null global")); + return; + } + dom::AutoEntryScript aes(global, "callback_interface_ads_client_moz_ads_telemetry_record_deserialization_error"); -#ifdef MOZ_UNIFFI_FIXTURES + // Convert arguments + nsTArray uniffiArgs; + if (!uniffiArgs.AppendElements(2, mozilla::fallible)) { + MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[callback_interface_ads_client_moz_ads_telemetry_record_deserialization_error] Failed to allocate arguments")); + return; + } + IgnoredErrorResult error; + FfiValueRustBuffer label = FfiValueRustBuffer::FromRust(aLabel); + label.Lift(aes.cx(), &uniffiArgs[0], error); + if (error.Failed()) { + MOZ_LOG( + gUniffiLogger, LogLevel::Error, + ("[callback_interface_ads_client_moz_ads_telemetry_record_deserialization_error] Failed to lift aLabel")); + return; + } + FfiValueRustBuffer value = FfiValueRustBuffer::FromRust(aValue); + value.Lift(aes.cx(), &uniffiArgs[1], error); + if (error.Failed()) { + MOZ_LOG( + gUniffiLogger, LogLevel::Error, + ("[callback_interface_ads_client_moz_ads_telemetry_record_deserialization_error] Failed to lift aValue")); + return; + } + RootedDictionary callResult(aes.cx()); + jsHandler->CallSync(aUniffiHandle, 3, uniffiArgs, callResult, error); + if (error.Failed()) { + MOZ_LOG( + gUniffiLogger, LogLevel::Error, + ("[callback_interface_ads_client_moz_ads_telemetry_record_deserialization_error] Error invoking JS handler")); + return; + } + CallbackLowerReturnVoid::Lower(callResult, aUniffiOutStatus, error); + } /** - * Handle callback interface return values for a single return type - */ -class CallbackLowerReturnUInt32 { -public: - /** - * Lower return values - * - * This inputs a UniFFIScaffoldingCallResult from JS and converts it to - * something that can be passed to Rust. - * - * - On success, it returns the FFI return value - * - On error, it updates the `RustCallStatus` struct and returns a default FFI value. - */ - static uint32_t - Lower(const RootedDictionary& aCallResult, - RustCallStatus* aOutCallStatus, - ErrorResult& aRv) { - aOutCallStatus->code = RUST_CALL_INTERNAL_ERROR; - FfiValueInt returnValue; - switch (aCallResult.mCode) { - case UniFFIScaffoldingCallCode::Success: { - if (!aCallResult.mData.WasPassed()) { - MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[CallbackLowerReturnUInt32] No data passed")); - break; - } - returnValue.Lower(aCallResult.mData.Value(), aRv); - if (aRv.Failed()) { - MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[CallbackLowerReturnUInt32] Failed to lower return value")); - break; - } - aOutCallStatus->code = RUST_CALL_SUCCESS; - break; - } + * callback_interface_ads_client_moz_ads_telemetry_record_http_cache_outcome -- C function to handle the callback method + * + * This is what Rust calls when it invokes a callback method. + */ +extern "C" void callback_interface_ads_client_moz_ads_telemetry_record_http_cache_outcome( + uint64_t aUniffiHandle, + RustBuffer aLabel, + RustBuffer aValue, + void* aUniffiOutReturn, + RustCallStatus* aUniffiOutStatus +) { + MOZ_RELEASE_ASSERT(NS_IsMainThread()); + // Take our own reference to the callback handler to ensure that it + // stays alive for the duration of this call + RefPtr jsHandler = gUniffiCallbackHandlerAdsClientMozAdsTelemetry; + // Create a JS context for the call + JSObject* global = jsHandler->CallbackGlobalOrNull(); + if (!global) { + MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[callback_interface_ads_client_moz_ads_telemetry_record_http_cache_outcome] JS handler has null global")); + return; + } + dom::AutoEntryScript aes(global, "callback_interface_ads_client_moz_ads_telemetry_record_http_cache_outcome"); - case UniFFIScaffoldingCallCode::Error: { - if (!aCallResult.mData.WasPassed()) { - MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[CallbackLowerReturnUInt32] No data passed")); - break; - } - FfiValueRustBuffer errorBuf; - errorBuf.Lower(aCallResult.mData.Value(), aRv); - if (aRv.Failed()) { - MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[CallbackLowerReturnUInt32] Failed to lower error buffer")); - break; - } + // Convert arguments + nsTArray uniffiArgs; + if (!uniffiArgs.AppendElements(2, mozilla::fallible)) { + MOZ_LOG(gUniffiLogger, LogLevel::Error, ("[callback_interface_ads_client_moz_ads_telemetry_record_http_cache_outcome] Failed to allocate arguments")); + return; + } + IgnoredErrorResult error; + FfiValueRustBuffer label = FfiValueRustBuffer::FromRust(aLabel); + label.Lift(aes.cx(), &uniffiArgs[0], error); + if (error.Failed()) { + MOZ_LOG( + gUniffiLogger, LogLevel::Error, + ("[callback_interface_ads_client_moz_ads_telemetry_record_http_cache_outcome] Failed to lift aLabel")); + return; + } + FfiValueRustBuffer value = FfiValueRustBuffer::FromRust(aValue); + value.Lift(aes.cx(), &uniffiArgs[1], error); + if (error.Failed()) { + MOZ_LOG( + gUniffiLogger, LogLevel::Error, + ("[callback_interface_ads_client_moz_ads_telemetry_record_http_cache_outcome] Failed to lift aValue")); + return; + } - aOutCallStatus->error_buf = errorBuf.IntoRust(); - aOutCallStatus->code = RUST_CALL_ERROR; - break; - } + RootedDictionary callResult(aes.cx()); + jsHandler->CallSync(aUniffiHandle, 4, uniffiArgs, callResult, error); + if (error.Failed()) { + MOZ_LOG( + gUniffiLogger, LogLevel::Error, + ("[callback_interface_ads_client_moz_ads_telemetry_record_http_cache_outcome] Error invoking JS handler")); + return; + } + CallbackLowerReturnVoid::Lower(callResult, aUniffiOutStatus, error); + } - default: { - break; - } - } +extern "C" void callback_free_ads_client_moz_ads_telemetry(uint64_t uniffiHandle) { + // Callback object handles are keys in a map stored in the JS handler. To + // handle the free call, schedule a fire-and-forget JS call to remove the key. + AsyncCallbackMethodHandlerBase::ScheduleAsyncCall( + MakeUnique("MozAdsTelemetry.uniffi_free", uniffiHandle), + &gUniffiCallbackHandlerAdsClientMozAdsTelemetry); +} - return returnValue.IntoRust(); - } +static VTableCallbackInterfaceAdsClientMozAdsTelemetry kUniffiVtableAdsClientMozAdsTelemetry { + callback_interface_ads_client_moz_ads_telemetry_record_build_cache_error, + callback_interface_ads_client_moz_ads_telemetry_record_client_error, + callback_interface_ads_client_moz_ads_telemetry_record_client_operation_total, + callback_interface_ads_client_moz_ads_telemetry_record_deserialization_error, + callback_interface_ads_client_moz_ads_telemetry_record_http_cache_outcome, + callback_free_ads_client_moz_ads_telemetry }; -#endif /* MOZ_UNIFFI_FIXTURES */ - -// Callback interface method handlers, vtables, etc. - static StaticRefPtr gUniffiCallbackHandlerContextIdContextIdCallback; /** * Callback method handler subclass for callback_interface_context_id_context_id_callback_persist @@ -17230,6 +18705,16 @@ void RegisterCallbackHandler(uint64_t aInterfaceId, UniFFICallbackHandler& aCall switch (aInterfaceId) { case 1: { + if (gUniffiCallbackHandlerAdsClientMozAdsTelemetry) { + aError.ThrowUnknownError("[UniFFI] Callback handler already registered for MozAdsTelemetry"_ns); + return; + } + + gUniffiCallbackHandlerAdsClientMozAdsTelemetry = &aCallbackHandler; + uniffi_ads_client_fn_init_callback_vtable_mozadstelemetry(&kUniffiVtableAdsClientMozAdsTelemetry); + break; + } + case 2: { if (gUniffiCallbackHandlerContextIdContextIdCallback) { aError.ThrowUnknownError("[UniFFI] Callback handler already registered for ContextIdCallback"_ns); return; @@ -17239,7 +18724,7 @@ void RegisterCallbackHandler(uint64_t aInterfaceId, UniFFICallbackHandler& aCall uniffi_context_id_fn_init_callback_vtable_contextidcallback(&kUniffiVtableContextIdContextIdCallback); break; } - case 2: { + case 3: { if (gUniffiCallbackHandlerLoginsEncryptorDecryptor) { aError.ThrowUnknownError("[UniFFI] Callback handler already registered for EncryptorDecryptor"_ns); return; @@ -17249,7 +18734,7 @@ void RegisterCallbackHandler(uint64_t aInterfaceId, UniFFICallbackHandler& aCall uniffi_logins_fn_init_callback_vtable_encryptordecryptor(&kUniffiVtableLoginsEncryptorDecryptor); break; } - case 3: { + case 4: { if (gUniffiCallbackHandlerLoginsKeyManager) { aError.ThrowUnknownError("[UniFFI] Callback handler already registered for KeyManager"_ns); return; @@ -17259,7 +18744,7 @@ void RegisterCallbackHandler(uint64_t aInterfaceId, UniFFICallbackHandler& aCall uniffi_logins_fn_init_callback_vtable_keymanager(&kUniffiVtableLoginsKeyManager); break; } - case 4: { + case 5: { if (gUniffiCallbackHandlerLoginsPrimaryPasswordAuthenticator) { aError.ThrowUnknownError("[UniFFI] Callback handler already registered for PrimaryPasswordAuthenticator"_ns); return; @@ -17269,7 +18754,7 @@ void RegisterCallbackHandler(uint64_t aInterfaceId, UniFFICallbackHandler& aCall uniffi_logins_fn_init_callback_vtable_primarypasswordauthenticator(&kUniffiVtableLoginsPrimaryPasswordAuthenticator); break; } - case 5: { + case 6: { if (gUniffiCallbackHandlerTracingEventSink) { aError.ThrowUnknownError("[UniFFI] Callback handler already registered for EventSink"_ns); return; @@ -17279,7 +18764,7 @@ void RegisterCallbackHandler(uint64_t aInterfaceId, UniFFICallbackHandler& aCall uniffi_tracing_support_fn_init_callback_vtable_eventsink(&kUniffiVtableTracingEventSink); break; } - case 6: { + case 7: { if (gUniffiCallbackHandlerViaductBackend) { aError.ThrowUnknownError("[UniFFI] Callback handler already registered for Backend"_ns); return; @@ -17291,7 +18776,7 @@ void RegisterCallbackHandler(uint64_t aInterfaceId, UniFFICallbackHandler& aCall } #ifdef MOZ_UNIFFI_FIXTURES - case 7: { + case 8: { if (gUniffiCallbackHandlerUniffiBindingsTestsTestAsyncCallbackInterface) { aError.ThrowUnknownError("[UniFFI] Callback handler already registered for TestAsyncCallbackInterface"_ns); return; @@ -17301,7 +18786,7 @@ void RegisterCallbackHandler(uint64_t aInterfaceId, UniFFICallbackHandler& aCall uniffi_uniffi_bindings_tests_fn_init_callback_vtable_testasynccallbackinterface(&kUniffiVtableUniffiBindingsTestsTestAsyncCallbackInterface); break; } - case 8: { + case 9: { if (gUniffiCallbackHandlerUniffiBindingsTestsTestCallbackInterface) { aError.ThrowUnknownError("[UniFFI] Callback handler already registered for TestCallbackInterface"_ns); return; @@ -17311,7 +18796,7 @@ void RegisterCallbackHandler(uint64_t aInterfaceId, UniFFICallbackHandler& aCall uniffi_uniffi_bindings_tests_fn_init_callback_vtable_testcallbackinterface(&kUniffiVtableUniffiBindingsTestsTestCallbackInterface); break; } - case 9: { + case 10: { if (gUniffiCallbackHandlerUniffiBindingsTestsAsyncTestTraitInterface) { aError.ThrowUnknownError("[UniFFI] Callback handler already registered for AsyncTestTraitInterface"_ns); return; @@ -17321,7 +18806,7 @@ void RegisterCallbackHandler(uint64_t aInterfaceId, UniFFICallbackHandler& aCall uniffi_uniffi_bindings_tests_fn_init_callback_vtable_asynctesttraitinterface(&kUniffiVtableUniffiBindingsTestsAsyncTestTraitInterface); break; } - case 10: { + case 11: { if (gUniffiCallbackHandlerUniffiBindingsTestsTestTraitInterface) { aError.ThrowUnknownError("[UniFFI] Callback handler already registered for TestTraitInterface"_ns); return; @@ -17331,7 +18816,7 @@ void RegisterCallbackHandler(uint64_t aInterfaceId, UniFFICallbackHandler& aCall uniffi_uniffi_bindings_tests_fn_init_callback_vtable_testtraitinterface(&kUniffiVtableUniffiBindingsTestsTestTraitInterface); break; } - case 11: { + case 12: { if (gUniffiCallbackHandlerUniffiBindingsTestsCollisionTestCallbackInterface) { aError.ThrowUnknownError("[UniFFI] Callback handler already registered for TestCallbackInterface"_ns); return; @@ -17353,6 +18838,15 @@ void DeregisterCallbackHandler(uint64_t aInterfaceId, ErrorResult& aError) { switch (aInterfaceId) { case 1: { + if (!gUniffiCallbackHandlerAdsClientMozAdsTelemetry) { + aError.ThrowUnknownError("[UniFFI] Callback handler not registered for MozAdsTelemetry"_ns); + return; + } + + gUniffiCallbackHandlerAdsClientMozAdsTelemetry = nullptr; + break; + } + case 2: { if (!gUniffiCallbackHandlerContextIdContextIdCallback) { aError.ThrowUnknownError("[UniFFI] Callback handler not registered for ContextIdCallback"_ns); return; @@ -17361,7 +18855,7 @@ void DeregisterCallbackHandler(uint64_t aInterfaceId, ErrorResult& aError) { gUniffiCallbackHandlerContextIdContextIdCallback = nullptr; break; } - case 2: { + case 3: { if (!gUniffiCallbackHandlerLoginsEncryptorDecryptor) { aError.ThrowUnknownError("[UniFFI] Callback handler not registered for EncryptorDecryptor"_ns); return; @@ -17370,7 +18864,7 @@ void DeregisterCallbackHandler(uint64_t aInterfaceId, ErrorResult& aError) { gUniffiCallbackHandlerLoginsEncryptorDecryptor = nullptr; break; } - case 3: { + case 4: { if (!gUniffiCallbackHandlerLoginsKeyManager) { aError.ThrowUnknownError("[UniFFI] Callback handler not registered for KeyManager"_ns); return; @@ -17379,7 +18873,7 @@ void DeregisterCallbackHandler(uint64_t aInterfaceId, ErrorResult& aError) { gUniffiCallbackHandlerLoginsKeyManager = nullptr; break; } - case 4: { + case 5: { if (!gUniffiCallbackHandlerLoginsPrimaryPasswordAuthenticator) { aError.ThrowUnknownError("[UniFFI] Callback handler not registered for PrimaryPasswordAuthenticator"_ns); return; @@ -17388,7 +18882,7 @@ void DeregisterCallbackHandler(uint64_t aInterfaceId, ErrorResult& aError) { gUniffiCallbackHandlerLoginsPrimaryPasswordAuthenticator = nullptr; break; } - case 5: { + case 6: { if (!gUniffiCallbackHandlerTracingEventSink) { aError.ThrowUnknownError("[UniFFI] Callback handler not registered for EventSink"_ns); return; @@ -17397,7 +18891,7 @@ void DeregisterCallbackHandler(uint64_t aInterfaceId, ErrorResult& aError) { gUniffiCallbackHandlerTracingEventSink = nullptr; break; } - case 6: { + case 7: { if (!gUniffiCallbackHandlerViaductBackend) { aError.ThrowUnknownError("[UniFFI] Callback handler not registered for Backend"_ns); return; @@ -17408,7 +18902,7 @@ void DeregisterCallbackHandler(uint64_t aInterfaceId, ErrorResult& aError) { } #ifdef MOZ_UNIFFI_FIXTURES - case 7: { + case 8: { if (!gUniffiCallbackHandlerUniffiBindingsTestsTestAsyncCallbackInterface) { aError.ThrowUnknownError("[UniFFI] Callback handler not registered for TestAsyncCallbackInterface"_ns); return; @@ -17417,7 +18911,7 @@ void DeregisterCallbackHandler(uint64_t aInterfaceId, ErrorResult& aError) { gUniffiCallbackHandlerUniffiBindingsTestsTestAsyncCallbackInterface = nullptr; break; } - case 8: { + case 9: { if (!gUniffiCallbackHandlerUniffiBindingsTestsTestCallbackInterface) { aError.ThrowUnknownError("[UniFFI] Callback handler not registered for TestCallbackInterface"_ns); return; @@ -17426,7 +18920,7 @@ void DeregisterCallbackHandler(uint64_t aInterfaceId, ErrorResult& aError) { gUniffiCallbackHandlerUniffiBindingsTestsTestCallbackInterface = nullptr; break; } - case 9: { + case 10: { if (!gUniffiCallbackHandlerUniffiBindingsTestsAsyncTestTraitInterface) { aError.ThrowUnknownError("[UniFFI] Callback handler not registered for AsyncTestTraitInterface"_ns); return; @@ -17435,7 +18929,7 @@ void DeregisterCallbackHandler(uint64_t aInterfaceId, ErrorResult& aError) { gUniffiCallbackHandlerUniffiBindingsTestsAsyncTestTraitInterface = nullptr; break; } - case 10: { + case 11: { if (!gUniffiCallbackHandlerUniffiBindingsTestsTestTraitInterface) { aError.ThrowUnknownError("[UniFFI] Callback handler not registered for TestTraitInterface"_ns); return; @@ -17444,7 +18938,7 @@ void DeregisterCallbackHandler(uint64_t aInterfaceId, ErrorResult& aError) { gUniffiCallbackHandlerUniffiBindingsTestsTestTraitInterface = nullptr; break; } - case 11: { + case 12: { if (!gUniffiCallbackHandlerUniffiBindingsTestsCollisionTestCallbackInterface) { aError.ThrowUnknownError("[UniFFI] Callback handler not registered for TestCallbackInterface"_ns); return;