Commit d9772d1a authored by Drew Willcoxon's avatar Drew Willcoxon Committed by dwillcoxon@mozilla.com
Browse files

Bug 1968156 - Vendor application-services 8986582 for suggest geonames and...

Bug 1968156 - Vendor application-services 8986582 for suggest geonames and weather changes. r=daisuke,supply-chain-reviewers

This vendors this revision:
https://github.com/mozilla/application-services/commit/8986582d377eac7b64bddec8aa9c5ce06b161424

It also makes some desktop fixes due to some breaking changes in Suggest, which
@daisuke previously reviewed. It's a large vendor due to vendoring some new
crates plus some app-services revisions that made changes to logging and error
reporting and touched lots of files.

Differential Revision: https://phabricator.services.mozilla.com/D250877
parent b6c76274
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -70,9 +70,9 @@ git = "https://github.com/jfkthame/mapped_hyph.git"
rev = "eff105f6ad7ec9b79816cfc1985a28e5340ad14b"
replace-with = "vendored-sources"

[source."git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285"]
[source."git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424"]
git = "https://github.com/mozilla/application-services"
rev = "fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
rev = "8986582d377eac7b64bddec8aa9c5ce06b161424"
replace-with = "vendored-sources"

[source."git+https://github.com/mozilla/audioipc?rev=e6f44a2bd1e57d11dfc737632a9e849077632330"]
+46 −26
Original line number Diff line number Diff line
@@ -973,12 +973,11 @@ dependencies = [
[[package]]
name = "context_id"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285#fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
source = "git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424#8986582d377eac7b64bddec8aa9c5ce06b161424"
dependencies = [
 "chrono",
 "error-support",
 "lazy_static",
 "log",
 "parking_lot",
 "serde",
 "serde_json",
@@ -1913,8 +1912,9 @@ dependencies = [
[[package]]
name = "error-support"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285#fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
source = "git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424#8986582d377eac7b64bddec8aa9c5ce06b161424"
dependencies = [
 "env_logger",
 "error-support-macros",
 "lazy_static",
 "log",
@@ -1925,7 +1925,7 @@ dependencies = [
[[package]]
name = "error-support-macros"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285#fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
source = "git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424#8986582d377eac7b64bddec8aa9c5ce06b161424"
dependencies = [
 "proc-macro2",
 "quote",
@@ -2044,7 +2044,7 @@ dependencies = [
[[package]]
name = "firefox-versioning"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285#fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
source = "git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424#8986582d377eac7b64bddec8aa9c5ce06b161424"
dependencies = [
 "serde_json",
 "thiserror 1.999.999",
@@ -3385,7 +3385,7 @@ dependencies = [
[[package]]
name = "interrupt-support"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285#fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
source = "git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424#8986582d377eac7b64bddec8aa9c5ce06b161424"
dependencies = [
 "lazy_static",
 "parking_lot",
@@ -5108,7 +5108,7 @@ checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba"
[[package]]
name = "payload-support"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285#fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
source = "git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424#8986582d377eac7b64bddec8aa9c5ce06b161424"
dependencies = [
 "serde",
 "serde_derive",
@@ -5615,13 +5615,12 @@ checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
[[package]]
name = "relevancy"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285#fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
source = "git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424#8986582d377eac7b64bddec8aa9c5ce06b161424"
dependencies = [
 "anyhow",
 "base64 0.21.999",
 "error-support",
 "interrupt-support",
 "log",
 "md-5",
 "parking_lot",
 "rand",
@@ -5640,14 +5639,13 @@ dependencies = [
[[package]]
name = "remote_settings"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285#fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
source = "git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424#8986582d377eac7b64bddec8aa9c5ce06b161424"
dependencies = [
 "anyhow",
 "camino",
 "error-support",
 "firefox-versioning",
 "jexl-eval",
 "log",
 "parking_lot",
 "regex",
 "rusqlite 0.33.0",
@@ -5933,7 +5931,7 @@ dependencies = [
[[package]]
name = "search"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285#fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
source = "git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424#8986582d377eac7b64bddec8aa9c5ce06b161424"
dependencies = [
 "error-support",
 "firefox-versioning",
@@ -6225,11 +6223,11 @@ dependencies = [
[[package]]
name = "sql-support"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285#fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
source = "git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424#8986582d377eac7b64bddec8aa9c5ce06b161424"
dependencies = [
 "error-support",
 "interrupt-support",
 "lazy_static",
 "log",
 "parking_lot",
 "rusqlite 0.33.0",
 "tempfile",
@@ -6431,14 +6429,13 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
[[package]]
name = "suggest"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285#fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
source = "git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424#8986582d377eac7b64bddec8aa9c5ce06b161424"
dependencies = [
 "anyhow",
 "chrono",
 "error-support",
 "extend",
 "interrupt-support",
 "log",
 "once_cell",
 "parking_lot",
 "remote_settings",
@@ -6448,6 +6445,8 @@ dependencies = [
 "serde_json",
 "sql-support",
 "thiserror 1.999.999",
 "unicase",
 "unicode-normalization",
 "uniffi",
 "url",
 "viaduct",
@@ -6483,7 +6482,7 @@ dependencies = [
[[package]]
name = "sync-guid"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285#fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
source = "git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424#8986582d377eac7b64bddec8aa9c5ce06b161424"
dependencies = [
 "base64 0.21.999",
 "rand",
@@ -6494,13 +6493,12 @@ dependencies = [
[[package]]
name = "sync15"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285#fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
source = "git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424#8986582d377eac7b64bddec8aa9c5ce06b161424"
dependencies = [
 "anyhow",
 "error-support",
 "interrupt-support",
 "lazy_static",
 "log",
 "payload-support",
 "serde",
 "serde_derive",
@@ -6534,13 +6532,12 @@ dependencies = [
[[package]]
name = "tabs"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285#fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
source = "git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424#8986582d377eac7b64bddec8aa9c5ce06b161424"
dependencies = [
 "anyhow",
 "error-support",
 "interrupt-support",
 "lazy_static",
 "log",
 "payload-support",
 "rusqlite 0.33.0",
 "serde",
@@ -6694,6 +6691,21 @@ dependencies = [
 "zerovec",
]

[[package]]
name = "tinyvec"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71"
dependencies = [
 "tinyvec_macros",
]

[[package]]
name = "tinyvec_macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"

[[package]]
name = "to_shmem"
version = "0.1.0"
@@ -6878,7 +6890,7 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]]
name = "types"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285#fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
source = "git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424#8986582d377eac7b64bddec8aa9c5ce06b161424"
dependencies = [
 "rusqlite 0.33.0",
 "serde",
@@ -6953,6 +6965,15 @@ version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"

[[package]]
name = "unicode-normalization"
version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
dependencies = [
 "tinyvec",
]

[[package]]
name = "unicode-width"
version = "0.1.999"
@@ -7281,10 +7302,10 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "viaduct"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285#fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
source = "git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424#8986582d377eac7b64bddec8aa9c5ce06b161424"
dependencies = [
 "error-support",
 "ffi-support",
 "log",
 "once_cell",
 "parking_lot",
 "prost",
@@ -7450,14 +7471,13 @@ dependencies = [
[[package]]
name = "webext-storage"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=fa8a72a77f88bc8b3743b50d76fb85cb37a38285#fa8a72a77f88bc8b3743b50d76fb85cb37a38285"
source = "git+https://github.com/mozilla/application-services?rev=8986582d377eac7b64bddec8aa9c5ce06b161424#8986582d377eac7b64bddec8aa9c5ce06b161424"
dependencies = [
 "anyhow",
 "error-support",
 "ffi-support",
 "interrupt-support",
 "lazy_static",
 "log",
 "parking_lot",
 "rusqlite 0.33.0",
 "serde",
+10 −10
Original line number Diff line number Diff line
@@ -265,15 +265,15 @@ wr_malloc_size_of = { path = "gfx/wr/wr_malloc_size_of" }
objc = { git = "https://github.com/glandium/rust-objc", rev = "4de89f5aa9851ceca4d40e7ac1e2759410c04324" }

# application-services overrides to make updating them all simpler.
context_id = { git = "https://github.com/mozilla/application-services", rev = "fa8a72a77f88bc8b3743b50d76fb85cb37a38285" }
interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "fa8a72a77f88bc8b3743b50d76fb85cb37a38285" }
relevancy = { git = "https://github.com/mozilla/application-services", rev = "fa8a72a77f88bc8b3743b50d76fb85cb37a38285" }
search = { git = "https://github.com/mozilla/application-services", rev = "fa8a72a77f88bc8b3743b50d76fb85cb37a38285" }
sql-support = { git = "https://github.com/mozilla/application-services", rev = "fa8a72a77f88bc8b3743b50d76fb85cb37a38285" }
suggest = { git = "https://github.com/mozilla/application-services", rev = "fa8a72a77f88bc8b3743b50d76fb85cb37a38285" }
sync15 = { git = "https://github.com/mozilla/application-services", rev = "fa8a72a77f88bc8b3743b50d76fb85cb37a38285" }
tabs = { git = "https://github.com/mozilla/application-services", rev = "fa8a72a77f88bc8b3743b50d76fb85cb37a38285" }
viaduct = { git = "https://github.com/mozilla/application-services", rev = "fa8a72a77f88bc8b3743b50d76fb85cb37a38285" }
webext-storage = { git = "https://github.com/mozilla/application-services", rev = "fa8a72a77f88bc8b3743b50d76fb85cb37a38285" }
context_id = { git = "https://github.com/mozilla/application-services", rev = "8986582d377eac7b64bddec8aa9c5ce06b161424" }
interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "8986582d377eac7b64bddec8aa9c5ce06b161424" }
relevancy = { git = "https://github.com/mozilla/application-services", rev = "8986582d377eac7b64bddec8aa9c5ce06b161424" }
search = { git = "https://github.com/mozilla/application-services", rev = "8986582d377eac7b64bddec8aa9c5ce06b161424" }
sql-support = { git = "https://github.com/mozilla/application-services", rev = "8986582d377eac7b64bddec8aa9c5ce06b161424" }
suggest = { git = "https://github.com/mozilla/application-services", rev = "8986582d377eac7b64bddec8aa9c5ce06b161424" }
sync15 = { git = "https://github.com/mozilla/application-services", rev = "8986582d377eac7b64bddec8aa9c5ce06b161424" }
tabs = { git = "https://github.com/mozilla/application-services", rev = "8986582d377eac7b64bddec8aa9c5ce06b161424" }
viaduct = { git = "https://github.com/mozilla/application-services", rev = "8986582d377eac7b64bddec8aa9c5ce06b161424" }
webext-storage = { git = "https://github.com/mozilla/application-services", rev = "8986582d377eac7b64bddec8aa9c5ce06b161424" }

allocator-api2 = { path = "third_party/rust/allocator-api2" }
+19 −15
Original line number Diff line number Diff line
@@ -99,10 +99,12 @@ class _GeolocationUtils {
   *   `locationFromItem(item)` and it should return an object with the
   *   following properties, all optional:
   *
   *   {number} latitude
   *     The location's latitude in decimal coordinates.
   *   {number} longitude
   *     The location's longitude in decimal coordinates.
   *   {String|number} latitude
   *     The location's latitude in decimal coordinates as either a string or
   *     float.
   *   {String|number} longitude
   *     The location's longitude in decimal coordinates as either a string or
   *     float.
   *   {string} country
   *     The location's two-digit ISO country code. Case doesn't matter.
   *   {string} region
@@ -158,9 +160,9 @@ class _GeolocationUtils {
   *   `geo` does not include a location or coordinates, null is returned.
   */
  #bestByDistance(geo, items, locationFromItem) {
    let geoLat = geo.location?.latitude;
    let geoLong = geo.location?.longitude;
    if (typeof geoLat != "number" || typeof geoLong != "number") {
    let geoLat = parseFloat(geo.location?.latitude);
    let geoLong = parseFloat(geo.location?.longitude);
    if (isNaN(geoLat) || isNaN(geoLong)) {
      return null;
    }

@@ -174,15 +176,17 @@ class _GeolocationUtils {
    let dMin = Infinity;
    for (let item of items) {
      let location = locationFromItem(item);
      if (
        typeof location.latitude != "number" ||
        typeof location.longitude != "number"
      ) {
      if (!location) {
        continue;
      }
      let [itemLat, itemLong] = [location.latitude, location.longitude].map(
        toRadians
      );

      let locationLat = parseFloat(location.latitude);
      let locationLong = parseFloat(location.longitude);
      if (isNaN(locationLat) || isNaN(locationLong)) {
        continue;
      }

      let [itemLat, itemLong] = [locationLat, locationLong].map(toRadians);
      let d =
        EARTH_RADIUS_KM *
        Math.acos(
@@ -244,7 +248,7 @@ class _GeolocationUtils {
    let bestRegionTuple;
    for (let item of items) {
      let location = locationFromItem(item);
      if (location.country?.toLowerCase() == geoCountry) {
      if (location?.country?.toLowerCase() == geoCountry) {
        if (
          !bestCountryTuple ||
          hasLargerPopulation(location, bestCountryTuple.location)
+19 −4
Original line number Diff line number Diff line
@@ -197,7 +197,15 @@ export class WeatherSuggestions extends SuggestProvider {
    if (suggestions.length <= 1) {
      return suggestions;
    }
    let suggestion = await lazy.GeolocationUtils.best(suggestions);

    let suggestion = await lazy.GeolocationUtils.best(suggestions, s => ({
      latitude: s.city?.latitude,
      longitude: s.city?.longitude,
      country: s.city?.countryCode,
      region: s.city?.adminDivisionCodes.get(1),
      population: s.city?.population,
    }));

    return [suggestion];
  }

@@ -215,9 +223,16 @@ export class WeatherSuggestions extends SuggestProvider {
    // Set up location params to pass to Merino. We need to null-check each
    // suggestion property because `MerinoClient` will stringify null values.
    let otherParams = {};
    for (let key of ["city", "region", "country"]) {
      if (suggestion[key]) {
        otherParams[key] = suggestion[key];
    if (suggestion.city) {
      if (suggestion.city.name) {
        otherParams.city = suggestion.city.name;
      }
      if (suggestion.city.countryCode) {
        otherParams.country = suggestion.city.countryCode;
      }
      let admin1Code = suggestion.city.adminDivisionCodes.get(1);
      if (admin1Code) {
        otherParams.region = admin1Code;
      }
    }

Loading