From e89a00ba3926c62accc3f018b5437130c09e1cda Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Thu, 6 Feb 2025 07:42:20 +0000 Subject: [PATCH] Bug 1946118 - Vendor new application-services search component into mozilla-central. r=bdk Differential Revision: https://phabricator.services.mozilla.com/D236887 --- Cargo.toml | 1 + .../test/static/browser_all_files_referenced.js | 4 ++++ .../uniffi-bindgen-gecko-js/components/Cargo.toml | 1 + .../uniffi-bindgen-gecko-js/components/lib.rs | 1 + .../uniffi-bindgen-gecko-js/components/moz.build | 1 + toolkit/components/uniffi-bindgen-gecko-js/config.toml | 10 ++++++++++ 6 files changed, 18 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index f13ffc23236e..1f99b5b07753 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -227,6 +227,7 @@ objc = { git = "https://github.com/glandium/rust-objc", rev = "4de89f5aa9851ceca # application-services overrides to make updating them all simpler. interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "25934715ecc08fc922c80797c637dea64ee742d1" } relevancy = { git = "https://github.com/mozilla/application-services", rev = "25934715ecc08fc922c80797c637dea64ee742d1" } +search = { git = "https://github.com/mozilla/application-services", rev = "25934715ecc08fc922c80797c637dea64ee742d1" } sql-support = { git = "https://github.com/mozilla/application-services", rev = "25934715ecc08fc922c80797c637dea64ee742d1" } suggest = { git = "https://github.com/mozilla/application-services", rev = "25934715ecc08fc922c80797c637dea64ee742d1" } sync15 = { git = "https://github.com/mozilla/application-services", rev = "25934715ecc08fc922c80797c637dea64ee742d1" } diff --git a/browser/base/content/test/static/browser_all_files_referenced.js b/browser/base/content/test/static/browser_all_files_referenced.js index e51e96b62f5a..7b37924cf544 100644 --- a/browser/base/content/test/static/browser_all_files_referenced.js +++ b/browser/base/content/test/static/browser_all_files_referenced.js @@ -318,6 +318,10 @@ var allowlist = [ { file: "resource://gre/localization/en-US/netwerk/necko.ftl", }, + + // To be used in Bug 1945210 - Integrate the Rust based search engine selector + // with desktop code. + { file: "resource://gre/modules/RustSearch.sys.mjs" }, ]; if (AppConstants.NIGHTLY_BUILD) { diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/Cargo.toml b/toolkit/components/uniffi-bindgen-gecko-js/components/Cargo.toml index a2c12729f91d..0c27a6747c37 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/Cargo.toml +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/Cargo.toml @@ -18,6 +18,7 @@ harness = false [dependencies] uniffi = { workspace = true } tabs = "0.1" +search = "0.1" suggest = "0.1" relevancy = "0.1" webext-storage = "0.1" diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/lib.rs b/toolkit/components/uniffi-bindgen-gecko-js/components/lib.rs index 3a3f354197f8..29521a320d53 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/lib.rs +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/lib.rs @@ -7,6 +7,7 @@ mod reexport_appservices_uniffi_scaffolding { relevancy::uniffi_reexport_scaffolding!(); suggest::uniffi_reexport_scaffolding!(); webext_storage::uniffi_reexport_scaffolding!(); + search::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 afdc0a141d31..7d8b62af2db5 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build @@ -7,6 +7,7 @@ EXTRA_JS_MODULES += [ "generated/RustRelevancy.sys.mjs", "generated/RustRemoteSettings.sys.mjs", + "generated/RustSearch.sys.mjs", "generated/RustSuggest.sys.mjs", "generated/RustSync15.sys.mjs", "generated/RustTabs.sys.mjs", diff --git a/toolkit/components/uniffi-bindgen-gecko-js/config.toml b/toolkit/components/uniffi-bindgen-gecko-js/config.toml index 5035b0671c2a..c085dc2c60c4 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/config.toml +++ b/toolkit/components/uniffi-bindgen-gecko-js/config.toml @@ -9,6 +9,16 @@ # TODO: Upgrade the TOML crate and switch to array of tables syntax. +[search.async_wrappers] +# All functions/methods are wrapped to be async by default and must be `await`ed. +enable = true +# These are exceptions to the async wrapping. These functions must not be `await`ed. +main_thread = [ + "SearchEngineSelector.new", + "SearchEngineSelector.clear_search_config", + "SearchEngineSelector.filter_engine_configuration", + "SearchEngineSelector.set_search_config", +] [suggest.async_wrappers] # All functions/methods are wrapped to be async by default and must be `await`ed.