mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1801295
(part 2) - vendor new application-services with the fix. r=skhamis
Depends on D164781 Differential Revision: https://phabricator.services.mozilla.com/D164782
This commit is contained in:
parent
efb859df84
commit
8fd66feff0
@ -50,7 +50,7 @@ rev = "fb7a2b12ced3b43e6a268621989c6191d1ed7e39"
|
||||
[source."https://github.com/mozilla/application-services"]
|
||||
git = "https://github.com/mozilla/application-services"
|
||||
replace-with = "vendored-sources"
|
||||
rev = "ba67a665dd086b1ea5f1fad638843e82bf9208b4"
|
||||
rev = "51b984ecb21ba00694c3eee33364123a064a7cbb"
|
||||
|
||||
[source."https://github.com/mozilla-spidermonkey/jsparagus"]
|
||||
git = "https://github.com/mozilla-spidermonkey/jsparagus"
|
||||
|
18
Cargo.lock
generated
18
Cargo.lock
generated
@ -1571,7 +1571,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "error-support"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=ba67a665dd086b1ea5f1fad638843e82bf9208b4#ba67a665dd086b1ea5f1fad638843e82bf9208b4"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=51b984ecb21ba00694c3eee33364123a064a7cbb#51b984ecb21ba00694c3eee33364123a064a7cbb"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"log",
|
||||
@ -2710,7 +2710,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "interrupt-support"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=ba67a665dd086b1ea5f1fad638843e82bf9208b4#ba67a665dd086b1ea5f1fad638843e82bf9208b4"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=51b984ecb21ba00694c3eee33364123a064a7cbb#51b984ecb21ba00694c3eee33364123a064a7cbb"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"parking_lot 0.12.999",
|
||||
@ -3823,7 +3823,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "nss_build_common"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=ba67a665dd086b1ea5f1fad638843e82bf9208b4#ba67a665dd086b1ea5f1fad638843e82bf9208b4"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=51b984ecb21ba00694c3eee33364123a064a7cbb#51b984ecb21ba00694c3eee33364123a064a7cbb"
|
||||
|
||||
[[package]]
|
||||
name = "nsstring"
|
||||
@ -5039,7 +5039,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "sql-support"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=ba67a665dd086b1ea5f1fad638843e82bf9208b4#ba67a665dd086b1ea5f1fad638843e82bf9208b4"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=51b984ecb21ba00694c3eee33364123a064a7cbb#51b984ecb21ba00694c3eee33364123a064a7cbb"
|
||||
dependencies = [
|
||||
"ffi-support",
|
||||
"interrupt-support",
|
||||
@ -5221,7 +5221,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "sync-guid"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=ba67a665dd086b1ea5f1fad638843e82bf9208b4#ba67a665dd086b1ea5f1fad638843e82bf9208b4"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=51b984ecb21ba00694c3eee33364123a064a7cbb#51b984ecb21ba00694c3eee33364123a064a7cbb"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"rand 0.8.5",
|
||||
@ -5232,7 +5232,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "sync15"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=ba67a665dd086b1ea5f1fad638843e82bf9208b4#ba67a665dd086b1ea5f1fad638843e82bf9208b4"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=51b984ecb21ba00694c3eee33364123a064a7cbb#51b984ecb21ba00694c3eee33364123a064a7cbb"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"error-support",
|
||||
@ -5262,7 +5262,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tabs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=ba67a665dd086b1ea5f1fad638843e82bf9208b4#ba67a665dd086b1ea5f1fad638843e82bf9208b4"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=51b984ecb21ba00694c3eee33364123a064a7cbb#51b984ecb21ba00694c3eee33364123a064a7cbb"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"error-support",
|
||||
@ -6007,7 +6007,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
[[package]]
|
||||
name = "viaduct"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=ba67a665dd086b1ea5f1fad638843e82bf9208b4#ba67a665dd086b1ea5f1fad638843e82bf9208b4"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=51b984ecb21ba00694c3eee33364123a064a7cbb#51b984ecb21ba00694c3eee33364123a064a7cbb"
|
||||
dependencies = [
|
||||
"ffi-support",
|
||||
"log",
|
||||
@ -6164,7 +6164,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "webext-storage"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=ba67a665dd086b1ea5f1fad638843e82bf9208b4#ba67a665dd086b1ea5f1fad638843e82bf9208b4"
|
||||
source = "git+https://github.com/mozilla/application-services?rev=51b984ecb21ba00694c3eee33364123a064a7cbb#51b984ecb21ba00694c3eee33364123a064a7cbb"
|
||||
dependencies = [
|
||||
"error-support",
|
||||
"ffi-support",
|
||||
|
12
Cargo.toml
12
Cargo.toml
@ -164,12 +164,12 @@ midir = { git = "https://github.com/mozilla/midir.git", rev = "519e651241e867af3
|
||||
minidump_writer_linux = { git = "https://github.com/rust-minidump/minidump-writer.git", rev = "75ada456c92a429704691a85e1cb42fef8cafc0d" }
|
||||
|
||||
# application-services overrides to make updating them all simpler.
|
||||
interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "ba67a665dd086b1ea5f1fad638843e82bf9208b4" }
|
||||
sql-support = { git = "https://github.com/mozilla/application-services", rev = "ba67a665dd086b1ea5f1fad638843e82bf9208b4" }
|
||||
sync15 = { git = "https://github.com/mozilla/application-services", rev = "ba67a665dd086b1ea5f1fad638843e82bf9208b4" }
|
||||
tabs = { git = "https://github.com/mozilla/application-services", rev = "ba67a665dd086b1ea5f1fad638843e82bf9208b4" }
|
||||
viaduct = { git = "https://github.com/mozilla/application-services", rev = "ba67a665dd086b1ea5f1fad638843e82bf9208b4" }
|
||||
webext-storage = { git = "https://github.com/mozilla/application-services", rev = "ba67a665dd086b1ea5f1fad638843e82bf9208b4" }
|
||||
interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "51b984ecb21ba00694c3eee33364123a064a7cbb" }
|
||||
sql-support = { git = "https://github.com/mozilla/application-services", rev = "51b984ecb21ba00694c3eee33364123a064a7cbb" }
|
||||
sync15 = { git = "https://github.com/mozilla/application-services", rev = "51b984ecb21ba00694c3eee33364123a064a7cbb" }
|
||||
tabs = { git = "https://github.com/mozilla/application-services", rev = "51b984ecb21ba00694c3eee33364123a064a7cbb" }
|
||||
viaduct = { git = "https://github.com/mozilla/application-services", rev = "51b984ecb21ba00694c3eee33364123a064a7cbb" }
|
||||
webext-storage = { git = "https://github.com/mozilla/application-services", rev = "51b984ecb21ba00694c3eee33364123a064a7cbb" }
|
||||
|
||||
# Patch mio 0.6 to use winapi 0.3 and miow 0.3, getting rid of winapi 0.2.
|
||||
# There is not going to be new version of mio 0.6, mio now being >= 0.7.11.
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"581bb074971ef67adecd37f82da27105fbcf7bb4bd289eaf6e284a51835ce193","src/lib.rs":"1cc8b6952a2b2d730f2a4def8c72b07517b31744814c62be9cae6bed8d340ec0"},"package":null}
|
||||
{"files":{"Cargo.toml":"581bb074971ef67adecd37f82da27105fbcf7bb4bd289eaf6e284a51835ce193","src/lib.rs":"16da98eba3da05784442815d1ead70bbe0cce8440913ee367e72711ee4874d60"},"package":null}
|
3
third_party/rust/nss_build_common/src/lib.rs
vendored
3
third_party/rust/nss_build_common/src/lib.rs
vendored
@ -114,12 +114,13 @@ fn get_nss_libs(kind: LinkingKind) -> Vec<&'static str> {
|
||||
// Hardware specific libs.
|
||||
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
|
||||
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
|
||||
// https://searchfox.org/nss/rev/08c4d05078d00089f8d7540651b0717a9d66f87e/lib/freebl/freebl.gyp#278-296
|
||||
// https://searchfox.org/nss/rev/0d5696b3edce5124353f03159d2aa15549db8306/lib/freebl/freebl.gyp#508-542
|
||||
if target_arch == "arm" || target_arch == "aarch64" {
|
||||
static_libs.push("armv8_c_lib");
|
||||
}
|
||||
if target_arch == "x86_64" || target_arch == "x86" {
|
||||
static_libs.push("gcm-aes-x86_c_lib");
|
||||
static_libs.push("sha-x86_c_lib");
|
||||
}
|
||||
if target_arch == "arm" {
|
||||
static_libs.push("gcm-aes-arm32-neon_c_lib")
|
||||
|
2
third_party/rust/tabs/.cargo-checksum.json
vendored
2
third_party/rust/tabs/.cargo-checksum.json
vendored
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"c8183d47c99830e628827da4c1510a4dd939071f85fc7ca85c9419ae2521ba41","README.md":"c48b8f391ef822c4f3971b5f453a1e7b43bea232752d520460d2f04803aead1a","build.rs":"024918c1d468c8dae03e4edaad14d827b7ebe7995809a8fe99efb1d9faa1206a","src/error.rs":"ac3d450f0ba6a855c37fa2dd829004b22dce5ad4416ebec66a3d7d6212bdbcd7","src/lib.rs":"d7eff9e1c28f88a48bfffa5acc0e8da12336c0c6ad55f5df211da4720927cce7","src/schema.rs":"19941d1291500c20eff467caa57fa845d4902b349d80508edc5d453725d1d870","src/storage.rs":"5299a5424a65f513300d28d62e242fb8f662c3c610b221d21497926551585226","src/store.rs":"ab0b6214b30b0f0fa7c6a89098ff3db1a8f76264f6711c4481c0be460afe522b","src/sync/bridge.rs":"6e843315842ad31a08c2760f7b993c93295deada755ae9fab1123b04659ad1d8","src/sync/engine.rs":"7d23cc163669ba2aa7242f42a0254fc67008803495a2aefc39de859d34596e10","src/sync/full_sync.rs":"412d24231f7a0c9a796c2afe482bc520d435f980bcba2841628c1147f6cbf479","src/sync/mod.rs":"8f0544ea54ad3f6daaf2650242d009229e09643ac9396e55ba111f2635cad232","src/sync/record.rs":"353b8e62f4f1a85edd8d693102d288ba59978e702e2c18a9c7415d731342b4d9","src/tabs.udl":"a555fe11b5fa7ea9aefa7d7be31906a63b31cbc16b9b7f5ad952fd0e08ba5c61","uniffi.toml":"5156701368f0b5856e658143714a43058385c8ac53bee72d7a5a332b576dfb82"},"package":null}
|
||||
{"files":{"Cargo.toml":"c8183d47c99830e628827da4c1510a4dd939071f85fc7ca85c9419ae2521ba41","README.md":"c48b8f391ef822c4f3971b5f453a1e7b43bea232752d520460d2f04803aead1a","build.rs":"024918c1d468c8dae03e4edaad14d827b7ebe7995809a8fe99efb1d9faa1206a","src/error.rs":"ac3d450f0ba6a855c37fa2dd829004b22dce5ad4416ebec66a3d7d6212bdbcd7","src/lib.rs":"d7eff9e1c28f88a48bfffa5acc0e8da12336c0c6ad55f5df211da4720927cce7","src/schema.rs":"19941d1291500c20eff467caa57fa845d4902b349d80508edc5d453725d1d870","src/storage.rs":"ea815cd3b3c729ab54343571138a739ad408f506920902f3d67495f1a8896ef5","src/store.rs":"ab0b6214b30b0f0fa7c6a89098ff3db1a8f76264f6711c4481c0be460afe522b","src/sync/bridge.rs":"6e843315842ad31a08c2760f7b993c93295deada755ae9fab1123b04659ad1d8","src/sync/engine.rs":"928a827081c47c091b3d70046fe85188f02a148316d3058347814e3166afa959","src/sync/full_sync.rs":"412d24231f7a0c9a796c2afe482bc520d435f980bcba2841628c1147f6cbf479","src/sync/mod.rs":"8f0544ea54ad3f6daaf2650242d009229e09643ac9396e55ba111f2635cad232","src/sync/record.rs":"353b8e62f4f1a85edd8d693102d288ba59978e702e2c18a9c7415d731342b4d9","src/tabs.udl":"a555fe11b5fa7ea9aefa7d7be31906a63b31cbc16b9b7f5ad952fd0e08ba5c61","uniffi.toml":"5156701368f0b5856e658143714a43058385c8ac53bee72d7a5a332b576dfb82"},"package":null}
|
47
third_party/rust/tabs/src/storage.rs
vendored
47
third_party/rust/tabs/src/storage.rs
vendored
@ -36,6 +36,8 @@ pub struct ClientRemoteTabs {
|
||||
skip_serializing_if = "devicetype_is_unknown"
|
||||
)]
|
||||
pub device_type: DeviceType,
|
||||
// serde default so we can read old rows that didn't persist this.
|
||||
#[serde(default)]
|
||||
pub last_modified: i64,
|
||||
pub remote_tabs: Vec<RemoteTab>,
|
||||
}
|
||||
@ -335,4 +337,49 @@ mod tests {
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_old_client_remote_tabs_version() {
|
||||
env_logger::try_init().ok();
|
||||
// The initial version of ClientRemoteTabs which we persisted looks like:
|
||||
let old = serde_json::json!({
|
||||
"client_id": "id",
|
||||
"client_name": "name",
|
||||
"remote_tabs": [
|
||||
serde_json::json!({
|
||||
"title": "tab title",
|
||||
"url_history": ["url"],
|
||||
"last_used": 1234,
|
||||
}),
|
||||
]
|
||||
});
|
||||
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let db_name = dir.path().join("test_old_client_remote_tabs_version.db");
|
||||
let mut storage = TabsStorage::new(db_name);
|
||||
|
||||
let connection = storage.open_or_create().expect("should create");
|
||||
connection
|
||||
.execute_cached(
|
||||
"INSERT INTO tabs (payload) VALUES (:payload);",
|
||||
rusqlite::named_params! {
|
||||
":payload": serde_json::to_string(&old).expect("tabs don't fail to serialize"),
|
||||
},
|
||||
)
|
||||
.expect("should insert");
|
||||
|
||||
// We should be able to read it out.
|
||||
let clients = storage.get_remote_tabs().expect("should work");
|
||||
assert_eq!(clients.len(), 1, "must be 1 tab");
|
||||
let client = &clients[0];
|
||||
assert_eq!(client.client_id, "id");
|
||||
assert_eq!(client.client_name, "name");
|
||||
assert_eq!(client.remote_tabs.len(), 1);
|
||||
assert_eq!(client.remote_tabs[0].title, "tab title");
|
||||
assert_eq!(client.remote_tabs[0].url_history, vec!["url".to_string()]);
|
||||
assert_eq!(client.remote_tabs[0].last_used, 1234);
|
||||
|
||||
// The old version didn't have last_modified - check it is the default.
|
||||
assert_eq!(client.last_modified, 0);
|
||||
}
|
||||
}
|
||||
|
64
third_party/rust/tabs/src/sync/engine.rs
vendored
64
third_party/rust/tabs/src/sync/engine.rs
vendored
@ -184,7 +184,11 @@ impl TabsSyncImpl {
|
||||
// We want to keep the mutex for as short as possible
|
||||
let local_tabs = {
|
||||
let mut storage = self.store.storage.lock().unwrap();
|
||||
storage.replace_remote_tabs(remote_tabs)?;
|
||||
// In desktop we might end up here with zero records when doing a quick-write, in
|
||||
// which case we don't want to wipe the DB.
|
||||
if !remote_tabs.is_empty() {
|
||||
storage.replace_remote_tabs(remote_tabs)?;
|
||||
}
|
||||
storage.prepare_local_tabs_for_upload()
|
||||
};
|
||||
let outgoing = if let Some(local_tabs) = local_tabs {
|
||||
@ -428,6 +432,64 @@ pub mod test {
|
||||
assert_eq!(crt.remote_tabs.len(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_no_incoming_doesnt_write() {
|
||||
env_logger::try_init().ok();
|
||||
|
||||
let engine = TabsEngine::new(Arc::new(TabsStore::new_with_mem_path(
|
||||
"test_no_incoming_doesnt_write",
|
||||
)));
|
||||
|
||||
let records = vec![json!({
|
||||
"id": "device-with-a-tab",
|
||||
"clientName": "device with a tab",
|
||||
"tabs": [{
|
||||
"title": "the title",
|
||||
"urlHistory": [
|
||||
"https://mozilla.org/"
|
||||
],
|
||||
"icon": "https://mozilla.org/icon",
|
||||
"lastUsed": 1643764207
|
||||
}]
|
||||
})];
|
||||
|
||||
let incoming = IncomingChangeset::new_with_changes(
|
||||
engine.collection_name(),
|
||||
ServerTimestamp(0),
|
||||
records
|
||||
.into_iter()
|
||||
.map(IncomingBso::from_test_content)
|
||||
.collect(),
|
||||
);
|
||||
engine
|
||||
.apply_incoming(vec![incoming], &mut telemetry::Engine::new("tabs"))
|
||||
.expect("Should apply incoming and stage outgoing records");
|
||||
|
||||
// now check the store has what we think it has.
|
||||
{
|
||||
let sync_impl = engine.sync_impl.lock().unwrap();
|
||||
let mut storage = sync_impl.store.storage.lock().unwrap();
|
||||
assert_eq!(storage.get_remote_tabs().expect("should work").len(), 1);
|
||||
}
|
||||
|
||||
// Now another sync with zero incoming records, should still be able to get back
|
||||
// our one client.
|
||||
let incoming = IncomingChangeset::new_with_changes(
|
||||
engine.collection_name(),
|
||||
ServerTimestamp(0),
|
||||
vec![],
|
||||
);
|
||||
engine
|
||||
.apply_incoming(vec![incoming], &mut telemetry::Engine::new("tabs"))
|
||||
.expect("Should succeed applying zero records");
|
||||
|
||||
{
|
||||
let sync_impl = engine.sync_impl.lock().unwrap();
|
||||
let mut storage = sync_impl.store.storage.lock().unwrap();
|
||||
assert_eq!(storage.get_remote_tabs().expect("should work").len(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sync_manager_registration() {
|
||||
let store = Arc::new(TabsStore::new_with_mem_path("test-registration"));
|
||||
|
Loading…
Reference in New Issue
Block a user