From cd84a13b7048cc2a8760593c9c307cd398ed5fd9 Mon Sep 17 00:00:00 2001 From: Mike Conley Date: Fri, 16 May 2025 20:08:58 +0000 Subject: [PATCH] Bug 1952316 - Create ContextId module to wrap RustContextId.sys.mjs. r=nanj,markh,chutten Differential Revision: https://phabricator.services.mozilla.com/D248973 --- browser/app/profile/firefox.js | 5 + browser/modules/ContextId.sys.mjs | 165 +++ browser/modules/metrics.yaml | 22 + browser/modules/moz.build | 4 + browser/modules/pings.yaml | 17 + .../test/unit/test_ContextId_LegacyBackend.js | 173 +++ .../test/unit/test_ContextId_RustBackend.js | 310 +++++ browser/modules/test/unit/xpcshell.toml | 6 + docs/rust-components/api/js/context_id.md | 10 + .../components/nimbus/FeatureManifest.yaml | 28 + .../generated/RustContextId.sys.mjs | 870 ++++++++++++++ .../generated/RustErrorsupport.sys.mjs | 6 +- .../generated/RustRelevancy.sys.mjs | 26 +- .../generated/RustRemoteSettings.sys.mjs | 40 +- .../components/generated/RustSearch.sys.mjs | 16 +- .../components/generated/RustSuggest.sys.mjs | 58 +- .../components/generated/RustTabs.sys.mjs | 62 +- .../generated/RustWebextstorage.sys.mjs | 52 +- .../uniffi-bindgen-gecko-js/components/lib.rs | 1 + .../components/moz.build | 1 + .../uniffi-bindgen-gecko-js/config.toml | 6 + .../fixtures/generated/RustArithmetic.sys.mjs | 8 +- .../generated/RustCustomTypes.sys.mjs | 18 +- .../generated/RustExternalTypes.sys.mjs | 6 +- .../generated/RustFixtureCallbacks.sys.mjs | 8 +- .../fixtures/generated/RustFutures.sys.mjs | 66 +- .../fixtures/generated/RustGeometry.sys.mjs | 4 +- .../fixtures/generated/RustRefcounts.sys.mjs | 10 +- .../fixtures/generated/RustRondpoint.sys.mjs | 132 +-- .../fixtures/generated/RustSprites.sys.mjs | 16 +- .../fixtures/generated/RustTodolist.sys.mjs | 34 +- .../RustUniffiTraitInterfaces.sys.mjs | 10 +- .../uniffi-js/GeneratedScaffolding.cpp | 1020 ++++++++++++----- 33 files changed, 2641 insertions(+), 569 deletions(-) create mode 100644 browser/modules/ContextId.sys.mjs create mode 100644 browser/modules/test/unit/test_ContextId_LegacyBackend.js create mode 100644 browser/modules/test/unit/test_ContextId_RustBackend.js create mode 100644 docs/rust-components/api/js/context_id.md create mode 100644 toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustContextId.sys.mjs diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index a639328fd0d9..b891db4eeb3b 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -3390,3 +3390,8 @@ pref("toolkit.contentRelevancy.enabled", false); pref("toolkit.contentRelevancy.ingestEnabled", false); // Pref to enable extra logging for the content relevancy feature pref("toolkit.contentRelevancy.log", false); + +// The number of days after which to rotate the context ID. 0 means to disable +// rotation altogether. +pref("browser.contextual-services.contextId.rotation-in-days", 0); +pref("browser.contextual-services.contextId.rust-component.enabled", false); diff --git a/browser/modules/ContextId.sys.mjs b/browser/modules/ContextId.sys.mjs new file mode 100644 index 000000000000..7b89544270f8 --- /dev/null +++ b/browser/modules/ContextId.sys.mjs @@ -0,0 +1,165 @@ +/* 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/. */ + +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; +import { ContextIdComponent } from "resource://gre/modules/RustContextId.sys.mjs"; + +const CONTEXT_ID_PREF = "browser.contextual-services.contextId"; +const CONTEXT_ID_TIMESTAMP_PREF = + "browser.contextual-services.contextId.timestamp-in-seconds"; +const CONTEXT_ID_ROTATION_DAYS_PREF = + "browser.contextual-services.contextId.rotation-in-days"; +const CONTEXT_ID_RUST_COMPONENT_ENABLED_PREF = + "browser.contextual-services.contextId.rust-component.enabled"; +const TOPIC_APP_QUIT = "quit-application"; + +const lazy = {}; + +XPCOMUtils.defineLazyPreferenceGetter( + lazy, + "CURRENT_CONTEXT_ID", + CONTEXT_ID_PREF, + "" +); + +/** + * A class that manages and (optionally) rotates the context ID, which is a + * a unique identifier used by Contextual Services. + */ +export class _ContextId extends EventTarget { + #comp = null; + #rotationDays = 0; + #rustComponentEnabled = false; + #observer = null; + + constructor() { + super(); + + this.#rustComponentEnabled = Services.prefs.getBoolPref( + CONTEXT_ID_RUST_COMPONENT_ENABLED_PREF, + false + ); + + if (this.#rustComponentEnabled) { + GleanPings.contextIdDeletionRequest.setEnabled(true); + + // We intentionally read this once at construction, and cache the result. + // This is because enabling or disabling rotation may affect external + // uses of _ContextId which (for example) send the context_id UUID to + // Shredder in the context-id-deletion-request ping (which we only want to + // do when rotation is disabled), and that sort of thing tends to get set + // once during startup. + this.#rotationDays = Services.prefs.getIntPref( + CONTEXT_ID_ROTATION_DAYS_PREF, + 0 + ); + this.#comp = ContextIdComponent.init( + lazy.CURRENT_CONTEXT_ID, + Services.prefs.getIntPref(CONTEXT_ID_TIMESTAMP_PREF, 0), + Cu.isInAutomation, + { + persist: (newContextId, creationTimestamp) => { + Services.prefs.setCharPref(CONTEXT_ID_PREF, newContextId); + Services.prefs.setIntPref( + CONTEXT_ID_TIMESTAMP_PREF, + creationTimestamp + ); + this.dispatchEvent(new CustomEvent("ContextId:Persisted")); + }, + + rotated: oldContextId => { + Glean.contextualServices.contextId.set(oldContextId); + GleanPings.contextIdDeletionRequest.submit(); + }, + } + ); + this.#observer = (subject, topic, data) => { + this.observe(subject, topic, data); + }; + + Services.obs.addObserver(this.#observer, TOPIC_APP_QUIT); + } + } + + /** + * nsIObserver implementation. + * + * @param {nsISupports} _subject + * @param {string} topic + * @param {string} _data + */ + observe(_subject, topic, _data) { + if (topic == TOPIC_APP_QUIT) { + // Unregister ourselves as the callback to avoid leak assertions. + this.#comp.unsetCallback(); + Services.obs.removeObserver(this.#observer, TOPIC_APP_QUIT); + } + } + + /** + * Returns the stored context ID for this profile, if one exists. If one + * doesn't exist, one is generated and then returned. In the event that + * context ID rotation is in effect, then this may return a different + * context ID if we've determined it's time to rotate. This means that + * consumers _should not_ cache the context ID, but always request it. + * + * @returns {Promise} + * The context ID for this profile. + */ + async request() { + if (this.#rustComponentEnabled) { + return this.#comp.request(this.#rotationDays); + } + + // Fallback to the legacy behaviour of just returning the pref, or + // generating / returning a UUID if the pref is false-y. + if (!lazy.CURRENT_CONTEXT_ID) { + let _contextId = Services.uuid.generateUUID().toString(); + Services.prefs.setStringPref(CONTEXT_ID_PREF, _contextId); + } + + return Promise.resolve(lazy.CURRENT_CONTEXT_ID); + } + + /** + * Forces the rotation of the context ID. This should be used by callers when + * some surface that uses the context ID is disabled. This is only supported + * with the Rust backend, and is a no-op when the Rust backend is not enabled. + * + * @returns {Promise} + */ + async forceRotation() { + if (this.#rustComponentEnabled) { + return this.#comp.forceRotation(); + } + return Promise.resolve(); + } + + /** + * Returns true if context ID rotation is enabled. + * + * @returns {boolean} + */ + get rotationEnabled() { + return this.#rustComponentEnabled && this.#rotationDays > 0; + } + + /** + * A compatibility shim that only works if rotationEnabled is false which + * returns the context ID synchronously. This will throw if rotationEnabled + * is true - so callers should ensure that rotationEnabled is false before + * using this. This will eventually be removed. + */ + requestSynchronously() { + if (this.rotationEnabled) { + throw new Error( + "Cannot request context ID synchronously when rotation is enabled." + ); + } + + return lazy.CURRENT_CONTEXT_ID; + } +} + +export const ContextId = new _ContextId(); diff --git a/browser/modules/metrics.yaml b/browser/modules/metrics.yaml index b38bdd913689..1ec2abc1345a 100644 --- a/browser/modules/metrics.yaml +++ b/browser/modules/metrics.yaml @@ -1661,3 +1661,25 @@ link_icon_sizes_attr: - fx-search-telemetry@mozilla.com expires: never telemetry_mirror: LINK_ICON_SIZES_ATTR_DIMENSION + +contextual_services: + context_id: + type: uuid + description: > + An identifier for Contextual Services user interaction pings. This is + used internally for counting unique users as well as for anti-fraud. It + is shared with other Contextual Services. + + Does not need to be sent in the Glean "deletion-request" ping. It is sent + in its own "context-id-deletion-request" ping. + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1952316 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1952316 + data_sensitivity: + - technical + notification_emails: + - mconley@mozilla.com + expires: never + send_in_pings: + - context-id-deletion-request diff --git a/browser/modules/moz.build b/browser/modules/moz.build index 1bfb841b7517..eb81a46ba6f8 100644 --- a/browser/modules/moz.build +++ b/browser/modules/moz.build @@ -146,6 +146,10 @@ EXTRA_JS_MODULES += [ "ZoomUI.sys.mjs", ] +MOZ_SRC_FILES += [ + "ContextId.sys.mjs", +] + if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": EXTRA_JS_MODULES += [ "FilePickerCrashed.sys.mjs", diff --git a/browser/modules/pings.yaml b/browser/modules/pings.yaml index 0bc4d2227fb7..465cd24ca930 100644 --- a/browser/modules/pings.yaml +++ b/browser/modules/pings.yaml @@ -20,3 +20,20 @@ prototype-no-code-events: - chutten@mozilla.com - tlong@mozilla.com enabled: false # To be enabled by Server Knobs for selected populations. + +context-id-deletion-request: + description: | + This ping is submitted when a context ID has been rotated. A rotation may + occur because a user has disabled a surface that uses the context ID, or + because the context ID age has exceeded some threshold. + include_client_id: false + send_if_empty: true + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1952316 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1952316 + notification_emails: + - mconley@mozilla.com + metadata: + follows_collection_enabled: false + include_info_sections: false diff --git a/browser/modules/test/unit/test_ContextId_LegacyBackend.js b/browser/modules/test/unit/test_ContextId_LegacyBackend.js new file mode 100644 index 000000000000..5a25704c1b10 --- /dev/null +++ b/browser/modules/test/unit/test_ContextId_LegacyBackend.js @@ -0,0 +1,173 @@ +/* Any copyright is dedicated to the Public Domain. +https://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const { _ContextId } = ChromeUtils.importESModule( + "moz-src:///browser/modules/ContextId.sys.mjs" +); + +const CONTEXT_ID_PREF = "browser.contextual-services.contextId"; +const CONTEXT_ID_TIMESTAMP_PREF = + "browser.contextual-services.contextId.timestamp-in-seconds"; +const CONTEXT_ID_ROTATION_DAYS_PREF = + "browser.contextual-services.contextId.rotation-in-days"; +const UUID_WITH_BRACES_REGEX = + /^\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\}$/i; +const TEST_CONTEXT_ID_WITH_BRACES = "{decafbad-0cd1-0cd2-0cd3-decafbad1000}"; + +do_get_profile(); + +/** + * Test that if there's a pre-existing contextID, we can get it, and that a + * timestamp will be generated for it. + */ +add_task(async function test_get_existing() { + Services.prefs.setCharPref(CONTEXT_ID_PREF, TEST_CONTEXT_ID_WITH_BRACES); + Services.prefs.clearUserPref(CONTEXT_ID_TIMESTAMP_PREF); + Services.prefs.setIntPref(CONTEXT_ID_ROTATION_DAYS_PREF, 0); + + let ContextId = new _ContextId(); + + Assert.equal( + await ContextId.request(), + TEST_CONTEXT_ID_WITH_BRACES, + "Should have gotten the stored context ID" + ); + + Assert.ok( + !Services.prefs.prefHasUserValue(CONTEXT_ID_TIMESTAMP_PREF), + "No timestamp was persisted." + ); + Assert.equal( + Services.prefs.getCharPref(CONTEXT_ID_PREF), + TEST_CONTEXT_ID_WITH_BRACES, + "The same context ID is still stored after requesting." + ); + + Assert.equal( + await ContextId.request(), + TEST_CONTEXT_ID_WITH_BRACES, + "Should have gotten the same stored context ID back again." + ); + + // We should be able to synchronously request the context ID in this + // configuration. + Assert.equal( + ContextId.requestSynchronously(), + TEST_CONTEXT_ID_WITH_BRACES, + "Got the stored context ID back synchronously." + ); +}); + +/** + * Test that if there's not a pre-existing contextID, we will generate one, but + * no timestamp will be generated for it. + */ +add_task(async function test_generate() { + Services.prefs.clearUserPref(CONTEXT_ID_PREF); + Services.prefs.clearUserPref(CONTEXT_ID_TIMESTAMP_PREF); + + let ContextId = new _ContextId(); + + const generatedContextID = await ContextId.request(); + + Assert.ok( + UUID_WITH_BRACES_REGEX.test(generatedContextID), + "Should have gotten a UUID generated for the context ID." + ); + + Assert.ok( + !Services.prefs.prefHasUserValue(CONTEXT_ID_TIMESTAMP_PREF), + "No timestamp was persisted." + ); + + Assert.equal( + await ContextId.request(), + generatedContextID, + "Should have gotten the same stored context ID back again." + ); + + // We should be able to synchronously request the context ID in this + // configuration. + Assert.equal( + ContextId.requestSynchronously(), + generatedContextID, + "Got the stored context ID back synchronously." + ); +}); + +/** + * Test that if we have a pre-existing context ID, and we (for some reason) + * have rotation period set to a non-zero value, and a creation timestamp + * exists, that the context ID does not rotate between requests. + */ +add_task(async function test_no_rotation() { + Services.prefs.setCharPref(CONTEXT_ID_PREF, TEST_CONTEXT_ID_WITH_BRACES); + Services.prefs.setIntPref(CONTEXT_ID_TIMESTAMP_PREF, 1); + Services.prefs.setIntPref(CONTEXT_ID_ROTATION_DAYS_PREF, 1); + // Let's say there's a 30 day rotation window. + const ROTATION_DAYS = 30; + Services.prefs.setIntPref(CONTEXT_ID_ROTATION_DAYS_PREF, ROTATION_DAYS); + + let ContextId = new _ContextId(); + + Assert.ok( + !ContextId.rotationEnabled, + "ContextId should report that rotation is not enabled." + ); + + Assert.equal( + await ContextId.request(), + TEST_CONTEXT_ID_WITH_BRACES, + "Should have gotten the stored context ID" + ); + Assert.equal( + Services.prefs.getIntPref(CONTEXT_ID_TIMESTAMP_PREF), + 1, + "The timestamp should not have changed." + ); + + // We should be able to synchronously request the context ID in this + // configuration. + Assert.equal( + ContextId.requestSynchronously(), + TEST_CONTEXT_ID_WITH_BRACES, + "Got the stored context ID back synchronously." + ); +}); + +/** + * Test that calling forceRotation is a no-op with the legacy backend. + */ +add_task(async function test_force_rotation() { + Services.prefs.setCharPref(CONTEXT_ID_PREF, TEST_CONTEXT_ID_WITH_BRACES); + Services.prefs.clearUserPref(CONTEXT_ID_TIMESTAMP_PREF); + + let ContextId = new _ContextId(); + Assert.equal( + await ContextId.request(), + TEST_CONTEXT_ID_WITH_BRACES, + "Should have gotten the stored context ID" + ); + + await ContextId.forceRotation(); + + Assert.equal( + await ContextId.request(), + TEST_CONTEXT_ID_WITH_BRACES, + "Should have gotten the stored context ID" + ); + Assert.ok( + !Services.prefs.prefHasUserValue(CONTEXT_ID_TIMESTAMP_PREF), + "The timestamp should not have changed." + ); + + // We should be able to synchronously request the context ID in this + // configuration. + Assert.equal( + ContextId.requestSynchronously(), + TEST_CONTEXT_ID_WITH_BRACES, + "Got the stored context ID back synchronously." + ); +}); diff --git a/browser/modules/test/unit/test_ContextId_RustBackend.js b/browser/modules/test/unit/test_ContextId_RustBackend.js new file mode 100644 index 000000000000..f3970db64892 --- /dev/null +++ b/browser/modules/test/unit/test_ContextId_RustBackend.js @@ -0,0 +1,310 @@ +/* Any copyright is dedicated to the Public Domain. +https://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const { _ContextId } = ChromeUtils.importESModule( + "moz-src:///browser/modules/ContextId.sys.mjs" +); + +const CONTEXT_ID_PREF = "browser.contextual-services.contextId"; +const CONTEXT_ID_TIMESTAMP_PREF = + "browser.contextual-services.contextId.timestamp-in-seconds"; +const CONTEXT_ID_ROTATION_DAYS_PREF = + "browser.contextual-services.contextId.rotation-in-days"; +const UUID_REGEX = + /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; +const TEST_CONTEXT_ID = "decafbad-0cd1-0cd2-0cd3-decafbad1000"; +const TEST_CONTEXT_ID_WITH_BRACES = "{" + TEST_CONTEXT_ID + "}"; +const TOPIC_APP_QUIT = "quit-application"; + +do_get_profile(); + +/** + * Resolves when the passed in ContextId instance fires the ContextId:Persisted + * event. + * + * @param {_ContextId} instance + * An instance of the _ContextId class under test. + * @returns {Promise} + */ +function waitForPersist(instance) { + return new Promise(resolve => { + instance.addEventListener("ContextId:Persisted", resolve, { once: true }); + }); +} + +/** + * Resolves when the the context-id-deletion-request ping is next sent, and + * checks that it sends the rotatedFromContextId value. + * + * @param {string} rotatedFromContextIed + * The context ID that was rotated away from. + * @param {Function} taskFn + * A function that will trigger the ping to be sent. This function might + * be async. + * @returns {Promise} + */ +function waitForRotated(rotatedFromContextId, taskFn) { + return GleanPings.contextIdDeletionRequest.testSubmission(() => { + Assert.equal( + Glean.contextualServices.contextId.testGetValue(), + rotatedFromContextId, + "Sent the right context ID to be deleted." + ); + }, taskFn); +} + +/** + * Checks that when a taskFn resolves, a context ID rotation has not occurred + * for the instance. + * + * @param {_ContextId} instance + * The instance of _ContextId under test. + * @param {function} taskFn + * A function that is being tested to ensure that it does not cause rotation + * to occur. It can be async. + * @returns {Promise} + */ +async function doesNotRotate(instance, taskFn) { + let controller = new AbortController(); + instance.addEventListener( + "ContextId:Rotated", + () => { + Assert.ok(false, "Saw unexpected rotation."); + }, + { signal: controller.signal } + ); + await taskFn(); + controller.abort(); +} + +/** + * Calls a testing function with a ContextId instance. Once the testing function + * resolves (or if it throws), this function will take care of cleaning up the + * instance. + * + * @param {function(_ContextId): Promise} taskFn + * A testing function, which will be passed an instance of _ContextId to run + * its test on. The function can be async. + * @returns {Promise} + */ +async function withTestingContextId(taskFn) { + let instance = new _ContextId(); + try { + await taskFn(instance); + } finally { + instance.observe(null, TOPIC_APP_QUIT, null); + } +} + +add_setup(() => { + Services.fog.initializeFOG(); + registerCleanupFunction(() => { + // Importing from ContextId.sys.mjs will have automatically instantiated + // and registered the default ContextId. We need to inform it that we're + // shutting down so that it can uninitialiez itself. + const { ContextId } = ChromeUtils.importESModule( + "moz-src:///browser/modules/ContextId.sys.mjs" + ); + + ContextId.observe(null, TOPIC_APP_QUIT, null); + }); +}); + +/** + * Test that if there's a pre-existing contextID, we can get it, and that a + * timestamp will be generated for it. + */ +add_task(async function test_get_existing() { + // Historically, we've stored the context ID with braces, but our endpoints + // actually would prefer just the raw UUID. The Rust component does the + // work of stripping those off for us automatically. We'll test that by + // starting with a context ID with braces in storage, and ensuring that + // what gets saved and what gets returned does not have braces. + Services.prefs.setCharPref(CONTEXT_ID_PREF, TEST_CONTEXT_ID_WITH_BRACES); + Services.prefs.clearUserPref(CONTEXT_ID_TIMESTAMP_PREF); + Services.prefs.setIntPref(CONTEXT_ID_ROTATION_DAYS_PREF, 0); + + await withTestingContextId(async instance => { + let persisted = waitForPersist(instance); + + Assert.equal( + await instance.request(), + TEST_CONTEXT_ID, + "Should have gotten the stored context ID" + ); + + await persisted; + Assert.equal( + typeof Services.prefs.getIntPref(CONTEXT_ID_TIMESTAMP_PREF, 0), + "number", + "We stored a timestamp for the context ID." + ); + Assert.equal( + Services.prefs.getCharPref(CONTEXT_ID_PREF), + TEST_CONTEXT_ID, + "We stored a the context ID without braces." + ); + + Assert.equal( + await instance.request(), + TEST_CONTEXT_ID, + "Should have gotten the same stored context ID back again." + ); + }); +}); + +/** + * Test that if there's not a pre-existing contextID, we will generate one, and + * a timestamp will be generated for it. + */ +add_task(async function test_generate() { + Services.prefs.clearUserPref(CONTEXT_ID_PREF); + Services.prefs.clearUserPref(CONTEXT_ID_TIMESTAMP_PREF); + + await withTestingContextId(async instance => { + let persisted = waitForPersist(instance); + + const generatedContextID = await instance.request(); + await persisted; + + Assert.ok( + UUID_REGEX.test(generatedContextID), + "Should have gotten a UUID generated for the context ID." + ); + Assert.equal( + typeof Services.prefs.getIntPref(CONTEXT_ID_TIMESTAMP_PREF, 0), + "number", + "We stored a timestamp for the context ID." + ); + + Assert.equal( + await instance.request(), + generatedContextID, + "Should have gotten the same stored context ID back again." + ); + }); +}); + +/** + * Test that if we have a pre-existing context ID, with an extremely old + * creation date (we'll use a creation date of 1, which is back in the 1970s), + * but a rotation setting of 0, that we don't rotate the context ID. + */ +add_task(async function test_no_rotation() { + Services.prefs.setCharPref(CONTEXT_ID_PREF, TEST_CONTEXT_ID); + Services.prefs.setIntPref(CONTEXT_ID_TIMESTAMP_PREF, 1); + Services.prefs.setIntPref(CONTEXT_ID_ROTATION_DAYS_PREF, 0); + + await withTestingContextId(async instance => { + Assert.ok( + !instance.rotationEnabled, + "ContextId should report that rotation is not enabled." + ); + + await doesNotRotate(instance, async () => { + Assert.equal( + await instance.request(), + TEST_CONTEXT_ID, + "Should have gotten the stored context ID" + ); + }); + + // We should be able to synchronously request the context ID in this + // configuration. + Assert.equal( + instance.requestSynchronously(), + TEST_CONTEXT_ID, + "Got the stored context ID back synchronously." + ); + }); +}); + +/** + * Test that if we have a pre-existing context ID, and if the age associated + * with it is greater than our rotation window, that we'll generate a new + * context ID and update the creation timestamp. We'll use a creation timestamp + * of the original context ID of 1, which is sometime in the 1970s. + */ +add_task(async function test_rotation() { + Services.prefs.setCharPref(CONTEXT_ID_PREF, TEST_CONTEXT_ID); + Services.prefs.setIntPref(CONTEXT_ID_TIMESTAMP_PREF, 1); + // Let's say there's a 30 day rotation window. + const ROTATION_DAYS = 30; + Services.prefs.setIntPref(CONTEXT_ID_ROTATION_DAYS_PREF, ROTATION_DAYS); + + await withTestingContextId(async instance => { + Assert.ok( + instance.rotationEnabled, + "ContextId should report that rotation is enabled." + ); + + let generatedContextID; + + await waitForRotated(TEST_CONTEXT_ID, async () => { + let persisted = waitForPersist(instance); + generatedContextID = await instance.request(); + await persisted; + }); + + Assert.ok( + UUID_REGEX.test(generatedContextID), + "Should have gotten a UUID generated for the context ID." + ); + + let creationTimestamp = Services.prefs.getIntPref( + CONTEXT_ID_TIMESTAMP_PREF + ); + // We should have bumped the creation timestamp. + Assert.greater(creationTimestamp, 1); + + // We should NOT be able to synchronously request the context ID in this + // configuration. + Assert.throws(() => { + instance.requestSynchronously(); + }, /Cannot request context ID synchronously/); + }); +}); + +/** + * Test that if we have a pre-existing context ID, we can force rotation even + * if the expiry hasn't come up. + */ +add_task(async function test_force_rotation() { + Services.prefs.setCharPref(CONTEXT_ID_PREF, TEST_CONTEXT_ID); + Services.prefs.clearUserPref(CONTEXT_ID_TIMESTAMP_PREF); + // Let's say there's a 30 day rotation window. + const ROTATION_DAYS = 30; + Services.prefs.setIntPref(CONTEXT_ID_ROTATION_DAYS_PREF, ROTATION_DAYS); + + await withTestingContextId(async instance => { + Assert.equal( + await instance.request(), + TEST_CONTEXT_ID, + "Should have gotten the stored context ID" + ); + + await waitForRotated(TEST_CONTEXT_ID, async () => { + await instance.forceRotation(); + }); + + let generatedContextID = await instance.request(); + + Assert.notEqual( + generatedContextID, + TEST_CONTEXT_ID, + "The context ID should have been regenerated." + ); + Assert.ok( + UUID_REGEX.test(generatedContextID), + "Should have gotten a UUID generated for the context ID." + ); + + // We should NOT be able to synchronously request the context ID in this + // configuration. + Assert.throws(() => { + instance.requestSynchronously(); + }, /Cannot request context ID synchronously/); + }); +}); diff --git a/browser/modules/test/unit/xpcshell.toml b/browser/modules/test/unit/xpcshell.toml index 5ef96bb156f6..b333bae4c56e 100644 --- a/browser/modules/test/unit/xpcshell.toml +++ b/browser/modules/test/unit/xpcshell.toml @@ -3,6 +3,12 @@ head = '' firefox-appdir = "browser" tags = "os_integration" +["test_ContextId_LegacyBackend.js"] +prefs = ["browser.contextual-services.contextId.rust-component.enabled=false"] + +["test_ContextId_RustBackend.js"] +prefs = ["browser.contextual-services.contextId.rust-component.enabled=true"] + ["test_Dedupe.js"] ["test_E10SUtils_nested_URIs.js"] diff --git a/docs/rust-components/api/js/context_id.md b/docs/rust-components/api/js/context_id.md new file mode 100644 index 000000000000..acd02459b42a --- /dev/null +++ b/docs/rust-components/api/js/context_id.md @@ -0,0 +1,10 @@ +# RustContextId.sys.mjs + +```{js:autoclass} RustContextId.sys.ContextIdComponent + :members: + :exclude-members: ContextIdComponent +``` +```{js:autoclass} RustContextId.sys.Other + :members: + :exclude-members: Other +``` diff --git a/toolkit/components/nimbus/FeatureManifest.yaml b/toolkit/components/nimbus/FeatureManifest.yaml index de30e1492180..af7dfcfb957f 100644 --- a/toolkit/components/nimbus/FeatureManifest.yaml +++ b/toolkit/components/nimbus/FeatureManifest.yaml @@ -4820,3 +4820,31 @@ expandSignInButton: - fxa-avatar-sign-up empty will be assumed default experience type: string + +contextID: + description: >- + Controls the behaviour of the context ID, which is a unique identifier used + by Contextual Services. + owner: mconley@mozilla.com + hasExposure: false + variables: + rotationPeriodInDays: + type: int + setPref: + branch: user + pref: "browser.contextual-services.contextId.rotation-in-days" + description: >- + The number of days since the creation of the context ID after which the + context ID should be regenerated. Set to 0 to disable rotation. This + value only takes effect if rustBackendEnabled is also true, otherwise + no rotation will occur regardless of the value. + + This setting will only be applied after the next restart. + rustBackendEnabled: + type: boolean + setPref: + branch: user + pref: "browser.contextual-services.contextId.rust-component.enabled" + description: >- + Enables the Rust component backend for ContextId.sys.mjs, which is + a prerequisite for doing rotations. 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 new file mode 100644 index 000000000000..b2e395a7a92d --- /dev/null +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustContextId.sys.mjs @@ -0,0 +1,870 @@ +// This file was autogenerated by the `uniffi-bindgen-gecko-js` crate. +// Trust me, you don't want to mess with it! + +import { UniFFITypeError } from "resource://gre/modules/UniFFI.sys.mjs"; + + + +// Objects intended to be used in the unit tests +export var UnitTestObjs = {}; + +// Write/Read data to/from an ArrayBuffer +class ArrayBufferDataStream { + constructor(arrayBuffer) { + this.dataView = new DataView(arrayBuffer); + this.pos = 0; + } + + readUint8() { + let rv = this.dataView.getUint8(this.pos); + this.pos += 1; + return rv; + } + + writeUint8(value) { + this.dataView.setUint8(this.pos, value); + this.pos += 1; + } + + readUint16() { + let rv = this.dataView.getUint16(this.pos); + this.pos += 2; + return rv; + } + + writeUint16(value) { + this.dataView.setUint16(this.pos, value); + this.pos += 2; + } + + readUint32() { + let rv = this.dataView.getUint32(this.pos); + this.pos += 4; + return rv; + } + + writeUint32(value) { + this.dataView.setUint32(this.pos, value); + this.pos += 4; + } + + readUint64() { + let rv = this.dataView.getBigUint64(this.pos); + this.pos += 8; + return Number(rv); + } + + writeUint64(value) { + this.dataView.setBigUint64(this.pos, BigInt(value)); + this.pos += 8; + } + + + readInt8() { + let rv = this.dataView.getInt8(this.pos); + this.pos += 1; + return rv; + } + + writeInt8(value) { + this.dataView.setInt8(this.pos, value); + this.pos += 1; + } + + readInt16() { + let rv = this.dataView.getInt16(this.pos); + this.pos += 2; + return rv; + } + + writeInt16(value) { + this.dataView.setInt16(this.pos, value); + this.pos += 2; + } + + readInt32() { + let rv = this.dataView.getInt32(this.pos); + this.pos += 4; + return rv; + } + + writeInt32(value) { + this.dataView.setInt32(this.pos, value); + this.pos += 4; + } + + readInt64() { + let rv = this.dataView.getBigInt64(this.pos); + this.pos += 8; + return Number(rv); + } + + writeInt64(value) { + this.dataView.setBigInt64(this.pos, BigInt(value)); + this.pos += 8; + } + + readFloat32() { + let rv = this.dataView.getFloat32(this.pos); + this.pos += 4; + return rv; + } + + writeFloat32(value) { + this.dataView.setFloat32(this.pos, value); + this.pos += 4; + } + + readFloat64() { + let rv = this.dataView.getFloat64(this.pos); + this.pos += 8; + return rv; + } + + writeFloat64(value) { + this.dataView.setFloat64(this.pos, value); + this.pos += 8; + } + + + writeString(value) { + const encoder = new TextEncoder(); + // Note: in order to efficiently write this data, we first write the + // string data, reserving 4 bytes for the size. + const dest = new Uint8Array(this.dataView.buffer, this.pos + 4); + const encodeResult = encoder.encodeInto(value, dest); + if (encodeResult.read != value.length) { + throw new UniFFIError( + "writeString: out of space when writing to ArrayBuffer. Did the computeSize() method returned the wrong result?" + ); + } + const size = encodeResult.written; + // Next, go back and write the size before the string data + this.dataView.setUint32(this.pos, size); + // Finally, advance our position past both the size and string data + this.pos += size + 4; + } + + readString() { + const decoder = new TextDecoder(); + const size = this.readUint32(); + const source = new Uint8Array(this.dataView.buffer, this.pos, size) + const value = decoder.decode(source); + this.pos += size; + return value; + } + + readBytes() { + const size = this.readInt32(); + const bytes = new Uint8Array(this.dataView.buffer, this.pos, size); + this.pos += size; + return bytes + } + + writeBytes(value) { + this.writeUint32(value.length); + value.forEach((elt) => { + this.writeUint8(elt); + }) + } + + // Reads a ContextIdComponent pointer from the data stream + // UniFFI Pointers are **always** 8 bytes long. That is enforced + // by the C++ and Rust Scaffolding code. + readPointerContextIdComponent() { + const pointerId = 0; // context_id:ContextIDComponent + const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); + this.pos += 8; + return res; + } + + // Writes a ContextIdComponent pointer into the data stream + // UniFFI Pointers are **always** 8 bytes long. That is enforced + // by the C++ and Rust Scaffolding code. + writePointerContextIdComponent(value) { + const pointerId = 0; // context_id:ContextIDComponent + UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); + this.pos += 8; + } + +} + +function handleRustResult(result, liftCallback, liftErrCallback) { + switch (result.code) { + case "success": + return liftCallback(result.data); + + case "error": + throw liftErrCallback(result.data); + + case "internal-error": + if (result.data) { + throw new UniFFIInternalError(FfiConverterString.lift(result.data)); + } else { + throw new UniFFIInternalError("Unknown error"); + } + + default: + throw new UniFFIError(`Unexpected status code: ${result.code}`); + } +} + +class UniFFIError { + constructor(message) { + this.message = message; + } + + toString() { + return `UniFFIError: ${this.message}` + } +} + +class UniFFIInternalError extends UniFFIError {} + +// Base class for FFI converters +class FfiConverter { + // throw `UniFFITypeError` if a value to be converted has an invalid type + static checkType(value) { + if (value === undefined ) { + throw new UniFFITypeError(`undefined`); + } + if (value === null ) { + throw new UniFFITypeError(`null`); + } + } +} + +// Base class for FFI converters that lift/lower by reading/writing to an ArrayBuffer +class FfiConverterArrayBuffer extends FfiConverter { + static lift(buf) { + return this.read(new ArrayBufferDataStream(buf)); + } + + static lower(value) { + const buf = new ArrayBuffer(this.computeSize(value)); + const dataStream = new ArrayBufferDataStream(buf); + this.write(dataStream, value); + return buf; + } + + /** + * Computes the size of the value. + * + * @param {*} _value + * @return {number} + */ + static computeSize(_value) { + throw new UniFFIInternalError("computeSize() should be declared in the derived class"); + } + + /** + * Reads the type from a data stream. + * + * @param {ArrayBufferDataStream} _dataStream + * @returns {any} + */ + static read(_dataStream) { + throw new UniFFIInternalError("read() should be declared in the derived class"); + } + + /** + * Writes the type to a data stream. + * + * @param {ArrayBufferDataStream} _dataStream + * @param {any} _value + */ + static write(_dataStream, _value) { + throw new UniFFIInternalError("write() should be declared in the derived class"); + } + +} + +// Symbols that are used to ensure that Object constructors +// can only be used with a proper UniFFI pointer +const uniffiObjectPtr = Symbol("uniffiObjectPtr"); +const constructUniffiObject = Symbol("constructUniffiObject"); +UnitTestObjs.uniffiObjectPtr = uniffiObjectPtr; + + +/** + * Handler for a single UniFFI CallbackInterface + * + * This class stores objects that implement a callback interface in a handle + * map, allowing them to be referenced by the Rust code using an integer + * handle. + * + * While the callback object is stored in the map, it allows the Rust code to + * call methods on the object using the callback object handle, a method id, + * and an ArrayBuffer packed with the method arguments. + * + * When the Rust code drops its reference, it sends a call with the methodId=0, + * which causes callback object to be removed from the map. + */ +class UniFFICallbackHandler { + #name; + #interfaceId; + #handleCounter; + #handleMap; + #methodHandlers; + #allowNewCallbacks + + /** + * Create a UniFFICallbackHandler + * @param {string} name - Human-friendly name for this callback interface + * @param {int} interfaceId - Interface ID for this CallbackInterface. + * @param {UniFFICallbackMethodHandler[]} methodHandlers -- UniFFICallbackHandler for each method, in the same order as the UDL file + */ + constructor(name, interfaceId, methodHandlers) { + this.#name = name; + this.#interfaceId = interfaceId; + this.#handleCounter = 0; + this.#handleMap = new Map(); + this.#methodHandlers = methodHandlers; + this.#allowNewCallbacks = true; + + UniFFIScaffolding.registerCallbackHandler(this.#interfaceId, this); + Services.obs.addObserver(this, "xpcom-shutdown"); + } + + /** + * Store a callback object in the handle map and return the handle + * + * @param {obj} callbackObj - Object that implements the callback interface + * @returns {int} - Handle for this callback object, this is what gets passed back to Rust. + */ + storeCallbackObj(callbackObj) { + if (!this.#allowNewCallbacks) { + throw new UniFFIError(`No new callbacks allowed for ${this.#name}`); + } + const handle = this.#handleCounter; + this.#handleCounter += 1; + this.#handleMap.set(handle, new UniFFICallbackHandleMapEntry(callbackObj, Components.stack.caller.formattedStack.trim())); + return handle; + } + + /** + * Get a previously stored callback object + * + * @param {int} handle - Callback object handle, returned from `storeCallbackObj()` + * @returns {obj} - Callback object + */ + getCallbackObj(handle) { + return this.#handleMap.get(handle).callbackObj; + } + + /** + * Set if new callbacks are allowed for this handler + * + * This is called with false during shutdown to ensure the callback maps don't + * prevent JS objects from being GCed. + */ + setAllowNewCallbacks(allow) { + this.#allowNewCallbacks = allow + } + + /** + * Check that no callbacks are currently registered + * + * If there are callbacks registered a UniFFIError will be thrown. This is + * called during shutdown to generate an alert if there are leaked callback + * interfaces. + */ + assertNoRegisteredCallbacks() { + if (this.#handleMap.size > 0) { + const entry = this.#handleMap.values().next().value; + throw new UniFFIError(`UniFFI interface ${this.#name} has ${this.#handleMap.size} registered callbacks at xpcom-shutdown. This likely indicates a UniFFI callback leak.\nStack trace for the first leaked callback:\n${entry.stackTrace}.`); + } + } + + /** + * Invoke a method on a stored callback object + * @param {int} handle - Object handle + * @param {int} methodId - Method index (0-based) + * @param {UniFFIScaffoldingValue[]} args - Arguments to pass to the method + */ + call(handle, methodId, ...args) { + try { + this.#invokeCallbackInner(handle, methodId, args); + } catch (e) { + console.error(`internal error invoking callback: ${e}`) + } + } + + /** + * Destroy a stored callback object + * @param {int} handle - Object handle + */ + destroy(handle) { + this.#handleMap.delete(handle); + } + + #invokeCallbackInner(handle, methodId, args) { + const callbackObj = this.getCallbackObj(handle); + if (callbackObj === undefined) { + throw new UniFFIError(`${this.#name}: invalid callback handle id: ${handle}`); + } + + // Get the method data, converting from 1-based indexing + const methodHandler = this.#methodHandlers[methodId]; + if (methodHandler === undefined) { + throw new UniFFIError(`${this.#name}: invalid method id: ${methodId}`) + } + + methodHandler.call(callbackObj, args); + } + + /** + * xpcom-shutdown observer method + * + * This handles: + * - Deregistering ourselves as the UniFFI callback handler + * - Checks for any leftover stored callbacks which indicate memory leaks + */ + observe(aSubject, aTopic, aData) { + if (aTopic == "xpcom-shutdown") { + try { + this.setAllowNewCallbacks(false); + this.assertNoRegisteredCallbacks(); + UniFFIScaffolding.deregisterCallbackHandler(this.#interfaceId); + } catch (ex) { + console.error(`UniFFI Callback interface error during xpcom-shutdown: ${ex}`); + Cc["@mozilla.org/xpcom/debug;1"] + .getService(Ci.nsIDebug2) + .abort(ex.filename, ex.lineNumber); + } + } + } +} + +/** + * Handles calling a single method for a callback interface + */ +class UniFFICallbackMethodHandler { + #name; + #argsConverters; + + /** + * Create a UniFFICallbackMethodHandler + + * @param {string} name -- Name of the method to call on the callback object + * @param {FfiConverter[]} argsConverters - FfiConverter for each argument type + */ + constructor(name, argsConverters) { + this.#name = name; + this.#argsConverters = argsConverters; + } + + /** + * Invoke the method + * + * @param {obj} callbackObj -- Object implementing the callback interface for this method + * @param {ArrayBuffer} argsArrayBuffer -- Arguments for the method, packed in an ArrayBuffer + */ + call(callbackObj, args) { + const convertedArgs = this.#argsConverters.map((converter, i) => converter.lift(args[i])); + return callbackObj[this.#name](...convertedArgs); + } +} + +/** + * UniFFICallbackHandler.handleMap entry + * + * @property callbackObj - Callback object, this must implement the callback interface. + * @property {string} stackTrace - Stack trace from when the callback object was registered. This is used to proved extra context when debugging leaked callback objects. + */ +class UniFFICallbackHandleMapEntry { + constructor(callbackObj, stackTrace) { + this.callbackObj = callbackObj; + this.stackTrace = stackTrace + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterU8 extends FfiConverter { + static checkType(value) { + super.checkType(value); + if (!Number.isInteger(value)) { + throw new UniFFITypeError(`${value} is not an integer`); + } + if (value < 0 || value > 256) { + throw new UniFFITypeError(`${value} exceeds the U8 bounds`); + } + } + static computeSize(_value) { + return 1; + } + static lift(value) { + return value; + } + static lower(value) { + return value; + } + static write(dataStream, value) { + dataStream.writeUint8(value) + } + static read(dataStream) { + return dataStream.readUint8() + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterI64 extends FfiConverter { + static checkType(value) { + super.checkType(value); + if (!Number.isSafeInteger(value)) { + throw new UniFFITypeError(`${value} exceeds the safe integer bounds`); + } + } + static computeSize(_value) { + return 8; + } + static lift(value) { + return value; + } + static lower(value) { + return value; + } + static write(dataStream, value) { + dataStream.writeInt64(value) + } + static read(dataStream) { + return dataStream.readInt64() + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterBool extends FfiConverter { + static computeSize(_value) { + return 1; + } + static lift(value) { + return value == 1; + } + static lower(value) { + if (value) { + return 1; + } else { + return 0; + } + } + static write(dataStream, value) { + dataStream.writeUint8(this.lower(value)) + } + static read(dataStream) { + return this.lift(dataStream.readUint8()) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterString extends FfiConverter { + static checkType(value) { + super.checkType(value); + if (typeof value !== "string") { + throw new UniFFITypeError(`${value} is not a string`); + } + } + + static lift(buf) { + const decoder = new TextDecoder(); + const utf8Arr = new Uint8Array(buf); + return decoder.decode(utf8Arr); + } + static lower(value) { + const encoder = new TextEncoder(); + return encoder.encode(value).buffer; + } + + static write(dataStream, value) { + dataStream.writeString(value); + } + + static read(dataStream) { + return dataStream.readString(); + } + + static computeSize(value) { + const encoder = new TextEncoder(); + return 4 + encoder.encode(value).length + } +} + +/** + * Top-level API for the context_id component + */ +export class ContextIdComponent { + // Use `init` to instantiate this class. + // DO NOT USE THIS CONSTRUCTOR DIRECTLY + constructor(opts) { + if (!Object.prototype.hasOwnProperty.call(opts, constructUniffiObject)) { + throw new UniFFIError("Attempting to construct an object using the JavaScript constructor directly" + + "Please use a UDL defined constructor, or the init function for the primary constructor") + } + if (!(opts[constructUniffiObject] instanceof UniFFIPointer)) { + throw new UniFFIError("Attempting to create a UniFFI object with a pointer that is not an instance of UniFFIPointer") + } + this[uniffiObjectPtr] = opts[constructUniffiObject]; + } + /** + * Construct a new [ContextIDComponent]. + * + * If no creation timestamp is provided, the current time will be used. + * @returns {ContextIdComponent} + */ + static init(initContextId,creationTimestampS,runningInTestAutomation,callback) { + const liftResult = (result) => FfiConverterTypeContextIdComponent.lift(result); + const liftError = (data) => FfiConverterTypeApiError.lift(data); + const functionCall = () => { + try { + FfiConverterString.checkType(initContextId) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("initContextId"); + } + throw e; + } + try { + FfiConverterI64.checkType(creationTimestampS) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("creationTimestampS"); + } + throw e; + } + try { + FfiConverterBool.checkType(runningInTestAutomation) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("runningInTestAutomation"); + } + throw e; + } + try { + FfiConverterTypeContextIdCallback.checkType(callback) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("callback"); + } + throw e; + } + return UniFFIScaffolding.callSync( + 3, // context_id:uniffi_context_id_fn_constructor_contextidcomponent_new + FfiConverterString.lower(initContextId), + FfiConverterI64.lower(creationTimestampS), + FfiConverterBool.lower(runningInTestAutomation), + FfiConverterTypeContextIdCallback.lower(callback), + ) + } + return handleRustResult(functionCall(), liftResult, liftError);} + + /** + * Regenerate the context ID. + */ + forceRotation() { + const liftResult = (result) => undefined; + const liftError = (data) => FfiConverterTypeApiError.lift(data); + const functionCall = () => { + return UniFFIScaffolding.callAsyncWrapper( + 0, // context_id:uniffi_context_id_fn_method_contextidcomponent_force_rotation + FfiConverterTypeContextIdComponent.lower(this), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + /** + * Return the current context ID string. + * @returns {string} + */ + request(rotationDaysInS) { + const liftResult = (result) => FfiConverterString.lift(result); + const liftError = (data) => FfiConverterTypeApiError.lift(data); + const functionCall = () => { + try { + FfiConverterU8.checkType(rotationDaysInS) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("rotationDaysInS"); + } + throw e; + } + return UniFFIScaffolding.callAsyncWrapper( + 1, // context_id:uniffi_context_id_fn_method_contextidcomponent_request + FfiConverterTypeContextIdComponent.lower(this), + FfiConverterU8.lower(rotationDaysInS), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + /** + * Unset the callbacks set during construction, and use a default + * no-op ContextIdCallback instead. + */ + unsetCallback() { + const liftResult = (result) => undefined; + const liftError = (data) => FfiConverterTypeApiError.lift(data); + const functionCall = () => { + return UniFFIScaffolding.callAsyncWrapper( + 2, // context_id:uniffi_context_id_fn_method_contextidcomponent_unset_callback + FfiConverterTypeContextIdComponent.lower(this), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeContextIdComponent extends FfiConverter { + static lift(value) { + const opts = {}; + opts[constructUniffiObject] = value; + return new ContextIdComponent(opts); + } + + static lower(value) { + const ptr = value[uniffiObjectPtr]; + if (!(ptr instanceof UniFFIPointer)) { + throw new UniFFITypeError("Object is not a 'ContextIdComponent' instance"); + } + return ptr; + } + + static read(dataStream) { + return this.lift(dataStream.readPointerContextIdComponent()); + } + + static write(dataStream, value) { + dataStream.writePointerContextIdComponent(value[uniffiObjectPtr]); + } + + static computeSize(value) { + return 8; + } +} + + + + +/** + * ApiError + */ +export class ApiError extends Error {} + + +/** + * Other + */ +export class Other extends ApiError { + + 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 FfiConverterTypeApiError extends FfiConverterArrayBuffer { + static read(dataStream) { + switch (dataStream.readInt32()) { + case 1: + return new Other( + FfiConverterString.read(dataStream) + ); + default: + throw new UniFFITypeError("Unknown ApiError 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 ApiError variant"); + } + static write(dataStream, value) { + if (value instanceof Other) { + dataStream.writeInt32(1); + FfiConverterString.write(dataStream, value.reason); + return; + } + throw new UniFFITypeError("Unknown ApiError variant"); + } + + static errorClass = ApiError; +} + + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeContextIdCallback extends FfiConverter { + static lower(callbackObj) { + return callbackHandlerContextIdCallback.storeCallbackObj(callbackObj) + } + + static lift(handleId) { + return callbackHandlerContextIdCallback.getCallbackObj(handleId) + } + + static read(dataStream) { + return this.lift(dataStream.readInt64()) + } + + static write(dataStream, callbackObj) { + dataStream.writeInt64(this.lower(callbackObj)) + } + + static computeSize(callbackObj) { + return 8; + } +} + + +// Define callback interface handlers, this must come after the type loop since they reference the FfiConverters defined above. + +const callbackHandlerContextIdCallback = new UniFFICallbackHandler( + "context_id:ContextIdCallback", + 0, + [ + new UniFFICallbackMethodHandler( + "persist", + [ + FfiConverterString, + FfiConverterI64, + ], + ), + new UniFFICallbackMethodHandler( + "rotated", + [ + FfiConverterString, + ], + ), + ] +); + +// Allow the shutdown-related functionality to be tested in the unit tests +UnitTestObjs.callbackHandlerContextIdCallback = callbackHandlerContextIdCallback; + + + + diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustErrorsupport.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustErrorsupport.sys.mjs index 7797ef212353..6a8145ffdbda 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustErrorsupport.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustErrorsupport.sys.mjs @@ -549,7 +549,7 @@ export class FfiConverterTypeApplicationErrorReporter extends FfiConverter { const callbackHandlerApplicationErrorReporter = new UniFFICallbackHandler( "errorsupport:ApplicationErrorReporter", - 0, + 1, [ new UniFFICallbackMethodHandler( "reportError", @@ -594,7 +594,7 @@ export function setApplicationErrorReporter(errorReporter) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 0, // errorsupport:uniffi_error_support_fn_func_set_application_error_reporter + 4, // errorsupport:uniffi_error_support_fn_func_set_application_error_reporter FfiConverterTypeApplicationErrorReporter.lower(errorReporter), ) } @@ -615,7 +615,7 @@ export function unsetApplicationErrorReporter() { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 1, // errorsupport:uniffi_error_support_fn_func_unset_application_error_reporter + 5, // errorsupport:uniffi_error_support_fn_func_unset_application_error_reporter ) } try { 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 ab4db7ae1efa..c459af3c1e77 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 @@ -172,7 +172,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerRelevancyStore() { - const pointerId = 0; // relevancy:RelevancyStore + const pointerId = 1; // relevancy:RelevancyStore const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -182,7 +182,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerRelevancyStore(value) { - const pointerId = 0; // relevancy:RelevancyStore + const pointerId = 1; // relevancy:RelevancyStore UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -459,7 +459,7 @@ export class RelevancyStore { throw e; } return UniFFIScaffolding.callSync( - 12, // relevancy:uniffi_relevancy_fn_constructor_relevancystore_new + 16, // relevancy:uniffi_relevancy_fn_constructor_relevancystore_new FfiConverterString.lower(dbPath), FfiConverterTypeRemoteSettingsService.lower(remoteSettings), ) @@ -495,7 +495,7 @@ export class RelevancyStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 3, // relevancy:uniffi_relevancy_fn_method_relevancystore_bandit_init + 7, // relevancy:uniffi_relevancy_fn_method_relevancystore_bandit_init FfiConverterTypeRelevancyStore.lower(this), FfiConverterString.lower(bandit), FfiConverterSequencestring.lower(arms), @@ -539,7 +539,7 @@ export class RelevancyStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 4, // relevancy:uniffi_relevancy_fn_method_relevancystore_bandit_select + 8, // relevancy:uniffi_relevancy_fn_method_relevancystore_bandit_select FfiConverterTypeRelevancyStore.lower(this), FfiConverterString.lower(bandit), FfiConverterSequencestring.lower(arms), @@ -590,7 +590,7 @@ export class RelevancyStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 5, // relevancy:uniffi_relevancy_fn_method_relevancystore_bandit_update + 9, // relevancy:uniffi_relevancy_fn_method_relevancystore_bandit_update FfiConverterTypeRelevancyStore.lower(this), FfiConverterString.lower(bandit), FfiConverterString.lower(arm), @@ -614,7 +614,7 @@ export class RelevancyStore { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 6, // relevancy:uniffi_relevancy_fn_method_relevancystore_close + 10, // relevancy:uniffi_relevancy_fn_method_relevancystore_close FfiConverterTypeRelevancyStore.lower(this), ) } @@ -629,7 +629,7 @@ export class RelevancyStore { const liftError = (data) => FfiConverterTypeRelevancyApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 7, // relevancy:uniffi_relevancy_fn_method_relevancystore_ensure_interest_data_populated + 11, // relevancy:uniffi_relevancy_fn_method_relevancystore_ensure_interest_data_populated FfiConverterTypeRelevancyStore.lower(this), ) } @@ -665,7 +665,7 @@ export class RelevancyStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 8, // relevancy:uniffi_relevancy_fn_method_relevancystore_get_bandit_data + 12, // relevancy:uniffi_relevancy_fn_method_relevancystore_get_bandit_data FfiConverterTypeRelevancyStore.lower(this), FfiConverterString.lower(bandit), FfiConverterString.lower(arm), @@ -705,7 +705,7 @@ export class RelevancyStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 9, // relevancy:uniffi_relevancy_fn_method_relevancystore_ingest + 13, // relevancy:uniffi_relevancy_fn_method_relevancystore_ingest FfiConverterTypeRelevancyStore.lower(this), FfiConverterSequencestring.lower(topUrlsByFrecency), ) @@ -725,7 +725,7 @@ export class RelevancyStore { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 10, // relevancy:uniffi_relevancy_fn_method_relevancystore_interrupt + 14, // relevancy:uniffi_relevancy_fn_method_relevancystore_interrupt FfiConverterTypeRelevancyStore.lower(this), ) } @@ -744,7 +744,7 @@ export class RelevancyStore { const liftError = (data) => FfiConverterTypeRelevancyApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 11, // relevancy:uniffi_relevancy_fn_method_relevancystore_user_interest_vector + 15, // relevancy:uniffi_relevancy_fn_method_relevancystore_user_interest_vector FfiConverterTypeRelevancyStore.lower(this), ) } @@ -2008,7 +2008,7 @@ export function score(interestVector,contentCategories) { throw e; } return UniFFIScaffolding.callSync( - 2, // relevancy:uniffi_relevancy_fn_func_score + 6, // relevancy:uniffi_relevancy_fn_func_score FfiConverterTypeInterestVector.lower(interestVector), FfiConverterSequenceTypeInterest.lower(contentCategories), ) 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 3e85f91e68b9..9bb8735b7180 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 @@ -172,7 +172,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerRemoteSettings() { - const pointerId = 1; // remote_settings:RemoteSettings + const pointerId = 2; // remote_settings:RemoteSettings const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -182,7 +182,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerRemoteSettings(value) { - const pointerId = 1; // remote_settings:RemoteSettings + const pointerId = 2; // remote_settings:RemoteSettings UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -192,7 +192,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerRemoteSettingsClient() { - const pointerId = 2; // remote_settings:RemoteSettingsClient + const pointerId = 3; // remote_settings:RemoteSettingsClient const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -202,7 +202,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerRemoteSettingsClient(value) { - const pointerId = 2; // remote_settings:RemoteSettingsClient + const pointerId = 3; // remote_settings:RemoteSettingsClient UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -212,7 +212,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerRemoteSettingsService() { - const pointerId = 3; // remote_settings:RemoteSettingsService + const pointerId = 4; // remote_settings:RemoteSettingsService const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -222,7 +222,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerRemoteSettingsService(value) { - const pointerId = 3; // remote_settings:RemoteSettingsService + const pointerId = 4; // remote_settings:RemoteSettingsService UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -464,7 +464,7 @@ export class RemoteSettings { throw e; } return UniFFIScaffolding.callSync( - 16, // remote_settings:uniffi_remote_settings_fn_constructor_remotesettings_new + 20, // remote_settings:uniffi_remote_settings_fn_constructor_remotesettings_new FfiConverterTypeRemoteSettingsConfig.lower(remoteSettingsConfig), ) } @@ -494,7 +494,7 @@ export class RemoteSettings { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 13, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path + 17, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path FfiConverterTypeRemoteSettings.lower(this), FfiConverterString.lower(attachmentId), FfiConverterString.lower(path), @@ -516,7 +516,7 @@ export class RemoteSettings { const liftError = (data) => FfiConverterTypeRemoteSettingsError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 14, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records + 18, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records FfiConverterTypeRemoteSettings.lower(this), ) } @@ -545,7 +545,7 @@ export class RemoteSettings { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 15, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records_since + 19, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records_since FfiConverterTypeRemoteSettings.lower(this), FfiConverterU64.lower(timestamp), ) @@ -616,7 +616,7 @@ export class RemoteSettingsClient { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 17, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsclient_collection_name + 21, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsclient_collection_name FfiConverterTypeRemoteSettingsClient.lower(this), ) } @@ -652,7 +652,7 @@ export class RemoteSettingsClient { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 18, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsclient_get_attachment + 22, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsclient_get_attachment FfiConverterTypeRemoteSettingsClient.lower(this), FfiConverterTypeRemoteSettingsRecord.lower(record), ) @@ -696,7 +696,7 @@ export class RemoteSettingsClient { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 19, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsclient_get_records + 23, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsclient_get_records FfiConverterTypeRemoteSettingsClient.lower(this), FfiConverterBool.lower(syncIfEmpty), ) @@ -728,7 +728,7 @@ export class RemoteSettingsClient { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 20, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsclient_get_records_map + 24, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsclient_get_records_map FfiConverterTypeRemoteSettingsClient.lower(this), FfiConverterBool.lower(syncIfEmpty), ) @@ -748,7 +748,7 @@ export class RemoteSettingsClient { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 21, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsclient_shutdown + 25, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsclient_shutdown FfiConverterTypeRemoteSettingsClient.lower(this), ) } @@ -767,7 +767,7 @@ export class RemoteSettingsClient { const liftError = (data) => FfiConverterTypeRemoteSettingsError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 22, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsclient_sync + 26, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsclient_sync FfiConverterTypeRemoteSettingsClient.lower(this), ) } @@ -862,7 +862,7 @@ export class RemoteSettingsService { throw e; } return UniFFIScaffolding.callSync( - 26, // remote_settings:uniffi_remote_settings_fn_constructor_remotesettingsservice_new + 30, // remote_settings:uniffi_remote_settings_fn_constructor_remotesettingsservice_new FfiConverterString.lower(storageDir), FfiConverterTypeRemoteSettingsConfig2.lower(config), ) @@ -888,7 +888,7 @@ export class RemoteSettingsService { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 23, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsservice_make_client + 27, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsservice_make_client FfiConverterTypeRemoteSettingsService.lower(this), FfiConverterString.lower(collectionName), ) @@ -909,7 +909,7 @@ export class RemoteSettingsService { const liftError = (data) => FfiConverterTypeRemoteSettingsError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 24, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsservice_sync + 28, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsservice_sync FfiConverterTypeRemoteSettingsService.lower(this), ) } @@ -942,7 +942,7 @@ export class RemoteSettingsService { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 25, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsservice_update_config + 29, // remote_settings:uniffi_remote_settings_fn_method_remotesettingsservice_update_config FfiConverterTypeRemoteSettingsService.lower(this), FfiConverterTypeRemoteSettingsConfig2.lower(config), ) 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 8b23b99bb744..d54d4eed66e9 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 @@ -172,7 +172,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerSearchEngineSelector() { - const pointerId = 4; // search:SearchEngineSelector + const pointerId = 5; // search:SearchEngineSelector const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -182,7 +182,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerSearchEngineSelector(value) { - const pointerId = 4; // search:SearchEngineSelector + const pointerId = 5; // search:SearchEngineSelector UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -396,7 +396,7 @@ export class SearchEngineSelector { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 32, // search:uniffi_search_fn_constructor_searchengineselector_new + 36, // search:uniffi_search_fn_constructor_searchengineselector_new ) } return handleRustResult(functionCall(), liftResult, liftError);} @@ -411,7 +411,7 @@ export class SearchEngineSelector { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 27, // search:uniffi_search_fn_method_searchengineselector_clear_search_config + 31, // search:uniffi_search_fn_method_searchengineselector_clear_search_config FfiConverterTypeSearchEngineSelector.lower(this), ) } @@ -437,7 +437,7 @@ export class SearchEngineSelector { throw e; } return UniFFIScaffolding.callSync( - 28, // search:uniffi_search_fn_method_searchengineselector_filter_engine_configuration + 32, // search:uniffi_search_fn_method_searchengineselector_filter_engine_configuration FfiConverterTypeSearchEngineSelector.lower(this), FfiConverterTypeSearchUserEnvironment.lower(userEnvironment), ) @@ -461,7 +461,7 @@ export class SearchEngineSelector { throw e; } return UniFFIScaffolding.callSync( - 29, // search:uniffi_search_fn_method_searchengineselector_set_config_overrides + 33, // search:uniffi_search_fn_method_searchengineselector_set_config_overrides FfiConverterTypeSearchEngineSelector.lower(this), FfiConverterString.lower(overrides), ) @@ -489,7 +489,7 @@ export class SearchEngineSelector { throw e; } return UniFFIScaffolding.callSync( - 30, // search:uniffi_search_fn_method_searchengineselector_set_search_config + 34, // search:uniffi_search_fn_method_searchengineselector_set_search_config FfiConverterTypeSearchEngineSelector.lower(this), FfiConverterString.lower(configuration), ) @@ -530,7 +530,7 @@ export class SearchEngineSelector { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 31, // search:uniffi_search_fn_method_searchengineselector_use_remote_settings_server + 35, // search:uniffi_search_fn_method_searchengineselector_use_remote_settings_server FfiConverterTypeSearchEngineSelector.lower(this), FfiConverterTypeRemoteSettingsService.lower(service), FfiConverterBool.lower(applyEngineOverrides), 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 7a816edbf063..d8ccb92e7f79 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 @@ -172,7 +172,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerSuggestStore() { - const pointerId = 5; // suggest:SuggestStore + const pointerId = 6; // suggest:SuggestStore const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -182,7 +182,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerSuggestStore(value) { - const pointerId = 5; // suggest:SuggestStore + const pointerId = 6; // suggest:SuggestStore UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -192,7 +192,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerSuggestStoreBuilder() { - const pointerId = 6; // suggest:SuggestStoreBuilder + const pointerId = 7; // suggest:SuggestStoreBuilder const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -202,7 +202,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerSuggestStoreBuilder(value) { - const pointerId = 6; // suggest:SuggestStoreBuilder + const pointerId = 7; // suggest:SuggestStoreBuilder UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -551,7 +551,7 @@ export class SuggestStore { throw e; } return UniFFIScaffolding.callSync( - 49, // suggest:uniffi_suggest_fn_constructor_suggeststore_new + 53, // suggest:uniffi_suggest_fn_constructor_suggeststore_new FfiConverterString.lower(path), FfiConverterTypeRemoteSettingsService.lower(remoteSettingsService), ) @@ -567,7 +567,7 @@ export class SuggestStore { const liftError = (data) => FfiConverterTypeSuggestApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 34, // suggest:uniffi_suggest_fn_method_suggeststore_any_dismissed_suggestions + 38, // suggest:uniffi_suggest_fn_method_suggeststore_any_dismissed_suggestions FfiConverterTypeSuggestStore.lower(this), ) } @@ -586,7 +586,7 @@ export class SuggestStore { const liftError = (data) => FfiConverterTypeSuggestApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 35, // suggest:uniffi_suggest_fn_method_suggeststore_clear + 39, // suggest:uniffi_suggest_fn_method_suggeststore_clear FfiConverterTypeSuggestStore.lower(this), ) } @@ -605,7 +605,7 @@ export class SuggestStore { const liftError = (data) => FfiConverterTypeSuggestApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 36, // suggest:uniffi_suggest_fn_method_suggeststore_clear_dismissed_suggestions + 40, // suggest:uniffi_suggest_fn_method_suggeststore_clear_dismissed_suggestions FfiConverterTypeSuggestStore.lower(this), ) } @@ -638,7 +638,7 @@ export class SuggestStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 37, // suggest:uniffi_suggest_fn_method_suggeststore_dismiss_by_key + 41, // suggest:uniffi_suggest_fn_method_suggeststore_dismiss_by_key FfiConverterTypeSuggestStore.lower(this), FfiConverterString.lower(key), ) @@ -668,7 +668,7 @@ export class SuggestStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 38, // suggest:uniffi_suggest_fn_method_suggeststore_dismiss_by_suggestion + 42, // suggest:uniffi_suggest_fn_method_suggeststore_dismiss_by_suggestion FfiConverterTypeSuggestStore.lower(this), FfiConverterTypeSuggestion.lower(suggestion), ) @@ -701,7 +701,7 @@ export class SuggestStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 39, // suggest:uniffi_suggest_fn_method_suggeststore_dismiss_suggestion + 43, // suggest:uniffi_suggest_fn_method_suggeststore_dismiss_suggestion FfiConverterTypeSuggestStore.lower(this), FfiConverterString.lower(suggestionUrl), ) @@ -776,7 +776,7 @@ export class SuggestStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 40, // suggest:uniffi_suggest_fn_method_suggeststore_fetch_geonames + 44, // suggest:uniffi_suggest_fn_method_suggeststore_fetch_geonames FfiConverterTypeSuggestStore.lower(this), FfiConverterString.lower(query), FfiConverterBool.lower(matchNamePrefix), @@ -800,7 +800,7 @@ export class SuggestStore { const liftError = (data) => FfiConverterTypeSuggestApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 41, // suggest:uniffi_suggest_fn_method_suggeststore_fetch_global_config + 45, // suggest:uniffi_suggest_fn_method_suggeststore_fetch_global_config FfiConverterTypeSuggestStore.lower(this), ) } @@ -828,7 +828,7 @@ export class SuggestStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 42, // suggest:uniffi_suggest_fn_method_suggeststore_fetch_provider_config + 46, // suggest:uniffi_suggest_fn_method_suggeststore_fetch_provider_config FfiConverterTypeSuggestStore.lower(this), FfiConverterTypeSuggestionProvider.lower(provider), ) @@ -857,7 +857,7 @@ export class SuggestStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 43, // suggest:uniffi_suggest_fn_method_suggeststore_ingest + 47, // suggest:uniffi_suggest_fn_method_suggeststore_ingest FfiConverterTypeSuggestStore.lower(this), FfiConverterTypeSuggestIngestionConstraints.lower(constraints), ) @@ -889,7 +889,7 @@ export class SuggestStore { throw e; } return UniFFIScaffolding.callSync( - 44, // suggest:uniffi_suggest_fn_method_suggeststore_interrupt + 48, // suggest:uniffi_suggest_fn_method_suggeststore_interrupt FfiConverterTypeSuggestStore.lower(this), FfiConverterOptionalTypeInterruptKind.lower(kind), ) @@ -919,7 +919,7 @@ export class SuggestStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 45, // suggest:uniffi_suggest_fn_method_suggeststore_is_dismissed_by_key + 49, // suggest:uniffi_suggest_fn_method_suggeststore_is_dismissed_by_key FfiConverterTypeSuggestStore.lower(this), FfiConverterString.lower(key), ) @@ -952,7 +952,7 @@ export class SuggestStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 46, // suggest:uniffi_suggest_fn_method_suggeststore_is_dismissed_by_suggestion + 50, // suggest:uniffi_suggest_fn_method_suggeststore_is_dismissed_by_suggestion FfiConverterTypeSuggestStore.lower(this), FfiConverterTypeSuggestion.lower(suggestion), ) @@ -981,7 +981,7 @@ export class SuggestStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 47, // suggest:uniffi_suggest_fn_method_suggeststore_query + 51, // suggest:uniffi_suggest_fn_method_suggeststore_query FfiConverterTypeSuggestStore.lower(this), FfiConverterTypeSuggestionQuery.lower(query), ) @@ -1010,7 +1010,7 @@ export class SuggestStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 48, // suggest:uniffi_suggest_fn_method_suggeststore_query_with_metrics + 52, // suggest:uniffi_suggest_fn_method_suggeststore_query_with_metrics FfiConverterTypeSuggestStore.lower(this), FfiConverterTypeSuggestionQuery.lower(query), ) @@ -1081,7 +1081,7 @@ export class SuggestStoreBuilder { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 57, // suggest:uniffi_suggest_fn_constructor_suggeststorebuilder_new + 61, // suggest:uniffi_suggest_fn_constructor_suggeststorebuilder_new ) } return handleRustResult(functionCall(), liftResult, liftError);} @@ -1095,7 +1095,7 @@ export class SuggestStoreBuilder { const liftError = (data) => FfiConverterTypeSuggestApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callSync( - 50, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_build + 54, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_build FfiConverterTypeSuggestStoreBuilder.lower(this), ) } @@ -1119,7 +1119,7 @@ export class SuggestStoreBuilder { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 51, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_cache_path + 55, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_cache_path FfiConverterTypeSuggestStoreBuilder.lower(this), FfiConverterString.lower(path), ) @@ -1148,7 +1148,7 @@ export class SuggestStoreBuilder { throw e; } return UniFFIScaffolding.callSync( - 52, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_data_path + 56, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_data_path FfiConverterTypeSuggestStoreBuilder.lower(this), FfiConverterString.lower(path), ) @@ -1185,7 +1185,7 @@ export class SuggestStoreBuilder { throw e; } return UniFFIScaffolding.callSync( - 53, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_load_extension + 57, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_load_extension FfiConverterTypeSuggestStoreBuilder.lower(this), FfiConverterString.lower(library), FfiConverterOptionalstring.lower(entryPoint), @@ -1211,7 +1211,7 @@ export class SuggestStoreBuilder { throw e; } return UniFFIScaffolding.callSync( - 54, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_bucket_name + 58, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_bucket_name FfiConverterTypeSuggestStoreBuilder.lower(this), FfiConverterString.lower(bucketName), ) @@ -1236,7 +1236,7 @@ export class SuggestStoreBuilder { throw e; } return UniFFIScaffolding.callSync( - 55, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_server + 59, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_server FfiConverterTypeSuggestStoreBuilder.lower(this), FfiConverterTypeRemoteSettingsServer.lower(server), ) @@ -1261,7 +1261,7 @@ export class SuggestStoreBuilder { throw e; } return UniFFIScaffolding.callSync( - 56, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_service + 60, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_service FfiConverterTypeSuggestStoreBuilder.lower(this), FfiConverterTypeRemoteSettingsService.lower(rsService), ) @@ -4389,7 +4389,7 @@ export function rawSuggestionUrlMatches(rawUrl,cookedUrl) { throw e; } return UniFFIScaffolding.callSync( - 33, // suggest:uniffi_suggest_fn_func_raw_suggestion_url_matches + 37, // suggest:uniffi_suggest_fn_func_raw_suggestion_url_matches FfiConverterString.lower(rawUrl), FfiConverterString.lower(cookedUrl), ) 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 9e14f79c6189..8f7784019123 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 @@ -172,7 +172,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerRemoteCommandStore() { - const pointerId = 7; // tabs:RemoteCommandStore + const pointerId = 8; // tabs:RemoteCommandStore const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -182,7 +182,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerRemoteCommandStore(value) { - const pointerId = 7; // tabs:RemoteCommandStore + const pointerId = 8; // tabs:RemoteCommandStore UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -192,7 +192,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerTabsBridgedEngine() { - const pointerId = 8; // tabs:TabsBridgedEngine + const pointerId = 9; // tabs:TabsBridgedEngine const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -202,7 +202,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerTabsBridgedEngine(value) { - const pointerId = 8; // tabs:TabsBridgedEngine + const pointerId = 9; // tabs:TabsBridgedEngine UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -212,7 +212,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerTabsStore() { - const pointerId = 9; // tabs:TabsStore + const pointerId = 10; // tabs:TabsStore const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -222,7 +222,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerTabsStore(value) { - const pointerId = 9; // tabs:TabsStore + const pointerId = 10; // tabs:TabsStore UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -448,7 +448,7 @@ export class RemoteCommandStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 58, // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command + 62, // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command FfiConverterTypeRemoteCommandStore.lower(this), FfiConverterString.lower(deviceId), FfiConverterTypeRemoteCommand.lower(command), @@ -494,7 +494,7 @@ export class RemoteCommandStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 59, // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command_at + 63, // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command_at FfiConverterTypeRemoteCommandStore.lower(this), FfiConverterString.lower(deviceId), FfiConverterTypeRemoteCommand.lower(command), @@ -517,7 +517,7 @@ export class RemoteCommandStore { const liftError = (data) => FfiConverterTypeTabsApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 60, // tabs:uniffi_tabs_fn_method_remotecommandstore_get_unsent_commands + 64, // tabs:uniffi_tabs_fn_method_remotecommandstore_get_unsent_commands FfiConverterTypeRemoteCommandStore.lower(this), ) } @@ -554,7 +554,7 @@ export class RemoteCommandStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 61, // tabs:uniffi_tabs_fn_method_remotecommandstore_remove_remote_command + 65, // tabs:uniffi_tabs_fn_method_remotecommandstore_remove_remote_command FfiConverterTypeRemoteCommandStore.lower(this), FfiConverterString.lower(deviceId), FfiConverterTypeRemoteCommand.lower(command), @@ -584,7 +584,7 @@ export class RemoteCommandStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 62, // tabs:uniffi_tabs_fn_method_remotecommandstore_set_pending_command_sent + 66, // tabs:uniffi_tabs_fn_method_remotecommandstore_set_pending_command_sent FfiConverterTypeRemoteCommandStore.lower(this), FfiConverterTypePendingCommand.lower(command), ) @@ -655,7 +655,7 @@ export class TabsBridgedEngine { const liftError = (data) => FfiConverterTypeTabsApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 63, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_apply + 67, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_apply FfiConverterTypeTabsBridgedEngine.lower(this), ) } @@ -683,7 +683,7 @@ export class TabsBridgedEngine { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 64, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id + 68, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id FfiConverterTypeTabsBridgedEngine.lower(this), FfiConverterString.lower(newSyncId), ) @@ -704,7 +704,7 @@ export class TabsBridgedEngine { const liftError = (data) => FfiConverterTypeTabsApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 65, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_last_sync + 69, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_last_sync FfiConverterTypeTabsBridgedEngine.lower(this), ) } @@ -731,7 +731,7 @@ export class TabsBridgedEngine { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 66, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync + 70, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync FfiConverterTypeTabsBridgedEngine.lower(this), FfiConverterString.lower(clientData), ) @@ -751,7 +751,7 @@ export class TabsBridgedEngine { const liftError = (data) => FfiConverterTypeTabsApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 67, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset + 71, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset FfiConverterTypeTabsBridgedEngine.lower(this), ) } @@ -771,7 +771,7 @@ export class TabsBridgedEngine { const liftError = (data) => FfiConverterTypeTabsApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 68, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id + 72, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id FfiConverterTypeTabsBridgedEngine.lower(this), ) } @@ -798,7 +798,7 @@ export class TabsBridgedEngine { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 69, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync + 73, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync FfiConverterTypeTabsBridgedEngine.lower(this), FfiConverterI64.lower(lastSync), ) @@ -834,7 +834,7 @@ export class TabsBridgedEngine { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 70, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded + 74, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded FfiConverterTypeTabsBridgedEngine.lower(this), FfiConverterI64.lower(newTimestamp), FfiConverterSequenceTypeTabsGuid.lower(uploadedIds), @@ -863,7 +863,7 @@ export class TabsBridgedEngine { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 71, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_store_incoming + 75, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_store_incoming FfiConverterTypeTabsBridgedEngine.lower(this), FfiConverterSequencestring.lower(incomingEnvelopesAsJson), ) @@ -883,7 +883,7 @@ export class TabsBridgedEngine { const liftError = (data) => FfiConverterTypeTabsApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 72, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_finished + 76, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_finished FfiConverterTypeTabsBridgedEngine.lower(this), ) } @@ -903,7 +903,7 @@ export class TabsBridgedEngine { const liftError = (data) => FfiConverterTypeTabsApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 73, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_id + 77, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_id FfiConverterTypeTabsBridgedEngine.lower(this), ) } @@ -922,7 +922,7 @@ export class TabsBridgedEngine { const liftError = (data) => FfiConverterTypeTabsApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 74, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_started + 78, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_started FfiConverterTypeTabsBridgedEngine.lower(this), ) } @@ -941,7 +941,7 @@ export class TabsBridgedEngine { const liftError = (data) => FfiConverterTypeTabsApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 75, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_wipe + 79, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_wipe FfiConverterTypeTabsBridgedEngine.lower(this), ) } @@ -1016,7 +1016,7 @@ export class TabsStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 82, // tabs:uniffi_tabs_fn_constructor_tabsstore_new + 86, // tabs:uniffi_tabs_fn_constructor_tabsstore_new FfiConverterString.lower(path), ) } @@ -1035,7 +1035,7 @@ export class TabsStore { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 76, // tabs:uniffi_tabs_fn_method_tabsstore_bridged_engine + 80, // tabs:uniffi_tabs_fn_method_tabsstore_bridged_engine FfiConverterTypeTabsStore.lower(this), ) } @@ -1054,7 +1054,7 @@ export class TabsStore { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 77, // tabs:uniffi_tabs_fn_method_tabsstore_close_connection + 81, // tabs:uniffi_tabs_fn_method_tabsstore_close_connection FfiConverterTypeTabsStore.lower(this), ) } @@ -1074,7 +1074,7 @@ export class TabsStore { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 78, // tabs:uniffi_tabs_fn_method_tabsstore_get_all + 82, // tabs:uniffi_tabs_fn_method_tabsstore_get_all FfiConverterTypeTabsStore.lower(this), ) } @@ -1094,7 +1094,7 @@ export class TabsStore { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 79, // tabs:uniffi_tabs_fn_method_tabsstore_new_remote_command_store + 83, // tabs:uniffi_tabs_fn_method_tabsstore_new_remote_command_store FfiConverterTypeTabsStore.lower(this), ) } @@ -1113,7 +1113,7 @@ export class TabsStore { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 80, // tabs:uniffi_tabs_fn_method_tabsstore_register_with_sync_manager + 84, // tabs:uniffi_tabs_fn_method_tabsstore_register_with_sync_manager FfiConverterTypeTabsStore.lower(this), ) } @@ -1140,7 +1140,7 @@ export class TabsStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 81, // tabs:uniffi_tabs_fn_method_tabsstore_set_local_tabs + 85, // tabs:uniffi_tabs_fn_method_tabsstore_set_local_tabs FfiConverterTypeTabsStore.lower(this), FfiConverterSequenceTypeRemoteTabRecord.lower(remoteTabs), ) 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 e142de921241..5f8b6b0777c9 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 @@ -172,7 +172,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerWebExtStorageBridgedEngine() { - const pointerId = 10; // webextstorage:WebExtStorageBridgedEngine + const pointerId = 11; // webextstorage:WebExtStorageBridgedEngine const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -182,7 +182,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerWebExtStorageBridgedEngine(value) { - const pointerId = 10; // webextstorage:WebExtStorageBridgedEngine + const pointerId = 11; // webextstorage:WebExtStorageBridgedEngine UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -192,7 +192,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerWebExtStorageStore() { - const pointerId = 11; // webextstorage:WebExtStorageStore + const pointerId = 12; // webextstorage:WebExtStorageStore const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -202,7 +202,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerWebExtStorageStore(value) { - const pointerId = 11; // webextstorage:WebExtStorageStore + const pointerId = 12; // webextstorage:WebExtStorageStore UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -417,7 +417,7 @@ export class WebExtStorageBridgedEngine { const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 83, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_apply + 87, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_apply FfiConverterTypeWebExtStorageBridgedEngine.lower(this), ) } @@ -445,7 +445,7 @@ export class WebExtStorageBridgedEngine { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 84, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_ensure_current_sync_id + 88, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_ensure_current_sync_id FfiConverterTypeWebExtStorageBridgedEngine.lower(this), FfiConverterString.lower(newSyncId), ) @@ -466,7 +466,7 @@ export class WebExtStorageBridgedEngine { const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 85, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_last_sync + 89, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_last_sync FfiConverterTypeWebExtStorageBridgedEngine.lower(this), ) } @@ -493,7 +493,7 @@ export class WebExtStorageBridgedEngine { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 86, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_prepare_for_sync + 90, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_prepare_for_sync FfiConverterTypeWebExtStorageBridgedEngine.lower(this), FfiConverterString.lower(clientData), ) @@ -513,7 +513,7 @@ export class WebExtStorageBridgedEngine { const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 87, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_reset + 91, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_reset FfiConverterTypeWebExtStorageBridgedEngine.lower(this), ) } @@ -533,7 +533,7 @@ export class WebExtStorageBridgedEngine { const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 88, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_reset_sync_id + 92, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_reset_sync_id FfiConverterTypeWebExtStorageBridgedEngine.lower(this), ) } @@ -560,7 +560,7 @@ export class WebExtStorageBridgedEngine { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 89, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_set_last_sync + 93, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_set_last_sync FfiConverterTypeWebExtStorageBridgedEngine.lower(this), FfiConverterI64.lower(lastSync), ) @@ -596,7 +596,7 @@ export class WebExtStorageBridgedEngine { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 90, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_set_uploaded + 94, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_set_uploaded FfiConverterTypeWebExtStorageBridgedEngine.lower(this), FfiConverterI64.lower(serverModifiedMillis), FfiConverterSequenceTypeGuid.lower(guids), @@ -625,7 +625,7 @@ export class WebExtStorageBridgedEngine { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 91, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_store_incoming + 95, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_store_incoming FfiConverterTypeWebExtStorageBridgedEngine.lower(this), FfiConverterSequencestring.lower(incoming), ) @@ -645,7 +645,7 @@ export class WebExtStorageBridgedEngine { const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 92, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_finished + 96, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_finished FfiConverterTypeWebExtStorageBridgedEngine.lower(this), ) } @@ -665,7 +665,7 @@ export class WebExtStorageBridgedEngine { const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 93, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_id + 97, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_id FfiConverterTypeWebExtStorageBridgedEngine.lower(this), ) } @@ -684,7 +684,7 @@ export class WebExtStorageBridgedEngine { const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 94, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_started + 98, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_sync_started FfiConverterTypeWebExtStorageBridgedEngine.lower(this), ) } @@ -703,7 +703,7 @@ export class WebExtStorageBridgedEngine { const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 95, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_wipe + 99, // webextstorage:uniffi_webext_storage_fn_method_webextstoragebridgedengine_wipe FfiConverterTypeWebExtStorageBridgedEngine.lower(this), ) } @@ -778,7 +778,7 @@ export class WebExtStorageStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 104, // webextstorage:uniffi_webext_storage_fn_constructor_webextstoragestore_new + 108, // webextstorage:uniffi_webext_storage_fn_constructor_webextstoragestore_new FfiConverterString.lower(path), ) } @@ -797,7 +797,7 @@ export class WebExtStorageStore { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 96, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_bridged_engine + 100, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_bridged_engine FfiConverterTypeWebExtStorageStore.lower(this), ) } @@ -825,7 +825,7 @@ export class WebExtStorageStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 97, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_clear + 101, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_clear FfiConverterTypeWebExtStorageStore.lower(this), FfiConverterString.lower(extId), ) @@ -845,7 +845,7 @@ export class WebExtStorageStore { const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 98, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_close + 102, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_close FfiConverterTypeWebExtStorageStore.lower(this), ) } @@ -881,7 +881,7 @@ export class WebExtStorageStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 99, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_get + 103, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_get FfiConverterTypeWebExtStorageStore.lower(this), FfiConverterString.lower(extId), FfiConverterTypeJsonValue.lower(keys), @@ -919,7 +919,7 @@ export class WebExtStorageStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 100, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_get_bytes_in_use + 104, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_get_bytes_in_use FfiConverterTypeWebExtStorageStore.lower(this), FfiConverterString.lower(extId), FfiConverterTypeJsonValue.lower(keys), @@ -941,7 +941,7 @@ export class WebExtStorageStore { const liftError = (data) => FfiConverterTypeWebExtStorageApiError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 101, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_get_synced_changes + 105, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_get_synced_changes FfiConverterTypeWebExtStorageStore.lower(this), ) } @@ -977,7 +977,7 @@ export class WebExtStorageStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 102, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_remove + 106, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_remove FfiConverterTypeWebExtStorageStore.lower(this), FfiConverterString.lower(extId), FfiConverterTypeJsonValue.lower(keys), @@ -1015,7 +1015,7 @@ export class WebExtStorageStore { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 103, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_set + 107, // webextstorage:uniffi_webext_storage_fn_method_webextstoragestore_set FfiConverterTypeWebExtStorageStore.lower(this), FfiConverterString.lower(extId), FfiConverterTypeJsonValue.lower(val), diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/lib.rs b/toolkit/components/uniffi-bindgen-gecko-js/components/lib.rs index 29521a320d53..bc8d1ea2b368 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/lib.rs +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/lib.rs @@ -8,6 +8,7 @@ mod reexport_appservices_uniffi_scaffolding { suggest::uniffi_reexport_scaffolding!(); webext_storage::uniffi_reexport_scaffolding!(); search::uniffi_reexport_scaffolding!(); + context_id::uniffi_reexport_scaffolding!(); } // Define extern "C" versions of these UniFFI functions, so that they can be called from C++ diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build b/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build index 7d8b62af2db5..1cc6987e3275 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/. EXTRA_JS_MODULES += [ + "generated/RustContextId.sys.mjs", "generated/RustRelevancy.sys.mjs", "generated/RustRemoteSettings.sys.mjs", "generated/RustSearch.sys.mjs", diff --git a/toolkit/components/uniffi-bindgen-gecko-js/config.toml b/toolkit/components/uniffi-bindgen-gecko-js/config.toml index 4bfe82e1376f..0b2bf0c934f0 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/config.toml +++ b/toolkit/components/uniffi-bindgen-gecko-js/config.toml @@ -9,6 +9,12 @@ # TODO: Upgrade the TOML crate and switch to array of tables syntax. +[context_id.async_wrappers] +enable = true +main_thread = [ + "ContextIDComponent.new", +] + [search.async_wrappers] # All functions/methods are wrapped to be async by default and must be `await`ed. enable = true diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustArithmetic.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustArithmetic.sys.mjs index 22f6f4504fbd..93356d1310a6 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustArithmetic.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustArithmetic.sys.mjs @@ -431,7 +431,7 @@ export function add(a,b) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 105, // arithmetic:uniffi_arithmetical_fn_func_add + 109, // arithmetic:uniffi_arithmetical_fn_func_add FfiConverterU64.lower(a), FfiConverterU64.lower(b), ) @@ -469,7 +469,7 @@ export function div(dividend,divisor) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 106, // arithmetic:uniffi_arithmetical_fn_func_div + 110, // arithmetic:uniffi_arithmetical_fn_func_div FfiConverterU64.lower(dividend), FfiConverterU64.lower(divisor), ) @@ -507,7 +507,7 @@ export function equal(a,b) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 107, // arithmetic:uniffi_arithmetical_fn_func_equal + 111, // arithmetic:uniffi_arithmetical_fn_func_equal FfiConverterU64.lower(a), FfiConverterU64.lower(b), ) @@ -545,7 +545,7 @@ export function sub(a,b) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 108, // arithmetic:uniffi_arithmetical_fn_func_sub + 112, // arithmetic:uniffi_arithmetical_fn_func_sub FfiConverterU64.lower(a), FfiConverterU64.lower(b), ) diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustCustomTypes.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustCustomTypes.sys.mjs index de89997a903f..a661fda1bd72 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustCustomTypes.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustCustomTypes.sys.mjs @@ -857,7 +857,7 @@ export function echoExplicitValue(value) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 109, // custom_types:uniffi_uniffi_custom_types_fn_func_echo_explicit_value + 113, // custom_types:uniffi_uniffi_custom_types_fn_func_echo_explicit_value FfiConverterTypeExplicitValuedEnum.lower(value), ) } @@ -886,7 +886,7 @@ export function echoGappedValue(value) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 110, // custom_types:uniffi_uniffi_custom_types_fn_func_echo_gapped_value + 114, // custom_types:uniffi_uniffi_custom_types_fn_func_echo_gapped_value FfiConverterTypeGappedEnum.lower(value), ) } @@ -915,7 +915,7 @@ export function echoSequentialValue(value) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 111, // custom_types:uniffi_uniffi_custom_types_fn_func_echo_sequential_value + 115, // custom_types:uniffi_uniffi_custom_types_fn_func_echo_sequential_value FfiConverterTypeSequentialEnum.lower(value), ) } @@ -944,7 +944,7 @@ export function getCustomTypesDemo(demo) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 112, // custom_types:uniffi_uniffi_custom_types_fn_func_get_custom_types_demo + 116, // custom_types:uniffi_uniffi_custom_types_fn_func_get_custom_types_demo FfiConverterOptionalTypeCustomTypesDemo.lower(demo), ) } @@ -973,7 +973,7 @@ export function getExplicitDiscriminant(value) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 113, // custom_types:uniffi_uniffi_custom_types_fn_func_get_explicit_discriminant + 117, // custom_types:uniffi_uniffi_custom_types_fn_func_get_explicit_discriminant FfiConverterTypeExplicitValuedEnum.lower(value), ) } @@ -994,7 +994,7 @@ export function getExplicitEnumValues() { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 114, // custom_types:uniffi_uniffi_custom_types_fn_func_get_explicit_enum_values + 118, // custom_types:uniffi_uniffi_custom_types_fn_func_get_explicit_enum_values ) } try { @@ -1022,7 +1022,7 @@ export function getGappedDiscriminant(value) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 115, // custom_types:uniffi_uniffi_custom_types_fn_func_get_gapped_discriminant + 119, // custom_types:uniffi_uniffi_custom_types_fn_func_get_gapped_discriminant FfiConverterTypeGappedEnum.lower(value), ) } @@ -1043,7 +1043,7 @@ export function getGappedEnumValues() { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 116, // custom_types:uniffi_uniffi_custom_types_fn_func_get_gapped_enum_values + 120, // custom_types:uniffi_uniffi_custom_types_fn_func_get_gapped_enum_values ) } try { @@ -1071,7 +1071,7 @@ export function getSequentialDiscriminant(value) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 117, // custom_types:uniffi_uniffi_custom_types_fn_func_get_sequential_discriminant + 121, // custom_types:uniffi_uniffi_custom_types_fn_func_get_sequential_discriminant FfiConverterTypeSequentialEnum.lower(value), ) } diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustExternalTypes.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustExternalTypes.sys.mjs index a61734c1d7b9..b66659d8135d 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustExternalTypes.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustExternalTypes.sys.mjs @@ -431,7 +431,7 @@ export function gradient(value) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 118, // external_types:uniffi_uniffi_fixture_external_types_fn_func_gradient + 122, // external_types:uniffi_uniffi_fixture_external_types_fn_func_gradient FfiConverterOptionalTypeLine.lower(value), ) } @@ -468,7 +468,7 @@ export function intersection(ln1,ln2) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 119, // external_types:uniffi_uniffi_fixture_external_types_fn_func_intersection + 123, // external_types:uniffi_uniffi_fixture_external_types_fn_func_intersection FfiConverterTypeLine.lower(ln1), FfiConverterTypeLine.lower(ln2), ) @@ -497,7 +497,7 @@ export function moveSpriteToOrigin(sprite) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 120, // external_types:uniffi_uniffi_fixture_external_types_fn_func_move_sprite_to_origin + 124, // external_types:uniffi_uniffi_fixture_external_types_fn_func_move_sprite_to_origin FfiConverterTypeSprite.lower(sprite), ) } diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustFixtureCallbacks.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustFixtureCallbacks.sys.mjs index 88ba7de63d9a..f61902808a60 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustFixtureCallbacks.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustFixtureCallbacks.sys.mjs @@ -665,7 +665,7 @@ export class FfiConverterSequencei32 extends FfiConverterArrayBuffer { const callbackHandlerLogger = new UniFFICallbackHandler( "fixture_callbacks:Logger", - 1, + 2, [ new UniFFICallbackMethodHandler( "log", @@ -737,7 +737,7 @@ export function callLogRepeat(logger,message,count,exclude) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 121, // fixture_callbacks:uniffi_uniffi_fixture_callbacks_fn_func_call_log_repeat + 125, // fixture_callbacks:uniffi_uniffi_fixture_callbacks_fn_func_call_log_repeat FfiConverterTypeLogger.lower(logger), FfiConverterString.lower(message), FfiConverterU32.lower(count), @@ -776,7 +776,7 @@ export function logEvenNumbers(logger,items) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 122, // fixture_callbacks:uniffi_uniffi_fixture_callbacks_fn_func_log_even_numbers + 126, // fixture_callbacks:uniffi_uniffi_fixture_callbacks_fn_func_log_even_numbers FfiConverterTypeLogger.lower(logger), FfiConverterSequencei32.lower(items), ) @@ -813,7 +813,7 @@ export function logEvenNumbersMainThread(logger,items) { throw e; } return UniFFIScaffolding.callSync( - 123, // fixture_callbacks:uniffi_uniffi_fixture_callbacks_fn_func_log_even_numbers_main_thread + 127, // fixture_callbacks:uniffi_uniffi_fixture_callbacks_fn_func_log_even_numbers_main_thread FfiConverterTypeLogger.lower(logger), FfiConverterSequencei32.lower(items), ) diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustFutures.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustFutures.sys.mjs index 64fc13f6e276..432195cde606 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustFutures.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustFutures.sys.mjs @@ -172,7 +172,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerFutureTester() { - const pointerId = 12; // futures:FutureTester + const pointerId = 13; // futures:FutureTester const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -182,7 +182,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerFutureTester(value) { - const pointerId = 12; // futures:FutureTester + const pointerId = 13; // futures:FutureTester UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -192,7 +192,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerRustTask() { - const pointerId = 13; // futures:RustTask + const pointerId = 14; // futures:RustTask const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -202,7 +202,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerRustTask(value) { - const pointerId = 13; // futures:RustTask + const pointerId = 14; // futures:RustTask UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -212,7 +212,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerTraveller() { - const pointerId = 14; // futures:Traveller + const pointerId = 15; // futures:Traveller const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -222,7 +222,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerTraveller(value) { - const pointerId = 14; // futures:Traveller + const pointerId = 15; // futures:Traveller UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -232,7 +232,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerWorkerQueue() { - const pointerId = 15; // futures:WorkerQueue + const pointerId = 16; // futures:WorkerQueue const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -242,7 +242,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerWorkerQueue(value) { - const pointerId = 15; // futures:WorkerQueue + const pointerId = 16; // futures:WorkerQueue UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -662,7 +662,7 @@ export class FutureTester { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 144, // futures:uniffi_uniffi_fixture_futures_fn_constructor_futuretester_init + 148, // futures:uniffi_uniffi_fixture_futures_fn_constructor_futuretester_init ) } return handleRustResult(functionCall(), liftResult, liftError);} @@ -687,7 +687,7 @@ export class FutureTester { throw e; } return UniFFIScaffolding.callSync( - 141, // futures:uniffi_uniffi_fixture_futures_fn_method_futuretester_complete_futures + 145, // futures:uniffi_uniffi_fixture_futures_fn_method_futuretester_complete_futures FfiConverterTypeFutureTester.lower(this), FfiConverterU8.lower(value), ) @@ -704,7 +704,7 @@ export class FutureTester { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 142, // futures:uniffi_uniffi_fixture_futures_fn_method_futuretester_make_future + 146, // futures:uniffi_uniffi_fixture_futures_fn_method_futuretester_make_future FfiConverterTypeFutureTester.lower(this), ) } @@ -724,7 +724,7 @@ export class FutureTester { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 143, // futures:uniffi_uniffi_fixture_futures_fn_method_futuretester_wake_futures + 147, // futures:uniffi_uniffi_fixture_futures_fn_method_futuretester_wake_futures FfiConverterTypeFutureTester.lower(this), ) } @@ -787,7 +787,7 @@ export class RustTask { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 145, // futures:uniffi_uniffi_fixture_futures_fn_method_rusttask_run + 149, // futures:uniffi_uniffi_fixture_futures_fn_method_rusttask_run FfiConverterTypeRustTask.lower(this), ) } @@ -858,7 +858,7 @@ export class Traveller { throw e; } return UniFFIScaffolding.callSync( - 147, // futures:uniffi_uniffi_fixture_futures_fn_constructor_traveller_new + 151, // futures:uniffi_uniffi_fixture_futures_fn_constructor_traveller_new FfiConverterString.lower(name), ) } @@ -873,7 +873,7 @@ export class Traveller { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 146, // futures:uniffi_uniffi_fixture_futures_fn_method_traveller_name + 150, // futures:uniffi_uniffi_fixture_futures_fn_method_traveller_name FfiConverterTypeTraveller.lower(this), ) } @@ -950,7 +950,7 @@ export class WorkerQueue { throw e; } return UniFFIScaffolding.callSync( - 148, // futures:uniffi_uniffi_fixture_futures_fn_method_workerqueue_add_task + 152, // futures:uniffi_uniffi_fixture_futures_fn_method_workerqueue_add_task FfiConverterTypeWorkerQueue.lower(this), FfiConverterTypeRustTask.lower(task), ) @@ -1104,7 +1104,7 @@ export function expensiveComputation() { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 124, // futures:uniffi_uniffi_fixture_futures_fn_func_expensive_computation + 128, // futures:uniffi_uniffi_fixture_futures_fn_func_expensive_computation ) } try { @@ -1127,7 +1127,7 @@ export function initializeGeckoGlobalWorkerQueue() { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 125, // futures:uniffi_uniffi_fixture_futures_fn_func_initialize_gecko_global_worker_queue + 129, // futures:uniffi_uniffi_fixture_futures_fn_func_initialize_gecko_global_worker_queue ) } return handleRustResult(functionCall(), liftResult, liftError); @@ -1151,7 +1151,7 @@ export function initializeGlobalWorkerQueue(workerQueue) { throw e; } return UniFFIScaffolding.callSync( - 126, // futures:uniffi_uniffi_fixture_futures_fn_func_initialize_global_worker_queue + 130, // futures:uniffi_uniffi_fixture_futures_fn_func_initialize_global_worker_queue FfiConverterTypeWorkerQueue.lower(workerQueue), ) } @@ -1176,7 +1176,7 @@ export function roundtripF32(v) { throw e; } return UniFFIScaffolding.callAsync( - 127, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_f32 + 131, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_f32 FfiConverterF32.lower(v), ) } @@ -1205,7 +1205,7 @@ export function roundtripF64(v) { throw e; } return UniFFIScaffolding.callAsync( - 128, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_f64 + 132, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_f64 FfiConverterF64.lower(v), ) } @@ -1234,7 +1234,7 @@ export function roundtripI16(v) { throw e; } return UniFFIScaffolding.callAsync( - 129, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_i16 + 133, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_i16 FfiConverterI16.lower(v), ) } @@ -1263,7 +1263,7 @@ export function roundtripI32(v) { throw e; } return UniFFIScaffolding.callAsync( - 130, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_i32 + 134, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_i32 FfiConverterI32.lower(v), ) } @@ -1292,7 +1292,7 @@ export function roundtripI64(v) { throw e; } return UniFFIScaffolding.callAsync( - 131, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_i64 + 135, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_i64 FfiConverterI64.lower(v), ) } @@ -1321,7 +1321,7 @@ export function roundtripI8(v) { throw e; } return UniFFIScaffolding.callAsync( - 132, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_i8 + 136, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_i8 FfiConverterI8.lower(v), ) } @@ -1350,7 +1350,7 @@ export function roundtripMap(v) { throw e; } return UniFFIScaffolding.callAsync( - 133, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_map + 137, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_map FfiConverterMapStringString.lower(v), ) } @@ -1379,7 +1379,7 @@ export function roundtripObj(v) { throw e; } return UniFFIScaffolding.callAsync( - 134, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_obj + 138, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_obj FfiConverterTypeTraveller.lower(v), ) } @@ -1408,7 +1408,7 @@ export function roundtripString(v) { throw e; } return UniFFIScaffolding.callAsync( - 135, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_string + 139, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_string FfiConverterString.lower(v), ) } @@ -1437,7 +1437,7 @@ export function roundtripU16(v) { throw e; } return UniFFIScaffolding.callAsync( - 136, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_u16 + 140, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_u16 FfiConverterU16.lower(v), ) } @@ -1466,7 +1466,7 @@ export function roundtripU32(v) { throw e; } return UniFFIScaffolding.callAsync( - 137, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_u32 + 141, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_u32 FfiConverterU32.lower(v), ) } @@ -1495,7 +1495,7 @@ export function roundtripU64(v) { throw e; } return UniFFIScaffolding.callAsync( - 138, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_u64 + 142, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_u64 FfiConverterU64.lower(v), ) } @@ -1524,7 +1524,7 @@ export function roundtripU8(v) { throw e; } return UniFFIScaffolding.callAsync( - 139, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_u8 + 143, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_u8 FfiConverterU8.lower(v), ) } @@ -1553,7 +1553,7 @@ export function roundtripVec(v) { throw e; } return UniFFIScaffolding.callAsync( - 140, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_vec + 144, // futures:uniffi_uniffi_fixture_futures_fn_func_roundtrip_vec FfiConverterSequenceu32.lower(v), ) } diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustGeometry.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustGeometry.sys.mjs index 44fe11c17cc9..681e648621bd 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustGeometry.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustGeometry.sys.mjs @@ -542,7 +542,7 @@ export function gradient(ln) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 149, // geometry:uniffi_uniffi_geometry_fn_func_gradient + 153, // geometry:uniffi_uniffi_geometry_fn_func_gradient FfiConverterTypeLine.lower(ln), ) } @@ -579,7 +579,7 @@ export function intersection(ln1,ln2) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 150, // geometry:uniffi_uniffi_geometry_fn_func_intersection + 154, // geometry:uniffi_uniffi_geometry_fn_func_intersection FfiConverterTypeLine.lower(ln1), FfiConverterTypeLine.lower(ln2), ) diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRefcounts.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRefcounts.sys.mjs index e5058c57dc35..3ff6969fc60c 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRefcounts.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRefcounts.sys.mjs @@ -172,7 +172,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerSingletonObject() { - const pointerId = 16; // refcounts:SingletonObject + const pointerId = 17; // refcounts:SingletonObject const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -182,7 +182,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerSingletonObject(value) { - const pointerId = 16; // refcounts:SingletonObject + const pointerId = 17; // refcounts:SingletonObject UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -371,7 +371,7 @@ export class SingletonObject { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 153, // refcounts:uniffi_uniffi_fixture_refcounts_fn_method_singletonobject_method + 157, // refcounts:uniffi_uniffi_fixture_refcounts_fn_method_singletonobject_method FfiConverterTypeSingletonObject.lower(this), ) } @@ -423,7 +423,7 @@ export function getJsRefcount() { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 151, // refcounts:uniffi_uniffi_fixture_refcounts_fn_func_get_js_refcount + 155, // refcounts:uniffi_uniffi_fixture_refcounts_fn_func_get_js_refcount ) } return handleRustResult(functionCall(), liftResult, liftError); @@ -439,7 +439,7 @@ export function getSingleton() { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 152, // refcounts:uniffi_uniffi_fixture_refcounts_fn_func_get_singleton + 156, // refcounts:uniffi_uniffi_fixture_refcounts_fn_func_get_singleton ) } return handleRustResult(functionCall(), liftResult, liftError); diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRondpoint.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRondpoint.sys.mjs index 83a2f0340f39..0ad795ff0dee 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRondpoint.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRondpoint.sys.mjs @@ -172,7 +172,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerOptionneur() { - const pointerId = 17; // rondpoint:Optionneur + const pointerId = 18; // rondpoint:Optionneur const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -182,7 +182,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerOptionneur(value) { - const pointerId = 17; // rondpoint:Optionneur + const pointerId = 18; // rondpoint:Optionneur UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -192,7 +192,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerRetourneur() { - const pointerId = 18; // rondpoint:Retourneur + const pointerId = 19; // rondpoint:Retourneur const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -202,7 +202,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerRetourneur(value) { - const pointerId = 18; // rondpoint:Retourneur + const pointerId = 19; // rondpoint:Retourneur UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -212,7 +212,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerStringifier() { - const pointerId = 19; // rondpoint:Stringifier + const pointerId = 20; // rondpoint:Stringifier const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -222,7 +222,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerStringifier(value) { - const pointerId = 19; // rondpoint:Stringifier + const pointerId = 20; // rondpoint:Stringifier UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -665,7 +665,7 @@ export class Optionneur { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 184, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_optionneur_new + 188, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_optionneur_new ) } try { @@ -691,7 +691,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 159, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_boolean + 163, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_boolean FfiConverterTypeOptionneur.lower(this), FfiConverterBool.lower(value), ) @@ -720,7 +720,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 160, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_enum + 164, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_enum FfiConverterTypeOptionneur.lower(this), FfiConverterTypeEnumeration.lower(value), ) @@ -749,7 +749,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 161, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f32 + 165, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f32 FfiConverterTypeOptionneur.lower(this), FfiConverterF32.lower(value), ) @@ -778,7 +778,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 162, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f64 + 166, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f64 FfiConverterTypeOptionneur.lower(this), FfiConverterF64.lower(value), ) @@ -807,7 +807,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 163, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec + 167, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec FfiConverterTypeOptionneur.lower(this), FfiConverterI16.lower(value), ) @@ -836,7 +836,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 164, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex + 168, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex FfiConverterTypeOptionneur.lower(this), FfiConverterI16.lower(value), ) @@ -865,7 +865,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 165, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec + 169, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec FfiConverterTypeOptionneur.lower(this), FfiConverterI32.lower(value), ) @@ -894,7 +894,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 166, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex + 170, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex FfiConverterTypeOptionneur.lower(this), FfiConverterI32.lower(value), ) @@ -923,7 +923,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 167, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec + 171, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec FfiConverterTypeOptionneur.lower(this), FfiConverterI64.lower(value), ) @@ -952,7 +952,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 168, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex + 172, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex FfiConverterTypeOptionneur.lower(this), FfiConverterI64.lower(value), ) @@ -981,7 +981,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 169, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec + 173, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec FfiConverterTypeOptionneur.lower(this), FfiConverterI8.lower(value), ) @@ -1010,7 +1010,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 170, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex + 174, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex FfiConverterTypeOptionneur.lower(this), FfiConverterI8.lower(value), ) @@ -1039,7 +1039,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 171, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_null + 175, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_null FfiConverterTypeOptionneur.lower(this), FfiConverterOptionalstring.lower(value), ) @@ -1068,7 +1068,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 172, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_sequence + 176, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_sequence FfiConverterTypeOptionneur.lower(this), FfiConverterSequencestring.lower(value), ) @@ -1097,7 +1097,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 173, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_string + 177, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_string FfiConverterTypeOptionneur.lower(this), FfiConverterString.lower(value), ) @@ -1126,7 +1126,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 174, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec + 178, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec FfiConverterTypeOptionneur.lower(this), FfiConverterU16.lower(value), ) @@ -1155,7 +1155,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 175, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex + 179, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex FfiConverterTypeOptionneur.lower(this), FfiConverterU16.lower(value), ) @@ -1184,7 +1184,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 176, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec + 180, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec FfiConverterTypeOptionneur.lower(this), FfiConverterU32.lower(value), ) @@ -1213,7 +1213,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 177, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex + 181, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex FfiConverterTypeOptionneur.lower(this), FfiConverterU32.lower(value), ) @@ -1242,7 +1242,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 178, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct + 182, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct FfiConverterTypeOptionneur.lower(this), FfiConverterU32.lower(value), ) @@ -1271,7 +1271,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 179, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec + 183, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec FfiConverterTypeOptionneur.lower(this), FfiConverterU64.lower(value), ) @@ -1300,7 +1300,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 180, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex + 184, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex FfiConverterTypeOptionneur.lower(this), FfiConverterU64.lower(value), ) @@ -1329,7 +1329,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 181, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec + 185, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec FfiConverterTypeOptionneur.lower(this), FfiConverterU8.lower(value), ) @@ -1358,7 +1358,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 182, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex + 186, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex FfiConverterTypeOptionneur.lower(this), FfiConverterU8.lower(value), ) @@ -1387,7 +1387,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 183, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_zero + 187, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_zero FfiConverterTypeOptionneur.lower(this), FfiConverterOptionali32.lower(value), ) @@ -1455,7 +1455,7 @@ export class Retourneur { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 200, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_retourneur_new + 204, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_retourneur_new ) } try { @@ -1481,7 +1481,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 185, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_boolean + 189, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_boolean FfiConverterTypeRetourneur.lower(this), FfiConverterBool.lower(value), ) @@ -1510,7 +1510,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 186, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_double + 190, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_double FfiConverterTypeRetourneur.lower(this), FfiConverterF64.lower(value), ) @@ -1539,7 +1539,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 187, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_float + 191, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_float FfiConverterTypeRetourneur.lower(this), FfiConverterF32.lower(value), ) @@ -1568,7 +1568,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 188, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i16 + 192, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i16 FfiConverterTypeRetourneur.lower(this), FfiConverterI16.lower(value), ) @@ -1597,7 +1597,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 189, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i32 + 193, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i32 FfiConverterTypeRetourneur.lower(this), FfiConverterI32.lower(value), ) @@ -1626,7 +1626,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 190, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i64 + 194, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i64 FfiConverterTypeRetourneur.lower(this), FfiConverterI64.lower(value), ) @@ -1655,7 +1655,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 191, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i8 + 195, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i8 FfiConverterTypeRetourneur.lower(this), FfiConverterI8.lower(value), ) @@ -1684,7 +1684,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 192, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres + 196, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres FfiConverterTypeRetourneur.lower(this), FfiConverterTypeDictionnaireNombres.lower(value), ) @@ -1713,7 +1713,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 193, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes + 197, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes FfiConverterTypeRetourneur.lower(this), FfiConverterTypeDictionnaireNombresSignes.lower(value), ) @@ -1742,7 +1742,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 194, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire + 198, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire FfiConverterTypeRetourneur.lower(this), FfiConverterTypeOptionneurDictionnaire.lower(value), ) @@ -1771,7 +1771,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 195, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_string + 199, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_string FfiConverterTypeRetourneur.lower(this), FfiConverterString.lower(value), ) @@ -1800,7 +1800,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 196, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u16 + 200, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u16 FfiConverterTypeRetourneur.lower(this), FfiConverterU16.lower(value), ) @@ -1829,7 +1829,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 197, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u32 + 201, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u32 FfiConverterTypeRetourneur.lower(this), FfiConverterU32.lower(value), ) @@ -1858,7 +1858,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 198, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u64 + 202, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u64 FfiConverterTypeRetourneur.lower(this), FfiConverterU64.lower(value), ) @@ -1887,7 +1887,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 199, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u8 + 203, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u8 FfiConverterTypeRetourneur.lower(this), FfiConverterU8.lower(value), ) @@ -1955,7 +1955,7 @@ export class Stringifier { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 213, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_stringifier_new + 217, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_stringifier_new ) } try { @@ -1981,7 +1981,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 201, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_boolean + 205, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_boolean FfiConverterTypeStringifier.lower(this), FfiConverterBool.lower(value), ) @@ -2010,7 +2010,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 202, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_double + 206, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_double FfiConverterTypeStringifier.lower(this), FfiConverterF64.lower(value), ) @@ -2039,7 +2039,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 203, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_float + 207, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_float FfiConverterTypeStringifier.lower(this), FfiConverterF32.lower(value), ) @@ -2068,7 +2068,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 204, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i16 + 208, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i16 FfiConverterTypeStringifier.lower(this), FfiConverterI16.lower(value), ) @@ -2097,7 +2097,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 205, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i32 + 209, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i32 FfiConverterTypeStringifier.lower(this), FfiConverterI32.lower(value), ) @@ -2126,7 +2126,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 206, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i64 + 210, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i64 FfiConverterTypeStringifier.lower(this), FfiConverterI64.lower(value), ) @@ -2155,7 +2155,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 207, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i8 + 211, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i8 FfiConverterTypeStringifier.lower(this), FfiConverterI8.lower(value), ) @@ -2184,7 +2184,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 208, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u16 + 212, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u16 FfiConverterTypeStringifier.lower(this), FfiConverterU16.lower(value), ) @@ -2213,7 +2213,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 209, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u32 + 213, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u32 FfiConverterTypeStringifier.lower(this), FfiConverterU32.lower(value), ) @@ -2242,7 +2242,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 210, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u64 + 214, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u64 FfiConverterTypeStringifier.lower(this), FfiConverterU64.lower(value), ) @@ -2271,7 +2271,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 211, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u8 + 215, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u8 FfiConverterTypeStringifier.lower(this), FfiConverterU8.lower(value), ) @@ -2300,7 +2300,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 212, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_well_known_string + 216, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_well_known_string FfiConverterTypeStringifier.lower(this), FfiConverterString.lower(value), ) @@ -3686,7 +3686,7 @@ export function copieCarte(c) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 154, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_carte + 158, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_carte FfiConverterMapStringTypeEnumerationAvecDonnees.lower(c), ) } @@ -3715,7 +3715,7 @@ export function copieDictionnaire(d) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 155, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_dictionnaire + 159, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_dictionnaire FfiConverterTypeDictionnaire.lower(d), ) } @@ -3744,7 +3744,7 @@ export function copieEnumeration(e) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 156, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumeration + 160, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumeration FfiConverterTypeEnumeration.lower(e), ) } @@ -3773,7 +3773,7 @@ export function copieEnumerations(e) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 157, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumerations + 161, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumerations FfiConverterSequenceTypeEnumeration.lower(e), ) } @@ -3802,7 +3802,7 @@ export function switcheroo(b) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 158, // rondpoint:uniffi_uniffi_rondpoint_fn_func_switcheroo + 162, // rondpoint:uniffi_uniffi_rondpoint_fn_func_switcheroo FfiConverterBool.lower(b), ) } diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustSprites.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustSprites.sys.mjs index c8e8038a9ca6..fefb66181156 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustSprites.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustSprites.sys.mjs @@ -172,7 +172,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerSprite() { - const pointerId = 20; // sprites:Sprite + const pointerId = 21; // sprites:Sprite const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -182,7 +182,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerSprite(value) { - const pointerId = 20; // sprites:Sprite + const pointerId = 21; // sprites:Sprite UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -370,7 +370,7 @@ export class Sprite { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 218, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new + 222, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new FfiConverterOptionalTypePoint.lower(initialPosition), ) } @@ -404,7 +404,7 @@ export class Sprite { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 219, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new_relative_to + 223, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new_relative_to FfiConverterTypePoint.lower(reference), FfiConverterTypeVector.lower(direction), ) @@ -424,7 +424,7 @@ export class Sprite { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 215, // sprites:uniffi_uniffi_sprites_fn_method_sprite_get_position + 219, // sprites:uniffi_uniffi_sprites_fn_method_sprite_get_position FfiConverterTypeSprite.lower(this), ) } @@ -451,7 +451,7 @@ export class Sprite { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 216, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_by + 220, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_by FfiConverterTypeSprite.lower(this), FfiConverterTypeVector.lower(direction), ) @@ -479,7 +479,7 @@ export class Sprite { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 217, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_to + 221, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_to FfiConverterTypeSprite.lower(this), FfiConverterTypePoint.lower(position), ) @@ -755,7 +755,7 @@ export function translate(p,v) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 214, // sprites:uniffi_uniffi_sprites_fn_func_translate + 218, // sprites:uniffi_uniffi_sprites_fn_func_translate FfiConverterTypePoint.lower(p), FfiConverterTypeVector.lower(v), ) diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustTodolist.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustTodolist.sys.mjs index ce02fe1318cc..00cdbbad81b0 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustTodolist.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustTodolist.sys.mjs @@ -172,7 +172,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerTodoList() { - const pointerId = 21; // todolist:TodoList + const pointerId = 22; // todolist:TodoList const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -182,7 +182,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerTodoList(value) { - const pointerId = 21; // todolist:TodoList + const pointerId = 22; // todolist:TodoList UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -343,7 +343,7 @@ export class TodoList { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 234, // todolist:uniffi_uniffi_todolist_fn_constructor_todolist_new + 238, // todolist:uniffi_uniffi_todolist_fn_constructor_todolist_new ) } try { @@ -368,7 +368,7 @@ export class TodoList { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 223, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entries + 227, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entries FfiConverterTypeTodoList.lower(this), FfiConverterSequenceTypeTodoEntry.lower(entries), ) @@ -396,7 +396,7 @@ export class TodoList { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 224, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entry + 228, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entry FfiConverterTypeTodoList.lower(this), FfiConverterTypeTodoEntry.lower(entry), ) @@ -424,7 +424,7 @@ export class TodoList { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 225, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_item + 229, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_item FfiConverterTypeTodoList.lower(this), FfiConverterString.lower(todo), ) @@ -452,7 +452,7 @@ export class TodoList { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 226, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_items + 230, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_items FfiConverterTypeTodoList.lower(this), FfiConverterSequencestring.lower(items), ) @@ -480,7 +480,7 @@ export class TodoList { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 227, // todolist:uniffi_uniffi_todolist_fn_method_todolist_clear_item + 231, // todolist:uniffi_uniffi_todolist_fn_method_todolist_clear_item FfiConverterTypeTodoList.lower(this), FfiConverterString.lower(todo), ) @@ -501,7 +501,7 @@ export class TodoList { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 228, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_entries + 232, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_entries FfiConverterTypeTodoList.lower(this), ) } @@ -521,7 +521,7 @@ export class TodoList { const liftError = (data) => FfiConverterTypeTodoError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 229, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_first + 233, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_first FfiConverterTypeTodoList.lower(this), ) } @@ -541,7 +541,7 @@ export class TodoList { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 230, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_items + 234, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_items FfiConverterTypeTodoList.lower(this), ) } @@ -561,7 +561,7 @@ export class TodoList { const liftError = (data) => FfiConverterTypeTodoError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 231, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last + 235, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last FfiConverterTypeTodoList.lower(this), ) } @@ -581,7 +581,7 @@ export class TodoList { const liftError = (data) => FfiConverterTypeTodoError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 232, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last_entry + 236, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last_entry FfiConverterTypeTodoList.lower(this), ) } @@ -600,7 +600,7 @@ export class TodoList { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 233, // todolist:uniffi_uniffi_todolist_fn_method_todolist_make_default + 237, // todolist:uniffi_uniffi_todolist_fn_method_todolist_make_default FfiConverterTypeTodoList.lower(this), ) } @@ -992,7 +992,7 @@ export function createEntryWith(todo) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 220, // todolist:uniffi_uniffi_todolist_fn_func_create_entry_with + 224, // todolist:uniffi_uniffi_todolist_fn_func_create_entry_with FfiConverterString.lower(todo), ) } @@ -1013,7 +1013,7 @@ export function getDefaultList() { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsyncWrapper( - 221, // todolist:uniffi_uniffi_todolist_fn_func_get_default_list + 225, // todolist:uniffi_uniffi_todolist_fn_func_get_default_list ) } try { @@ -1040,7 +1040,7 @@ export function setDefaultList(list) { throw e; } return UniFFIScaffolding.callAsyncWrapper( - 222, // todolist:uniffi_uniffi_todolist_fn_func_set_default_list + 226, // todolist:uniffi_uniffi_todolist_fn_func_set_default_list FfiConverterTypeTodoList.lower(list), ) } diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustUniffiTraitInterfaces.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustUniffiTraitInterfaces.sys.mjs index db1d21b2fc15..256003a87a35 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustUniffiTraitInterfaces.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustUniffiTraitInterfaces.sys.mjs @@ -172,7 +172,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerCalc() { - const pointerId = 22; // uniffi_trait_interfaces:Calc + const pointerId = 23; // uniffi_trait_interfaces:Calc const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); this.pos += 8; return res; @@ -182,7 +182,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. writePointerCalc(value) { - const pointerId = 22; // uniffi_trait_interfaces:Calc + const pointerId = 23; // uniffi_trait_interfaces:Calc UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); this.pos += 8; } @@ -388,7 +388,7 @@ export class Calc { throw e; } return UniFFIScaffolding.callSync( - 237, // uniffi_trait_interfaces:uniffi_uniffi_trait_interfaces_fn_method_calc_add + 241, // uniffi_trait_interfaces:uniffi_uniffi_trait_interfaces_fn_method_calc_add FfiConverterTypeCalc.lower(this), FfiConverterU32.lower(a), FfiConverterU32.lower(b), @@ -442,7 +442,7 @@ export function makeBuggyCalculator() { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 235, // uniffi_trait_interfaces:uniffi_uniffi_trait_interfaces_fn_func_make_buggy_calculator + 239, // uniffi_trait_interfaces:uniffi_uniffi_trait_interfaces_fn_func_make_buggy_calculator ) } return handleRustResult(functionCall(), liftResult, liftError); @@ -458,7 +458,7 @@ export function makeCalculator() { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callSync( - 236, // uniffi_trait_interfaces:uniffi_uniffi_trait_interfaces_fn_func_make_calculator + 240, // uniffi_trait_interfaces:uniffi_uniffi_trait_interfaces_fn_func_make_calculator ) } return handleRustResult(functionCall(), liftResult, liftError); diff --git a/toolkit/components/uniffi-js/GeneratedScaffolding.cpp b/toolkit/components/uniffi-js/GeneratedScaffolding.cpp index 3f4a2b5477da..bb8c00f48f7b 100644 --- a/toolkit/components/uniffi-js/GeneratedScaffolding.cpp +++ b/toolkit/components/uniffi-js/GeneratedScaffolding.cpp @@ -105,6 +105,83 @@ extern "C" { RustCallStatus call_status; }; typedef void (*ForeignFutureCompleteVoid)(uint64_t, ForeignFutureStructVoid); + typedef void (*CallbackInterfaceContextIdCallbackMethod0)(uint64_t, RustBuffer, int64_t, void*, RustCallStatus*); + typedef void (*CallbackInterfaceContextIdCallbackMethod1)(uint64_t, RustBuffer, void*, RustCallStatus*); + struct VTableCallbackInterfaceContextIdCallback { + CallbackInterfaceContextIdCallbackMethod0 persist; + CallbackInterfaceContextIdCallbackMethod1 rotated; + CallbackInterfaceFree uniffi_free; + }; + void* uniffi_context_id_fn_clone_contextidcomponent(void*, RustCallStatus*); + void uniffi_context_id_fn_free_contextidcomponent(void*, RustCallStatus*); + void* uniffi_context_id_fn_constructor_contextidcomponent_new(RustBuffer, int64_t, int8_t, uint64_t, RustCallStatus*); + void uniffi_context_id_fn_method_contextidcomponent_force_rotation(void*, RustCallStatus*); + RustBuffer uniffi_context_id_fn_method_contextidcomponent_request(void*, uint8_t, RustCallStatus*); + void uniffi_context_id_fn_method_contextidcomponent_unset_callback(void*, RustCallStatus*); + void uniffi_context_id_fn_init_callback_vtable_contextidcallback(VTableCallbackInterfaceContextIdCallback*); + 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); + void ffi_context_id_rust_future_free_u8(uint64_t); + uint8_t ffi_context_id_rust_future_complete_u8(uint64_t, RustCallStatus*); + void ffi_context_id_rust_future_poll_i8(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_context_id_rust_future_cancel_i8(uint64_t); + void ffi_context_id_rust_future_free_i8(uint64_t); + int8_t ffi_context_id_rust_future_complete_i8(uint64_t, RustCallStatus*); + void ffi_context_id_rust_future_poll_u16(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_context_id_rust_future_cancel_u16(uint64_t); + void ffi_context_id_rust_future_free_u16(uint64_t); + uint16_t ffi_context_id_rust_future_complete_u16(uint64_t, RustCallStatus*); + void ffi_context_id_rust_future_poll_i16(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_context_id_rust_future_cancel_i16(uint64_t); + void ffi_context_id_rust_future_free_i16(uint64_t); + int16_t ffi_context_id_rust_future_complete_i16(uint64_t, RustCallStatus*); + void ffi_context_id_rust_future_poll_u32(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_context_id_rust_future_cancel_u32(uint64_t); + void ffi_context_id_rust_future_free_u32(uint64_t); + uint32_t ffi_context_id_rust_future_complete_u32(uint64_t, RustCallStatus*); + void ffi_context_id_rust_future_poll_i32(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_context_id_rust_future_cancel_i32(uint64_t); + void ffi_context_id_rust_future_free_i32(uint64_t); + int32_t ffi_context_id_rust_future_complete_i32(uint64_t, RustCallStatus*); + void ffi_context_id_rust_future_poll_u64(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_context_id_rust_future_cancel_u64(uint64_t); + void ffi_context_id_rust_future_free_u64(uint64_t); + uint64_t ffi_context_id_rust_future_complete_u64(uint64_t, RustCallStatus*); + void ffi_context_id_rust_future_poll_i64(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_context_id_rust_future_cancel_i64(uint64_t); + void ffi_context_id_rust_future_free_i64(uint64_t); + int64_t ffi_context_id_rust_future_complete_i64(uint64_t, RustCallStatus*); + void ffi_context_id_rust_future_poll_f32(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_context_id_rust_future_cancel_f32(uint64_t); + void ffi_context_id_rust_future_free_f32(uint64_t); + float ffi_context_id_rust_future_complete_f32(uint64_t, RustCallStatus*); + void ffi_context_id_rust_future_poll_f64(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_context_id_rust_future_cancel_f64(uint64_t); + void ffi_context_id_rust_future_free_f64(uint64_t); + double ffi_context_id_rust_future_complete_f64(uint64_t, RustCallStatus*); + void ffi_context_id_rust_future_poll_pointer(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_context_id_rust_future_cancel_pointer(uint64_t); + void ffi_context_id_rust_future_free_pointer(uint64_t); + void* ffi_context_id_rust_future_complete_pointer(uint64_t, RustCallStatus*); + void ffi_context_id_rust_future_poll_rust_buffer(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_context_id_rust_future_cancel_rust_buffer(uint64_t); + void ffi_context_id_rust_future_free_rust_buffer(uint64_t); + RustBuffer ffi_context_id_rust_future_complete_rust_buffer(uint64_t, RustCallStatus*); + void ffi_context_id_rust_future_poll_void(uint64_t, RustFutureContinuationCallback, uint64_t); + void ffi_context_id_rust_future_cancel_void(uint64_t); + void ffi_context_id_rust_future_free_void(uint64_t); + void ffi_context_id_rust_future_complete_void(uint64_t, RustCallStatus*); + uint16_t uniffi_context_id_checksum_method_contextidcomponent_force_rotation(); + uint16_t uniffi_context_id_checksum_method_contextidcomponent_request(); + uint16_t uniffi_context_id_checksum_method_contextidcomponent_unset_callback(); + uint16_t uniffi_context_id_checksum_constructor_contextidcomponent_new(); + uint16_t uniffi_context_id_checksum_method_contextidcallback_persist(); + uint16_t uniffi_context_id_checksum_method_contextidcallback_rotated(); + uint32_t ffi_context_id_uniffi_contract_version(); typedef void (*CallbackInterfaceApplicationErrorReporterMethod0)(uint64_t, RustBuffer, RustBuffer, void*, RustCallStatus*); typedef void (*CallbackInterfaceApplicationErrorReporterMethod1)(uint64_t, RustBuffer, RustBuffer, uint32_t, uint32_t, void*, RustCallStatus*); struct VTableCallbackInterfaceApplicationErrorReporter { @@ -1755,6 +1832,79 @@ extern "C" { // Define pointer types and FfiValueObjectHandle* classes +const static mozilla::uniffi::UniFFIPointerType kContextIdContextIdComponentPointerType { + "context_id::ContextIDComponent"_ns, + uniffi_context_id_fn_clone_contextidcomponent, + uniffi_context_id_fn_free_contextidcomponent, +}; + +class FfiValueObjectHandleContextIdContextIdComponent { + private: + void* mValue = nullptr; + + public: + FfiValueObjectHandleContextIdContextIdComponent() = default; + explicit FfiValueObjectHandleContextIdContextIdComponent(void* aValue) : mValue(aValue) {} + + // Delete copy constructor and assignment as this type is non-copyable. + FfiValueObjectHandleContextIdContextIdComponent(const FfiValueObjectHandleContextIdContextIdComponent&) = delete; + FfiValueObjectHandleContextIdContextIdComponent& operator=(const FfiValueObjectHandleContextIdContextIdComponent&) = delete; + + FfiValueObjectHandleContextIdContextIdComponent& operator=(FfiValueObjectHandleContextIdContextIdComponent&& 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(&kContextIdContextIdComponentPointerType)) { + aError.ThrowTypeError("Incorrect UniFFI pointer type"_ns); + return; + } + FreeHandle(); + mValue = value.ClonePtr(); + } + + void Lift(JSContext* aContext, dom::OwningUniFFIScaffoldingValue* aDest, + ErrorResult& aError) { + aDest->SetAsUniFFIPointer() = + dom::UniFFIPointer::Create(mValue, &kContextIdContextIdComponentPointerType); + mValue = nullptr; + } + + void* IntoRust() { + auto temp = mValue; + mValue = nullptr; + return temp; + } + + static FfiValueObjectHandleContextIdContextIdComponent FromRust(void* aValue) { + return FfiValueObjectHandleContextIdContextIdComponent(aValue); + } + + void FreeHandle() { + if (mValue) { + RustCallStatus callStatus{}; + (uniffi_context_id_fn_free_contextidcomponent)(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. + } + } + + ~FfiValueObjectHandleContextIdContextIdComponent() { + // 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 kRelevancyRelevancyStorePointerType { "relevancy::RelevancyStore"_ns, uniffi_relevancy_fn_clone_relevancystore, @@ -3440,6 +3590,131 @@ class FfiValueObjectHandleUniffiTraitInterfacesCalc { // Callback interface method handlers, vtables, etc. +static StaticRefPtr gCallbackInterfaceJsHandlerContextIdCallback; + +class CallbackInterfaceMethodContextIdCallbackPersist : public UniffiCallbackMethodHandlerBase { +private: + // Rust arguments + FfiValueRustBuffer context_id{}; + FfiValueInt creation_date{}; + +public: + CallbackInterfaceMethodContextIdCallbackPersist(size_t aObjectHandle, RustBuffer context_id, int64_t creation_date) + : UniffiCallbackMethodHandlerBase("context_id:ContextIdCallback", aObjectHandle), context_id(FfiValueRustBuffer::FromRust(context_id)), creation_date(FfiValueInt::FromRust(creation_date)) { + } + + MOZ_CAN_RUN_SCRIPT + void MakeCall(JSContext* aCx, dom::UniFFICallbackHandler* aJsHandler, ErrorResult& aError) override { + nsTArray uniffiArgs; + // Setup + if (!uniffiArgs.AppendElements(2, mozilla::fallible)) { + aError.Throw(NS_ERROR_OUT_OF_MEMORY); + return; + } + + // Convert each argument + context_id.Lift( + aCx, + &uniffiArgs[0], + aError); + if (aError.Failed()) { + return; + } + creation_date.Lift( + aCx, + &uniffiArgs[1], + aError); + if (aError.Failed()) { + return; + } + + // Stores the return value. For now, we currently don't do anything with it, since we only support + // fire-and-forget callbacks. + NullableRootedUnion returnValue(aCx); + // Make the call + aJsHandler->Call(mObjectHandle, 0, uniffiArgs, returnValue, aError); + } +}; + +extern "C" void callback_interface_context_id_callback_persist( + uint64_t uniffiHandle, + RustBuffer context_id, int64_t creation_date, + void* uniffiOutReturn, + RustCallStatus* uniffiCallStatus +) { + UniquePtr handler = MakeUnique(uniffiHandle, context_id, creation_date); + // Note: currently we only support queueing fire-and-forget async callbacks + + // For fire-and-forget callbacks, we don't know if the method succeeds or not + // since it's called later. uniffiCallStatus is initialized to a successful + // state by the Rust code, so there's no need to modify it. + UniffiCallbackMethodHandlerBase::FireAndForget(std::move(handler), &gCallbackInterfaceJsHandlerContextIdCallback); +} + +class CallbackInterfaceMethodContextIdCallbackRotated : public UniffiCallbackMethodHandlerBase { +private: + // Rust arguments + FfiValueRustBuffer old_context_id{}; + +public: + CallbackInterfaceMethodContextIdCallbackRotated(size_t aObjectHandle, RustBuffer old_context_id) + : UniffiCallbackMethodHandlerBase("context_id:ContextIdCallback", aObjectHandle), old_context_id(FfiValueRustBuffer::FromRust(old_context_id)) { + } + + MOZ_CAN_RUN_SCRIPT + void MakeCall(JSContext* aCx, dom::UniFFICallbackHandler* aJsHandler, ErrorResult& aError) override { + nsTArray uniffiArgs; + // Setup + if (!uniffiArgs.AppendElements(1, mozilla::fallible)) { + aError.Throw(NS_ERROR_OUT_OF_MEMORY); + return; + } + + // Convert each argument + old_context_id.Lift( + aCx, + &uniffiArgs[0], + aError); + if (aError.Failed()) { + return; + } + + // Stores the return value. For now, we currently don't do anything with it, since we only support + // fire-and-forget callbacks. + NullableRootedUnion returnValue(aCx); + // Make the call + aJsHandler->Call(mObjectHandle, 1, uniffiArgs, returnValue, aError); + } +}; + +extern "C" void callback_interface_context_id_callback_rotated( + uint64_t uniffiHandle, + RustBuffer old_context_id, + void* uniffiOutReturn, + RustCallStatus* uniffiCallStatus +) { + UniquePtr handler = MakeUnique(uniffiHandle, old_context_id); + // Note: currently we only support queueing fire-and-forget async callbacks + + // For fire-and-forget callbacks, we don't know if the method succeeds or not + // since it's called later. uniffiCallStatus is initialized to a successful + // state by the Rust code, so there's no need to modify it. + UniffiCallbackMethodHandlerBase::FireAndForget(std::move(handler), &gCallbackInterfaceJsHandlerContextIdCallback); +} + +extern "C" void callbackInterfaceFreeContextIdCallback(uint64_t uniffiHandle) { + // Callback object handles are keys in a map stored in the JS handler. To + // handle the free call, make a call into JS which will remove the key. + // Fire-and-forget is perfect for this. + UniffiCallbackMethodHandlerBase::FireAndForget(MakeUnique("context_id:ContextIdCallback", uniffiHandle), &gCallbackInterfaceJsHandlerContextIdCallback); +} + + +static VTableCallbackInterfaceContextIdCallback kCallbackInterfaceVtableContextIdCallback { + callback_interface_context_id_callback_persist, + callback_interface_context_id_callback_rotated, + callbackInterfaceFreeContextIdCallback +}; static StaticRefPtr gCallbackInterfaceJsHandlerApplicationErrorReporter; class CallbackInterfaceMethodApplicationErrorReporterReportError : public UniffiCallbackMethodHandlerBase { @@ -3767,6 +4042,16 @@ void RegisterCallbackHandler(uint64_t aInterfaceId, UniFFICallbackHandler& aCall switch (aInterfaceId) { case 0: { + if (gCallbackInterfaceJsHandlerContextIdCallback) { + aError.ThrowUnknownError("[UniFFI] Callback handler already registered for context_id:ContextIdCallback"_ns); + return; + } + + gCallbackInterfaceJsHandlerContextIdCallback = &aCallbackHandler; + uniffi_context_id_fn_init_callback_vtable_contextidcallback(&kCallbackInterfaceVtableContextIdCallback); + break; + } + case 1: { if (gCallbackInterfaceJsHandlerApplicationErrorReporter) { aError.ThrowUnknownError("[UniFFI] Callback handler already registered for errorsupport:ApplicationErrorReporter"_ns); return; @@ -3778,7 +4063,7 @@ void RegisterCallbackHandler(uint64_t aInterfaceId, UniFFICallbackHandler& aCall } #ifdef MOZ_UNIFFI_FIXTURES - case 1: { + case 2: { if (gCallbackInterfaceJsHandlerLogger) { aError.ThrowUnknownError("[UniFFI] Callback handler already registered for fixture_callbacks:Logger"_ns); return; @@ -3800,6 +4085,15 @@ void DeregisterCallbackHandler(uint64_t aInterfaceId, ErrorResult& aError) { switch (aInterfaceId) { case 0: { + if (!gCallbackInterfaceJsHandlerContextIdCallback) { + aError.ThrowUnknownError("[UniFFI] Callback handler not registered for context_id:ContextIdCallback"_ns); + return; + } + + gCallbackInterfaceJsHandlerContextIdCallback = nullptr; + break; + } + case 1: { if (!gCallbackInterfaceJsHandlerApplicationErrorReporter) { aError.ThrowUnknownError("[UniFFI] Callback handler not registered for errorsupport:ApplicationErrorReporter"_ns); return; @@ -3810,7 +4104,7 @@ void DeregisterCallbackHandler(uint64_t aInterfaceId, ErrorResult& aError) { } #ifdef MOZ_UNIFFI_FIXTURES - case 1: { + case 2: { if (!gCallbackInterfaceJsHandlerLogger) { aError.ThrowUnknownError("[UniFFI] Callback handler not registered for fixture_callbacks:Logger"_ns); return; @@ -3830,6 +4124,146 @@ void DeregisterCallbackHandler(uint64_t aInterfaceId, ErrorResult& aError) { // Define scaffolding call classes for each combination of return/argument types +class ScaffoldingCallHandlerUniffiContextIdFnMethodContextidcomponentForceRotation : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleContextIdContextIdComponent mPtr{}; + + // MakeRustCall stores the result of the call in these fields + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + mPtr.Lower(aArgs[0], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + uniffi_context_id_fn_method_contextidcomponent_force_rotation( + mPtr.IntoRust(), + aOutStatus + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniffiContextIdFnMethodContextidcomponentRequest : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleContextIdContextIdComponent mPtr{}; + FfiValueInt mRotationDaysInS{}; + + // MakeRustCall stores the result of the call in these fields + FfiValueRustBuffer mUniffiReturnValue{}; + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + mPtr.Lower(aArgs[0], aError); + if (aError.Failed()) { + return; + } + mRotationDaysInS.Lower(aArgs[1], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + mUniffiReturnValue = FfiValueRustBuffer::FromRust( + uniffi_context_id_fn_method_contextidcomponent_request( + mPtr.IntoRust(), + mRotationDaysInS.IntoRust(), + aOutStatus + ) + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); + } +}; +class ScaffoldingCallHandlerUniffiContextIdFnMethodContextidcomponentUnsetCallback : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueObjectHandleContextIdContextIdComponent mPtr{}; + + // MakeRustCall stores the result of the call in these fields + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + mPtr.Lower(aArgs[0], aError); + if (aError.Failed()) { + return; + } + } + + void MakeRustCall(RustCallStatus* aOutStatus) override { + uniffi_context_id_fn_method_contextidcomponent_unset_callback( + mPtr.IntoRust(), + aOutStatus + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + } +}; +class ScaffoldingCallHandlerUniffiContextIdFnConstructorContextidcomponentNew : public UniffiSyncCallHandler { +private: + // LowerRustArgs stores the resulting arguments in these fields + FfiValueRustBuffer mInitContextId{}; + FfiValueInt mCreationTimestampS{}; + FfiValueInt mRunningInTestAutomation{}; + FfiValueInt mCallback{}; + + // MakeRustCall stores the result of the call in these fields + FfiValueObjectHandleContextIdContextIdComponent mUniffiReturnValue{}; + +public: + void LowerRustArgs(const dom::Sequence& aArgs, ErrorResult& aError) override { + mInitContextId.Lower(aArgs[0], aError); + if (aError.Failed()) { + return; + } + 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 = FfiValueObjectHandleContextIdContextIdComponent::FromRust( + uniffi_context_id_fn_constructor_contextidcomponent_new( + mInitContextId.IntoRust(), + mCreationTimestampS.IntoRust(), + mRunningInTestAutomation.IntoRust(), + mCallback.IntoRust(), + aOutStatus + ) + ); + } + + virtual void LiftSuccessfulCallResult(JSContext* aCx, dom::Optional& aDest, ErrorResult& aError) override { + mUniffiReturnValue.Lift( + aCx, + &aDest.Construct(), + aError + ); + } +}; class ScaffoldingCallHandlerUniffiErrorSupportFnFuncSetApplicationErrorReporter : public UniffiSyncCallHandler { private: // LowerRustArgs stores the resulting arguments in these fields @@ -12120,671 +12554,683 @@ UniquePtr GetSyncCallHandler(uint64_t aId) { switch (aId) { case 0: { - return MakeUnique(); + return MakeUnique(); } 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(); + return MakeUnique(); } case 49: { - return MakeUnique(); + return MakeUnique(); } case 50: { - return MakeUnique(); + 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(); + return MakeUnique(); } case 66: { - return MakeUnique(); + return MakeUnique(); } case 67: { - return MakeUnique(); + return MakeUnique(); } case 68: { - return MakeUnique(); + return MakeUnique(); } case 69: { - return MakeUnique(); + return MakeUnique(); } case 70: { - return MakeUnique(); + return MakeUnique(); } case 71: { - return MakeUnique(); + return MakeUnique(); } case 72: { - return MakeUnique(); + return MakeUnique(); } case 73: { - return MakeUnique(); + return MakeUnique(); } case 74: { - return MakeUnique(); + return MakeUnique(); } case 75: { - return MakeUnique(); + return MakeUnique(); } case 76: { - return MakeUnique(); + return MakeUnique(); } case 77: { - return MakeUnique(); + return MakeUnique(); } case 78: { - return MakeUnique(); + return MakeUnique(); } case 79: { - return MakeUnique(); + return MakeUnique(); } case 80: { - return MakeUnique(); + return MakeUnique(); } case 81: { - return MakeUnique(); + return MakeUnique(); } case 82: { - return MakeUnique(); + return MakeUnique(); } case 83: { - return MakeUnique(); + return MakeUnique(); } case 84: { - return MakeUnique(); + return MakeUnique(); } case 85: { - return MakeUnique(); + return MakeUnique(); } case 86: { - return MakeUnique(); + return MakeUnique(); } case 87: { - return MakeUnique(); + return MakeUnique(); } case 88: { - return MakeUnique(); + return MakeUnique(); } case 89: { - return MakeUnique(); + return MakeUnique(); } case 90: { - return MakeUnique(); + return MakeUnique(); } case 91: { - return MakeUnique(); + return MakeUnique(); } case 92: { - return MakeUnique(); + return MakeUnique(); } case 93: { - return MakeUnique(); + return MakeUnique(); } case 94: { - return MakeUnique(); + return MakeUnique(); } case 95: { - return MakeUnique(); + return MakeUnique(); } case 96: { - return MakeUnique(); + return MakeUnique(); } case 97: { - return MakeUnique(); + return MakeUnique(); } case 98: { - return MakeUnique(); + return MakeUnique(); } case 99: { - return MakeUnique(); + return MakeUnique(); } case 100: { - return MakeUnique(); + return MakeUnique(); } case 101: { - return MakeUnique(); + return MakeUnique(); } case 102: { - return MakeUnique(); + return MakeUnique(); } case 103: { - return MakeUnique(); + return MakeUnique(); } case 104: { + return MakeUnique(); + } + case 105: { + return MakeUnique(); + } + case 106: { + return MakeUnique(); + } + case 107: { + return MakeUnique(); + } + case 108: { return MakeUnique(); } #ifdef MOZ_UNIFFI_FIXTURES - case 105: { + case 109: { return MakeUnique(); } - case 106: { + case 110: { return MakeUnique(); } - case 107: { + case 111: { return MakeUnique(); } - case 108: { + case 112: { return MakeUnique(); } - case 109: { + case 113: { return MakeUnique(); } - case 110: { + case 114: { return MakeUnique(); } - case 111: { + case 115: { return MakeUnique(); } - case 112: { + case 116: { return MakeUnique(); } - case 113: { + case 117: { return MakeUnique(); } - case 114: { + case 118: { return MakeUnique(); } - case 115: { + case 119: { return MakeUnique(); } - case 116: { + case 120: { return MakeUnique(); } - case 117: { + case 121: { return MakeUnique(); } - case 118: { + case 122: { return MakeUnique(); } - case 119: { + case 123: { return MakeUnique(); } - case 120: { + case 124: { return MakeUnique(); } - case 121: { + case 125: { return MakeUnique(); } - case 122: { + case 126: { return MakeUnique(); } - case 123: { + case 127: { return MakeUnique(); } - case 125: { + case 129: { return MakeUnique(); } - case 126: { + case 130: { return MakeUnique(); } - case 141: { + case 145: { return MakeUnique(); } - case 143: { + case 147: { return MakeUnique(); } - case 144: { + case 148: { return MakeUnique(); } - case 145: { + case 149: { return MakeUnique(); } - case 146: { + case 150: { return MakeUnique(); } - case 147: { + case 151: { return MakeUnique(); } - case 148: { + case 152: { return MakeUnique(); } - case 149: { + case 153: { return MakeUnique(); } - case 150: { + case 154: { return MakeUnique(); } - case 151: { + case 155: { return MakeUnique(); } - case 152: { + case 156: { return MakeUnique(); } - case 153: { + case 157: { return MakeUnique(); } - case 154: { + case 158: { return MakeUnique(); } - case 155: { + case 159: { return MakeUnique(); } - case 156: { + case 160: { return MakeUnique(); } - case 157: { + case 161: { return MakeUnique(); } - case 158: { + case 162: { return MakeUnique(); } - case 159: { + case 163: { return MakeUnique(); } - case 160: { + case 164: { return MakeUnique(); } - case 161: { + case 165: { return MakeUnique(); } - case 162: { + case 166: { return MakeUnique(); } - case 163: { + case 167: { return MakeUnique(); } - case 164: { + case 168: { return MakeUnique(); } - case 165: { + case 169: { return MakeUnique(); } - case 166: { + case 170: { return MakeUnique(); } - case 167: { + case 171: { return MakeUnique(); } - case 168: { + case 172: { return MakeUnique(); } - case 169: { + case 173: { return MakeUnique(); } - case 170: { + case 174: { return MakeUnique(); } - case 171: { + case 175: { return MakeUnique(); } - case 172: { + case 176: { return MakeUnique(); } - case 173: { + case 177: { return MakeUnique(); } - case 174: { + case 178: { return MakeUnique(); } - case 175: { + case 179: { return MakeUnique(); } - case 176: { + case 180: { return MakeUnique(); } - case 177: { + case 181: { return MakeUnique(); } - case 178: { + case 182: { return MakeUnique(); } - case 179: { + case 183: { return MakeUnique(); } - case 180: { + case 184: { return MakeUnique(); } - case 181: { + case 185: { return MakeUnique(); } - case 182: { + case 186: { return MakeUnique(); } - case 183: { + case 187: { return MakeUnique(); } - case 184: { + case 188: { return MakeUnique(); } - case 185: { + case 189: { return MakeUnique(); } - case 186: { + case 190: { return MakeUnique(); } - case 187: { + case 191: { return MakeUnique(); } - case 188: { + case 192: { return MakeUnique(); } - case 189: { + case 193: { return MakeUnique(); } - case 190: { + case 194: { return MakeUnique(); } - case 191: { + case 195: { return MakeUnique(); } - case 192: { + case 196: { return MakeUnique(); } - case 193: { + case 197: { return MakeUnique(); } - case 194: { + case 198: { return MakeUnique(); } - case 195: { + case 199: { return MakeUnique(); } - case 196: { + case 200: { return MakeUnique(); } - case 197: { + case 201: { return MakeUnique(); } - case 198: { + case 202: { return MakeUnique(); } - case 199: { + case 203: { return MakeUnique(); } - case 200: { + case 204: { return MakeUnique(); } - case 201: { + case 205: { return MakeUnique(); } - case 202: { + case 206: { return MakeUnique(); } - case 203: { + case 207: { return MakeUnique(); } - case 204: { + case 208: { return MakeUnique(); } - case 205: { + case 209: { return MakeUnique(); } - case 206: { + case 210: { return MakeUnique(); } - case 207: { + case 211: { return MakeUnique(); } - case 208: { + case 212: { return MakeUnique(); } - case 209: { + case 213: { return MakeUnique(); } - case 210: { + case 214: { return MakeUnique(); } - case 211: { + case 215: { return MakeUnique(); } - case 212: { + case 216: { return MakeUnique(); } - case 213: { + case 217: { return MakeUnique(); } - case 214: { + case 218: { return MakeUnique(); } - case 215: { + case 219: { return MakeUnique(); } - case 216: { + case 220: { return MakeUnique(); } - case 217: { + case 221: { return MakeUnique(); } - case 218: { + case 222: { return MakeUnique(); } - case 219: { + case 223: { return MakeUnique(); } - case 220: { + case 224: { return MakeUnique(); } - case 221: { + case 225: { return MakeUnique(); } - case 222: { + case 226: { return MakeUnique(); } - case 223: { + case 227: { return MakeUnique(); } - case 224: { + case 228: { return MakeUnique(); } - case 225: { + case 229: { return MakeUnique(); } - case 226: { + case 230: { return MakeUnique(); } - case 227: { + case 231: { return MakeUnique(); } - case 228: { + case 232: { return MakeUnique(); } - case 229: { + case 233: { return MakeUnique(); } - case 230: { + case 234: { return MakeUnique(); } - case 231: { + case 235: { return MakeUnique(); } - case 232: { + case 236: { return MakeUnique(); } - case 233: { + case 237: { return MakeUnique(); } - case 234: { + case 238: { return MakeUnique(); } - case 235: { + case 239: { return MakeUnique(); } - case 236: { + case 240: { return MakeUnique(); } - case 237: { + case 241: { return MakeUnique(); } #endif /* MOZ_UNIFFI_FIXTURES */ @@ -12799,52 +13245,52 @@ UniquePtr GetAsyncCallHandler(uint64_t aId) { #ifdef MOZ_UNIFFI_FIXTURES - case 124: { + case 128: { return MakeUnique(); } - case 127: { + case 131: { return MakeUnique(); } - case 128: { + case 132: { return MakeUnique(); } - case 129: { + case 133: { return MakeUnique(); } - case 130: { + case 134: { return MakeUnique(); } - case 131: { + case 135: { return MakeUnique(); } - case 132: { + case 136: { return MakeUnique(); } - case 133: { + case 137: { return MakeUnique(); } - case 134: { + case 138: { return MakeUnique(); } - case 135: { + case 139: { return MakeUnique(); } - case 136: { + case 140: { return MakeUnique(); } - case 137: { + case 141: { return MakeUnique(); } - case 138: { + case 142: { return MakeUnique(); } - case 139: { + case 143: { return MakeUnique(); } - case 140: { + case 144: { return MakeUnique(); } - case 142: { + case 146: { return MakeUnique(); } #endif /* MOZ_UNIFFI_FIXTURES */ @@ -12860,96 +13306,100 @@ Maybe> ReadPointer(const GlobalObject& aGlobal, switch (aId) { case 0: { - type = &kRelevancyRelevancyStorePointerType; + type = &kContextIdContextIdComponentPointerType; break; } case 1: { - type = &kRemoteSettingsRemoteSettingsPointerType; + type = &kRelevancyRelevancyStorePointerType; break; } case 2: { - type = &kRemoteSettingsRemoteSettingsClientPointerType; + type = &kRemoteSettingsRemoteSettingsPointerType; break; } case 3: { - type = &kRemoteSettingsRemoteSettingsServicePointerType; + type = &kRemoteSettingsRemoteSettingsClientPointerType; break; } case 4: { - type = &kSearchSearchEngineSelectorPointerType; + type = &kRemoteSettingsRemoteSettingsServicePointerType; break; } case 5: { - type = &kSuggestSuggestStorePointerType; + type = &kSearchSearchEngineSelectorPointerType; break; } case 6: { - type = &kSuggestSuggestStoreBuilderPointerType; + type = &kSuggestSuggestStorePointerType; break; } case 7: { - type = &kTabsRemoteCommandStorePointerType; + type = &kSuggestSuggestStoreBuilderPointerType; break; } case 8: { - type = &kTabsTabsBridgedEnginePointerType; + type = &kTabsRemoteCommandStorePointerType; break; } case 9: { - type = &kTabsTabsStorePointerType; + type = &kTabsTabsBridgedEnginePointerType; break; } case 10: { - type = &kWebextstorageWebExtStorageBridgedEnginePointerType; + type = &kTabsTabsStorePointerType; break; } case 11: { + type = &kWebextstorageWebExtStorageBridgedEnginePointerType; + break; + } + case 12: { type = &kWebextstorageWebExtStorageStorePointerType; break; } #ifdef MOZ_UNIFFI_FIXTURES - case 12: { + case 13: { type = &kFuturesFutureTesterPointerType; break; } - case 13: { + case 14: { type = &kFuturesRustTaskPointerType; break; } - case 14: { + case 15: { type = &kFuturesTravellerPointerType; break; } - case 15: { + case 16: { type = &kFuturesWorkerQueuePointerType; break; } - case 16: { + case 17: { type = &kRefcountsSingletonObjectPointerType; break; } - case 17: { + case 18: { type = &kRondpointOptionneurPointerType; break; } - case 18: { + case 19: { type = &kRondpointRetourneurPointerType; break; } - case 19: { + case 20: { type = &kRondpointStringifierPointerType; break; } - case 20: { + case 21: { type = &kSpritesSpritePointerType; break; } - case 21: { + case 22: { type = &kTodolistTodoListPointerType; break; } - case 22: { + case 23: { type = &kUniffiTraitInterfacesCalcPointerType; break; } @@ -12965,96 +13415,100 @@ bool WritePointer(const GlobalObject& aGlobal, uint64_t aId, const UniFFIPointer switch (aId) { case 0: { - type = &kRelevancyRelevancyStorePointerType; + type = &kContextIdContextIdComponentPointerType; break; } case 1: { - type = &kRemoteSettingsRemoteSettingsPointerType; + type = &kRelevancyRelevancyStorePointerType; break; } case 2: { - type = &kRemoteSettingsRemoteSettingsClientPointerType; + type = &kRemoteSettingsRemoteSettingsPointerType; break; } case 3: { - type = &kRemoteSettingsRemoteSettingsServicePointerType; + type = &kRemoteSettingsRemoteSettingsClientPointerType; break; } case 4: { - type = &kSearchSearchEngineSelectorPointerType; + type = &kRemoteSettingsRemoteSettingsServicePointerType; break; } case 5: { - type = &kSuggestSuggestStorePointerType; + type = &kSearchSearchEngineSelectorPointerType; break; } case 6: { - type = &kSuggestSuggestStoreBuilderPointerType; + type = &kSuggestSuggestStorePointerType; break; } case 7: { - type = &kTabsRemoteCommandStorePointerType; + type = &kSuggestSuggestStoreBuilderPointerType; break; } case 8: { - type = &kTabsTabsBridgedEnginePointerType; + type = &kTabsRemoteCommandStorePointerType; break; } case 9: { - type = &kTabsTabsStorePointerType; + type = &kTabsTabsBridgedEnginePointerType; break; } case 10: { - type = &kWebextstorageWebExtStorageBridgedEnginePointerType; + type = &kTabsTabsStorePointerType; break; } case 11: { + type = &kWebextstorageWebExtStorageBridgedEnginePointerType; + break; + } + case 12: { type = &kWebextstorageWebExtStorageStorePointerType; break; } #ifdef MOZ_UNIFFI_FIXTURES - case 12: { + case 13: { type = &kFuturesFutureTesterPointerType; break; } - case 13: { + case 14: { type = &kFuturesRustTaskPointerType; break; } - case 14: { + case 15: { type = &kFuturesTravellerPointerType; break; } - case 15: { + case 16: { type = &kFuturesWorkerQueuePointerType; break; } - case 16: { + case 17: { type = &kRefcountsSingletonObjectPointerType; break; } - case 17: { + case 18: { type = &kRondpointOptionneurPointerType; break; } - case 18: { + case 19: { type = &kRondpointRetourneurPointerType; break; } - case 19: { + case 20: { type = &kRondpointStringifierPointerType; break; } - case 20: { + case 21: { type = &kSpritesSpritePointerType; break; } - case 21: { + case 22: { type = &kTodolistTodoListPointerType; break; } - case 22: { + case 23: { type = &kUniffiTraitInterfacesCalcPointerType; break; }