Bug 1527452 - Fix bookmark mirror tests to prepare for Rust merging. r=markh

Differential Revision: https://phabricator.services.mozilla.com/D19575

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Lina Cambridge 2019-02-24 06:56:26 +00:00
Родитель 988dc49bcc
Коммит a206caef5a
13 изменённых файлов: 471 добавлений и 24 удалений

Просмотреть файл

@ -965,7 +965,8 @@ class SyncedBookmarksMirror {
WHERE s.guid <> :rootGuid
GROUP BY s.parentGuid
HAVING (sum(DISTINCT position + 1) -
(count(*) * (count(*) + 1) / 2)) <> 0`,
(count(*) * (count(*) + 1) / 2)) <> 0
ORDER BY guid`,
{ rootGuid: PlacesUtils.bookmarks.rootGuid });
for await (let row of yieldingIterator(orphanRows)) {

Просмотреть файл

@ -25,19 +25,23 @@ add_task(async function test_corrupt_local_roots() {
info("Make remote changes");
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA"],
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
}, {
id: "toolbar",
parentid: "places",
type: "folder",
children: ["bookmarkBBBB"],
}, {
id: "bookmarkBBBB",
parentid: "toolbar",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
@ -130,19 +134,23 @@ add_task(async function test_corrupt_remote_roots() {
info("Make remote changes: Menu > Unfiled");
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["unfiled", "bookmarkAAAA"],
}, {
id: "unfiled",
parentid: "menu",
type: "folder",
children: ["bookmarkBBBB"],
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
}, {
id: "bookmarkBBBB",
parentid: "unfiled",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
@ -264,11 +272,13 @@ add_task(async function test_missing_children() {
{
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkBBBB", "bookmarkCCCC", "bookmarkDDDD",
"bookmarkEEEE"],
}, {
id: "bookmarkCCCC",
parentid: "menu",
type: "bookmark",
bmkUri: "http://example.com/c",
title: "C",
@ -299,17 +309,20 @@ add_task(async function test_missing_children() {
missingParents: [],
parentsWithGaps: [],
}, "Should report (B D E) as missing");
await storeChangesInMirror(buf, changesToUpload);
}
info("Add (B E) to remote");
{
await storeRecords(buf, shuffle([{
id: "bookmarkBBBB",
parentid: "menu",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
}, {
id: "bookmarkEEEE",
parentid: "menu",
type: "bookmark",
title: "E",
bmkUri: "http://example.com/e",
@ -358,6 +371,7 @@ add_task(async function test_missing_children() {
{
await storeRecords(buf, [{
id: "bookmarkDDDD",
parentid: "menu",
type: "bookmark",
title: "D",
bmkUri: "http://example.com/d",
@ -425,16 +439,19 @@ add_task(async function test_new_orphan_without_local_parent() {
info("Make remote changes: [A] > (B C D)");
await storeRecords(buf, shuffle([{
id: "bookmarkBBBB",
parentid: "folderAAAAAA",
type: "bookmark",
title: "B (remote)",
bmkUri: "http://example.com/b-remote",
}, {
id: "bookmarkCCCC",
parentid: "folderAAAAAA",
type: "bookmark",
title: "C (remote)",
bmkUri: "http://example.com/c-remote",
}, {
id: "bookmarkDDDD",
parentid: "folderAAAAAA",
type: "bookmark",
title: "D (remote)",
bmkUri: "http://example.com/d-remote",
@ -482,6 +499,7 @@ add_task(async function test_new_orphan_without_local_parent() {
info("Add [E] > A to remote");
await storeRecords(buf, [{
id: "folderAAAAAA",
parentid: "folderEEEEEE",
type: "folder",
title: "A",
children: ["bookmarkDDDD", "bookmarkCCCC", "bookmarkBBBB"],
@ -533,6 +551,7 @@ add_task(async function test_new_orphan_without_local_parent() {
info("Add E to remote");
await storeRecords(buf, [{
id: "folderEEEEEE",
parentid: "menu",
type: "folder",
title: "E",
children: ["folderAAAAAA"],
@ -591,6 +610,7 @@ add_task(async function test_new_orphan_without_local_parent() {
info("Add Menu > E to remote");
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderEEEEEE"],
}]);
@ -604,6 +624,7 @@ add_task(async function test_new_orphan_without_local_parent() {
updated: [],
deleted: [],
}, "Should not reupload after forming complete tree");
await storeChangesInMirror(buf, changesToUpload);
}
await assertLocalTree(PlacesUtils.bookmarks.rootGuid, {
@ -706,35 +727,42 @@ add_task(async function test_move_into_orphaned() {
});
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "bookmarkBBBB", "folderCCCCCC"],
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
}, {
id: "bookmarkBBBB",
parentid: "menu",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
}, {
id: "folderCCCCCC",
parentid: "menu",
type: "folder",
title: "C",
children: ["bookmarkDDDD", "folderEEEEEE"],
}, {
id: "bookmarkDDDD",
parentid: "folderCCCCCC",
type: "bookmark",
title: "D",
bmkUri: "http://example.com/d",
}, {
id: "folderEEEEEE",
parentid: "folderCCCCCC",
type: "folder",
title: "E",
children: ["bookmarkFFFF"],
}, {
id: "bookmarkFFFF",
parentid: "folderEEEEEE",
type: "bookmark",
title: "F",
bmkUri: "http://example.com/f",
@ -754,16 +782,19 @@ add_task(async function test_move_into_orphaned() {
info("Make remote changes: ([G] > A (C > (D H E))), (C > H)");
await storeRecords(buf, shuffle([{
id: "bookmarkAAAA",
parentid: "folderGGGGGG",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
}, {
id: "folderCCCCCC",
parentid: "folderGGGGGG",
type: "folder",
title: "C",
children: ["bookmarkDDDD", "bookmarkHHHH", "folderEEEEEE"],
}, {
id: "bookmarkHHHH",
parentid: "folderCCCCCC",
type: "bookmark",
title: "H (remote)",
bmkUri: "http://example.com/h-remote",
@ -883,20 +914,24 @@ add_task(async function test_new_orphan_with_local_parent() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderAAAAAA"],
}, {
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
title: "A",
children: ["bookmarkBBBB", "bookmarkEEEE"],
}, {
id: "bookmarkBBBB",
parentid: "folderAAAAAA",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
}, {
id: "bookmarkEEEE",
parentid: "folderAAAAAA",
type: "bookmark",
title: "E",
bmkUri: "http://example.com/e",
@ -909,11 +944,13 @@ add_task(async function test_new_orphan_with_local_parent() {
info("Set up remote with orphans: [A] > (C D)");
await storeRecords(buf, [{
id: "bookmarkDDDD",
parentid: "folderAAAAAA",
type: "bookmark",
title: "D (remote)",
bmkUri: "http://example.com/d-remote",
}, {
id: "bookmarkCCCC",
parentid: "folderAAAAAA",
type: "bookmark",
title: "C (remote)",
bmkUri: "http://example.com/c-remote",
@ -994,6 +1031,7 @@ add_task(async function test_new_orphan_with_local_parent() {
info("Add A to remote");
await storeRecords(buf, [{
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
title: "A",
children: ["bookmarkCCCC", "bookmarkDDDD", "bookmarkEEEE", "bookmarkBBBB"],
@ -1008,6 +1046,7 @@ add_task(async function test_new_orphan_with_local_parent() {
updated: [],
deleted: [],
}, "Should not reupload orphan A");
await storeChangesInMirror(buf, changesToUpload);
}
await assertLocalTree("folderAAAAAA", {
@ -1055,20 +1094,24 @@ add_task(async function test_tombstone_as_child() {
// as a child.
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderAAAAAA"],
}, {
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
title: "A",
children: ["bookmarkAAAA", "bookmarkTTTT", "bookmarkBBBB"],
}, {
id: "bookmarkAAAA",
parentid: "folderAAAAAA",
type: "bookmark",
title: "Bookmark A",
bmkUri: "http://example.com/a",
}, {
id: "bookmarkBBBB",
parentid: "folderAAAAAA",
type: "bookmark",
title: "Bookmark B",
bmkUri: "http://example.com/b",
@ -1210,6 +1253,7 @@ add_task(async function test_non_syncable_items() {
// locally. We should remove A and its descendants locally, since its parent
// H is known to be non-syncable remotely.
id: "folderAAAAAA",
parentid: "rootHHHHHHHH",
type: "folder",
title: "A",
children: ["bookmarkFFFF", "bookmarkIIII"],
@ -1217,11 +1261,13 @@ add_task(async function test_non_syncable_items() {
// F exists in two different non-syncable folders: C locally, and A
// remotely.
id: "bookmarkFFFF",
parentid: "folderAAAAAA",
type: "bookmark",
title: "F",
bmkUri: "http://example.com/f",
}, {
id: "bookmarkIIII",
parentid: "folderAAAAAA",
type: "query",
title: "I",
bmkUri: "http://example.com/i",
@ -1236,16 +1282,19 @@ add_task(async function test_non_syncable_items() {
children: ["folderLEFTPQ", "folderLEFTPF"],
}, {
id: "folderLEFTPQ",
parentid: "folderLEFTPR",
type: "query",
title: "Some query",
bmkUri: "place:folder=SOMETHING",
}, {
id: "folderLEFTPF",
parentid: "folderLEFTPR",
type: "folder",
title: "All Bookmarks",
children: ["folderLEFTPC"],
}, {
id: "folderLEFTPC",
parentid: "folderLEFTPF",
type: "query",
title: "A query under 'All Bookmarks'",
bmkUri: "place:folder=SOMETHING_ELSE",
@ -1254,20 +1303,24 @@ add_task(async function test_non_syncable_items() {
// J and G don't exist locally, and are syncable remotely, we'll remove D
// from the merged structure, and move J and G to unfiled.
id: "unfiled",
parentid: "places",
type: "folder",
children: ["folderDDDDDD", "bookmarkGGGG"],
}, {
id: "folderDDDDDD",
parentid: "unfiled",
type: "folder",
title: "D",
children: ["bookmarkJJJJ"],
}, {
id: "bookmarkJJJJ",
parentid: "folderDDDDDD",
type: "bookmark",
title: "J",
bmkUri: "http://example.com/j",
}, {
id: "bookmarkGGGG",
parentid: "unfiled",
type: "bookmark",
title: "G",
bmkUri: "http://example.com/g",
@ -1592,20 +1645,24 @@ add_task(async function test_partial_cycle() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderAAAAAA"],
}, {
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
title: "A",
children: ["folderBBBBBB"],
}, {
id: "folderBBBBBB",
parentid: "folderAAAAAA",
type: "folder",
title: "B",
children: ["bookmarkCCCC"],
}, {
id: "bookmarkCCCC",
parentid: "folderBBBBBB",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
@ -1618,11 +1675,13 @@ add_task(async function test_partial_cycle() {
info("Make remote changes: A > C");
await storeRecords(buf, [{
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
title: "A (remote)",
children: ["bookmarkCCCC"],
}, {
id: "folderBBBBBB",
parentid: "folderAAAAAA",
type: "folder",
title: "B (remote)",
children: ["folderAAAAAA"],
@ -1701,25 +1760,30 @@ add_task(async function test_complete_cycle() {
info("Make remote changes: Menu > A > B > C > A");
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderAAAAAA"],
}, {
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
title: "A",
children: ["folderBBBBBB"],
}, {
id: "folderBBBBBB",
parentid: "folderAAAAAA",
type: "folder",
title: "B",
children: ["folderCCCCCC"],
}, {
id: "folderCCCCCC",
parentid: "folderBBBBBB",
type: "folder",
title: "C",
children: ["folderDDDDDD"],
}, {
id: "folderDDDDDD",
parentid: "folderCCCCCC",
type: "folder",
title: "D",
children: ["folderAAAAAA"],
@ -1777,21 +1841,25 @@ add_task(async function test_invalid_guid() {
info("Make remote changes");
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "bad!guid~", "bookmarkBBBB"],
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
}, {
// Should be ignored.
id: "bad!guid~",
parentid: "menu",
type: "bookmark",
title: "Bad GUID",
bmkUri: "http://example.com/bad-guid",
}, {
id: "bookmarkBBBB",
parentid: "menu",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
@ -1867,20 +1935,24 @@ add_task(async function test_sync_status_mismatches() {
info("Make remote changes");
await storeRecords(buf, [{
id: "unfiled",
parentid: "places",
type: "folder",
children: ["bookmarkBBBB"],
}, {
id: "toolbar",
parentid: "places",
type: "folder",
children: ["bookmarkCCCC"],
}, {
id: "bookmarkBBBB",
parentid: "unfiled",
type: "bookmark",
bmkUri: "http://example.com/b",
title: "B",
}, {
// C is flagged as merged in the mirror, but doesn't exist in Places.
id: "bookmarkCCCC",
parentid: "toolbar",
type: "bookmark",
bmkUri: "http://example.com/c",
title: "C",

Просмотреть файл

@ -16,10 +16,12 @@ add_task(async function test_duping_local_newer() {
info("Start with empty local and mirror with merged items");
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAA5"],
}, {
id: "bookmarkAAA5",
parentid: "menu",
type: "bookmark",
bmkUri: "http://example.com/a",
title: "A",
@ -61,11 +63,13 @@ add_task(async function test_duping_local_newer() {
info("Add older remote dupes");
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "bookmarkAAA4", "bookmarkAAA5"],
modified: localModified / 1000 - 5,
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
bmkUri: "http://example.com/a",
title: "A",
@ -74,6 +78,7 @@ add_task(async function test_duping_local_newer() {
modified: localModified / 1000 - 5,
}, {
id: "bookmarkAAA4",
parentid: "menu",
type: "bookmark",
bmkUri: "http://example.com/a",
title: "A",
@ -220,15 +225,18 @@ add_task(async function test_duping_remote_newer() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderAAAAAA"],
}, {
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
title: "A",
children: ["bookmarkGGGG"],
}, {
id: "bookmarkGGGG",
parentid: "folderAAAAAA",
type: "bookmark",
title: "G",
bmkUri: "http://example.com/g",
@ -301,6 +309,7 @@ add_task(async function test_duping_remote_newer() {
info("Make remote changes");
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderAAAAAA", "folderB11111", "folderA11111",
"separatorE11", "queryD111111"],
@ -308,6 +317,7 @@ add_task(async function test_duping_remote_newer() {
modified: localModified / 1000 + 5,
}, {
id: "folderB11111",
parentid: "menu",
type: "folder",
title: "B",
children: ["bookmarkC222", "separatorF11"],
@ -315,6 +325,7 @@ add_task(async function test_duping_remote_newer() {
modified: localModified / 1000 + 5,
}, {
id: "bookmarkC222",
parentid: "folderB11111",
type: "bookmark",
bmkUri: "http://example.com/c",
title: "C",
@ -322,11 +333,13 @@ add_task(async function test_duping_remote_newer() {
modified: localModified / 1000 + 5,
}, {
id: "separatorF11",
parentid: "folderB11111",
type: "separator",
dateAdded: localModified.getTime(),
modified: localModified / 1000 + 5,
}, {
id: "folderA11111",
parentid: "menu",
type: "folder",
title: "A",
children: ["bookmarkG111"],
@ -334,6 +347,7 @@ add_task(async function test_duping_remote_newer() {
modified: localModified / 1000 + 5,
}, {
id: "bookmarkG111",
parentid: "folderA11111",
type: "bookmark",
bmkUri: "http://example.com/g",
title: "G",
@ -341,11 +355,13 @@ add_task(async function test_duping_remote_newer() {
modified: localModified / 1000 + 5,
}, {
id: "separatorE11",
parentid: "menu",
type: "separator",
dateAdded: localModified.getTime(),
modified: localModified / 1000 + 5,
}, {
id: "queryD111111",
parentid: "menu",
type: "query",
bmkUri: "place:maxResults=10&sort=8",
title: "Most Visited",
@ -544,10 +560,12 @@ add_task(async function test_duping_both() {
info("Add remote dupes");
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderAAAAAA", "folderDDDDDD", "folderFFFFFF"],
}, {
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
title: "A",
dateAdded: now - 10000,
@ -555,6 +573,7 @@ add_task(async function test_duping_both() {
children: ["bookmarkBBBB"],
}, {
id: "bookmarkBBBB",
parentid: "folderAAAAAA",
type: "bookmark",
bmkUri: "http://example.com/b",
title: "B",
@ -562,6 +581,7 @@ add_task(async function test_duping_both() {
modified: now / 1000 + 5,
}, {
id: "folderDDDDDD",
parentid: "menu",
type: "folder",
title: "D",
dateAdded: now - 10000,
@ -569,6 +589,7 @@ add_task(async function test_duping_both() {
children: ["bookmarkEEEE"],
}, {
id: "bookmarkEEEE",
parentid: "folderDDDDDD",
type: "bookmark",
bmkUri: "http://example.com/e",
title: "E",
@ -576,6 +597,7 @@ add_task(async function test_duping_both() {
modified: now / 1000 + 5,
}, {
id: "folderFFFFFF",
parentid: "menu",
type: "folder",
title: "F",
dateAdded: now - 10000,
@ -583,6 +605,7 @@ add_task(async function test_duping_both() {
children: ["bookmarkGGGG", "bookmarkHHHH"],
}, {
id: "bookmarkGGGG",
parentid: "folderFFFFFF",
type: "bookmark",
bmkUri: "http://example.com/g",
title: "G",
@ -590,6 +613,7 @@ add_task(async function test_duping_both() {
modified: now / 1000 - 5,
}, {
id: "bookmarkHHHH",
parentid: "folderFFFFFF",
type: "bookmark",
bmkUri: "http://example.com/h",
title: "H",
@ -737,14 +761,17 @@ add_task(async function test_applying_two_empty_folders_doesnt_smush() {
info("Make remote changes");
await storeRecords(buf, shuffle([{
id: "mobile",
parentid: "places",
type: "folder",
children: ["emptyempty01", "emptyempty02"],
}, {
id: "emptyempty01",
parentid: "mobile",
type: "folder",
title: "Empty",
}, {
id: "emptyempty02",
parentid: "mobile",
type: "folder",
title: "Empty",
}]));
@ -805,18 +832,22 @@ add_task(async function test_applying_two_empty_folders_matches_only_one() {
info("Make remote changes");
await storeRecords(buf, shuffle([{
id: "mobile",
parentid: "places",
type: "folder",
children: ["emptyempty01", "emptyempty02", "emptyempty03"],
}, {
id: "emptyempty01",
parentid: "mobile",
type: "folder",
title: "Empty",
}, {
id: "emptyempty02",
parentid: "mobile",
type: "folder",
title: "Empty",
}, {
id: "emptyempty03",
parentid: "mobile",
type: "folder",
title: "Empty",
}]));
@ -883,10 +914,12 @@ add_task(async function test_duping_mobile_bookmarks() {
info("Make remote changes");
await storeRecords(buf, shuffle([{
id: "mobile",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA"],
}, {
id: "bookmarkAAAA",
parentid: "mobile",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",

Просмотреть файл

@ -32,15 +32,18 @@ add_task(async function test_complex_orphaning() {
});
await storeRecords(buf, shuffle([{
id: "toolbar",
parentid: "places",
type: "folder",
children: ["folderAAAAAA"],
}, {
id: "folderAAAAAA",
parentid: "toolbar",
type: "folder",
title: "A",
children: ["folderBBBBBB"],
}, {
id: "folderBBBBBB",
parentid: "folderAAAAAA",
type: "folder",
title: "B",
}]), { needsMerge: false });
@ -64,20 +67,24 @@ add_task(async function test_complex_orphaning() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderGGGGGG"],
}, {
id: "folderGGGGGG",
parentid: "menu",
type: "folder",
title: "G",
children: ["folderCCCCCC"],
}, {
id: "folderCCCCCC",
parentid: "folderGGGGGG",
type: "folder",
title: "C",
children: ["folderDDDDDD"],
}, {
id: "folderDDDDDD",
parentid: "folderCCCCCC",
type: "folder",
title: "D",
}]), { needsMerge: false });
@ -98,14 +105,17 @@ add_task(async function test_complex_orphaning() {
deleted: true,
}, {
id: "folderAAAAAA",
parentid: "toolbar",
type: "folder",
title: "A",
}, {
id: "folderDDDDDD",
parentid: "folderCCCCCC",
type: "folder",
children: ["bookmarkFFFF"],
}, {
id: "bookmarkFFFF",
parentid: "folderDDDDDD",
type: "bookmark",
title: "F",
bmkUri: "http://example.com/f",
@ -239,30 +249,36 @@ add_task(async function test_locally_modified_remotely_deleted() {
});
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "folderBBBBBB"],
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
}, {
id: "folderBBBBBB",
parentid: "menu",
type: "folder",
title: "B",
children: ["bookmarkCCCC", "folderDDDDDD"],
}, {
id: "bookmarkCCCC",
parentid: "folderBBBBBB",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
}, {
id: "folderDDDDDD",
parentid: "folderBBBBBB",
type: "folder",
title: "D",
children: ["bookmarkEEEE"],
}, {
id: "bookmarkEEEE",
parentid: "folderDDDDDD",
type: "bookmark",
title: "E",
bmkUri: "http://example.com/e",
@ -291,6 +307,7 @@ add_task(async function test_locally_modified_remotely_deleted() {
info("Make remote changes: delete A, B");
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: [],
}, {
@ -398,30 +415,36 @@ add_task(async function test_locally_deleted_remotely_modified() {
});
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "folderBBBBBB"],
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
}, {
id: "folderBBBBBB",
parentid: "menu",
type: "folder",
title: "B",
children: ["bookmarkCCCC", "folderDDDDDD"],
}, {
id: "bookmarkCCCC",
parentid: "folderBBBBBB",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
}, {
id: "folderDDDDDD",
parentid: "folderBBBBBB",
type: "folder",
title: "D",
children: ["bookmarkEEEE"],
}, {
id: "bookmarkEEEE",
parentid: "folderDDDDDD",
type: "bookmark",
title: "E",
bmkUri: "http://example.com/e",
@ -435,26 +458,31 @@ add_task(async function test_locally_deleted_remotely_modified() {
info("Make remote changes: change A; B > ((D > F) G)");
await storeRecords(buf, [{
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A (remote)",
bmkUri: "http://example.com/a-remote",
}, {
id: "folderBBBBBB",
parentid: "menu",
type: "folder",
title: "B (remote)",
children: ["bookmarkCCCC", "folderDDDDDD", "bookmarkGGGG"],
}, {
id: "folderDDDDDD",
parentid: "folderBBBBBB",
type: "folder",
title: "D",
children: ["bookmarkEEEE", "bookmarkFFFF"],
}, {
id: "bookmarkFFFF",
parentid: "folderDDDDDD",
type: "bookmark",
title: "F (remote)",
bmkUri: "http://example.com/f-remote",
}, {
id: "bookmarkGGGG",
parentid: "folderBBBBBB",
type: "bookmark",
title: "G (remote)",
bmkUri: "http://example.com/g-remote",
@ -541,25 +569,30 @@ add_task(async function test_move_to_new_then_delete() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderAAAAAA"],
}, {
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
title: "A",
children: ["folderBBBBBB"],
}, {
id: "folderBBBBBB",
parentid: "folderAAAAAA",
type: "folder",
title: "B",
children: ["bookmarkCCCC", "bookmarkDDDD"],
}, {
id: "bookmarkCCCC",
parentid: "folderBBBBBB",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
}, {
id: "bookmarkDDDD",
parentid: "folderBBBBBB",
type: "bookmark",
title: "D",
bmkUri: "http://example.com/d",
@ -584,6 +617,7 @@ add_task(async function test_move_to_new_then_delete() {
info("Make remote changes");
await storeRecords(buf, [{
id: "bookmarkCCCC",
parentid: "folderBBBBBB",
type: "bookmark",
title: "C (remote)",
bmkUri: "http://example.com/c-remote",
@ -723,7 +757,7 @@ add_task(async function test_clear_folder_then_delete() {
title: "C",
}],
}, {
guid: "bookmarkDDDD",
guid: "folderDDDDDD",
type: PlacesUtils.bookmarks.TYPE_FOLDER,
title: "D",
children: [{
@ -739,35 +773,42 @@ add_task(async function test_clear_folder_then_delete() {
});
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderAAAAAA", "bookmarkDDDD"],
children: ["folderAAAAAA", "folderDDDDDD"],
}, {
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
title: "A",
children: ["bookmarkBBBB", "bookmarkCCCC"],
}, {
id: "bookmarkBBBB",
parentid: "folderAAAAAA",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
}, {
id: "bookmarkCCCC",
parentid: "folderAAAAAA",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
}, {
id: "bookmarkDDDD",
id: "folderDDDDDD",
parentid: "menu",
type: "folder",
title: "D",
children: ["bookmarkEEEE", "bookmarkFFFF"],
}, {
id: "bookmarkEEEE",
parentid: "folderDDDDDD",
type: "bookmark",
title: "E",
bmkUri: "http://example.com/e",
}, {
id: "bookmarkFFFF",
parentid: "folderDDDDDD",
type: "bookmark",
title: "F",
bmkUri: "http://example.com/f",
@ -785,17 +826,31 @@ add_task(async function test_clear_folder_then_delete() {
parentGuid: PlacesUtils.bookmarks.mobileGuid,
index: 0,
});
await PlacesUtils.bookmarks.remove("bookmarkDDDD");
await PlacesUtils.bookmarks.remove("folderDDDDDD");
info("Make remote changes: Menu > D, Unfiled > C, delete A");
info("Make remote changes: Menu > B, Unfiled > C, delete A");
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkBBBB", "bookmarkDDDD"],
children: ["bookmarkBBBB", "folderDDDDDD"],
}, {
id: "bookmarkBBBB",
parentid: "menu",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
}, {
id: "unfiled",
parentid: "places",
type: "folder",
children: ["bookmarkCCCC"],
}, {
id: "bookmarkCCCC",
parentid: "unfiled",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
}, {
id: "folderAAAAAA",
deleted: true,
@ -808,7 +863,7 @@ add_task(async function test_clear_folder_then_delete() {
let idsToUpload = inspectChangeRecords(changesToUpload);
deepEqual(idsToUpload, {
updated: ["bookmarkEEEE", "bookmarkFFFF", "menu", MobileBookmarksTitle],
deleted: ["bookmarkDDDD"],
deleted: ["folderDDDDDD"],
}, "Should upload locally moved and deleted items");
await assertLocalTree(PlacesUtils.bookmarks.rootGuid, {
@ -867,7 +922,7 @@ add_task(async function test_clear_folder_then_delete() {
}, "Should not orphan moved children of a deleted folder");
let tombstones = await PlacesTestUtils.fetchSyncTombstones();
deepEqual(tombstones.map(({ guid }) => guid), ["bookmarkDDDD"],
deepEqual(tombstones.map(({ guid }) => guid), ["folderDDDDDD"],
"Should store local tombstone for D");
await buf.finalize();
@ -903,25 +958,30 @@ add_task(async function test_newer_move_to_deleted() {
});
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderAAAAAA", "folderCCCCCC"],
}, {
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
title: "A",
children: ["bookmarkBBBB"],
}, {
id: "bookmarkBBBB",
parentid: "folderAAAAAA",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
}, {
id: "folderCCCCCC",
parentid: "menu",
type: "folder",
title: "C",
children: ["bookmarkDDDD"],
}, {
id: "bookmarkDDDD",
parentid: "folderCCCCCC",
type: "bookmark",
title: "D",
bmkUri: "http://example.com/d",
@ -955,21 +1015,36 @@ add_task(async function test_newer_move_to_deleted() {
// deleted the now-empty C locally).
info("Make remote changes: C > F, Toolbar > B, delete A");
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderCCCCCC"],
}, {
id: "folderCCCCCC",
parentid: "menu",
type: "folder",
title: "C",
children: ["bookmarkDDDD", "bookmarkFFFF"],
modified: (now / 1000) + 5,
}, {
id: "bookmarkFFFF",
parentid: "folderCCCCCC",
type: "bookmark",
title: "F",
bmkUri: "http://example.com/f",
}, {
id: "toolbar",
parentid: "places",
type: "folder",
children: ["bookmarkBBBB"],
modified: (now / 1000) - 5,
}, {
id: "bookmarkBBBB",
parentid: "toolbar",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
modified: (now / 1000) - 5,
}, {
id: "folderAAAAAA",
deleted: true,

Просмотреть файл

@ -15,10 +15,12 @@ add_task(async function test_explicit_weakupload() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["mozBmk______"],
}, {
id: "mozBmk______",
parentid: "menu",
type: "bookmark",
title: "Mozilla",
bmkUri: "https://mozilla.org",
@ -54,10 +56,12 @@ add_task(async function test_explicit_weakupload_with_dateAdded() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["mozBmk______"],
}, {
id: "mozBmk______",
parentid: "menu",
type: "bookmark",
title: "Mozilla",
bmkUri: "https://mozilla.org",
@ -68,6 +72,7 @@ add_task(async function test_explicit_weakupload_with_dateAdded() {
info("Make remote change with older date added");
await storeRecords(buf, [{
id: "mozBmk______",
parentid: "menu",
type: "bookmark",
title: "Firefox",
bmkUri: "http://getfirefox.com/",

Просмотреть файл

@ -15,22 +15,27 @@ add_task(async function test_no_changes() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["mozBmk______"],
}, {
id: "toolbar",
parentid: "places",
type: "folder",
children: [],
}, {
id: "unfiled",
parentid: "places",
type: "folder",
children: [],
}, {
id: "mobile",
parentid: "places",
type: "folder",
children: [],
}, {
id: "mozBmk______",
parentid: "menu",
type: "bookmark",
title: "Mozilla",
bmkUri: "https://mozilla.org",
@ -60,10 +65,12 @@ add_task(async function test_changes_remote() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["mozBmk______"],
}, {
id: "mozBmk______",
parentid: "menu",
type: "bookmark",
title: "Mozilla",
bmkUri: "https://mozilla.org",
@ -73,6 +80,7 @@ add_task(async function test_changes_remote() {
await storeRecords(buf, [{
id: "mozBmk______",
parentid: "menu",
type: "bookmark",
title: "New Mozilla",
bmkUri: "https://mozilla.org",
@ -101,10 +109,12 @@ add_task(async function test_changes_local() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["mozBmk______"],
}, {
id: "mozBmk______",
parentid: "menu",
type: "bookmark",
title: "Mozilla",
bmkUri: "https://mozilla.org",
@ -139,10 +149,12 @@ add_task(async function test_changes_deleted_bookmark() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["mozBmk______"],
}, {
id: "mozBmk______",
parentid: "menu",
type: "bookmark",
title: "Mozilla",
bmkUri: "https://mozilla.org",

Просмотреть файл

@ -52,11 +52,13 @@ add_task(async function test_queries() {
info("Make remote changes");
await storeRecords(buf, shuffle([{
id: "toolbar",
parentid: "places",
type: "folder",
children: ["queryEEEEEEE", "queryFFFFFFF", "queryGGGGGGG", "queryHHHHHHH"],
}, {
// Legacy tag query.
id: "queryEEEEEEE",
parentid: "toolbar",
type: "query",
title: "E",
bmkUri: "place:type=7&folder=999",
@ -64,6 +66,7 @@ add_task(async function test_queries() {
}, {
// New tag query.
id: "queryFFFFFFF",
parentid: "toolbar",
type: "query",
title: "F",
bmkUri: "place:tag=a-tag",
@ -71,6 +74,7 @@ add_task(async function test_queries() {
}, {
// Legacy tag query referencing the same tag as the new query.
id: "queryGGGGGGG",
parentid: "toolbar",
type: "query",
title: "G",
bmkUri: "place:type=7&folder=111&something=else",
@ -78,6 +82,7 @@ add_task(async function test_queries() {
}, {
// Legacy folder lookup query.
id: "queryHHHHHHH",
parentid: "toolbar",
type: "query",
title: "H",
bmkUri: "place:folder=1",
@ -133,7 +138,7 @@ add_task(async function test_mismatched_but_compatible_folder_types() {
info("Set up mirror");
await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.menuGuid,
guid: PlacesUtils.bookmarks.toolbarGuid,
children: [{
guid: "l1nZZXfB8nC7",
type: PlacesUtils.bookmarks.TYPE_FOLDER,
@ -144,6 +149,11 @@ add_task(async function test_mismatched_but_compatible_folder_types() {
info("Make remote changes");
await storeRecords(buf, [{
id: "toolbar",
parentid: "places",
type: "folder",
children: ["l1nZZXfB8nC7"],
}, {
"id": "l1nZZXfB8nC7",
"type": "livemark",
"siteUri": "http://sneglehode.wordpress.com/",
@ -164,7 +174,7 @@ add_task(async function test_mismatched_but_compatible_folder_types() {
let idsToUpload = inspectChangeRecords(changesToUpload);
deepEqual(idsToUpload, {
updated: ["menu", "unfiled"],
updated: ["toolbar"],
deleted: ["l1nZZXfB8nC7"],
}, "Legacy livemark should be deleted remotely");
@ -205,6 +215,7 @@ add_task(async function test_different_but_compatible_bookmark_types() {
// Now pretend that same records are already on the server.
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "bookmarkBBBB"],
}, {
@ -275,11 +286,12 @@ add_task(async function test_incompatible_types() {
// types.
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["AAAAAAAAAAAA"],
}, {
id: "AAAAAAAAAAAA",
parentId: PlacesSyncUtils.bookmarks.guidToRecordId(PlacesUtils.bookmarks.menuGuid),
parentid: "menu",
type: "folder",
title: "conflicting folder",
}], { needsMerge: true });

Просмотреть файл

@ -20,10 +20,12 @@ add_task(async function test_bookmark_change_during_sync() {
info("Make remote changes");
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA"],
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",

Просмотреть файл

@ -13,11 +13,13 @@ add_task(async function test_highWaterMark() {
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: [],
modified: 50,
}, {
id: "toolbar",
parentid: "places",
type: "folder",
children: [],
modified: 123.95,
@ -27,6 +29,7 @@ add_task(async function test_highWaterMark() {
await storeRecords(buf, [{
id: "unfiled",
parentid: "places",
type: "folder",
children: [],
modified: 125.45,
@ -47,11 +50,13 @@ add_task(async function test_ensureCurrentSyncId() {
info("Insert items and set collection last modified");
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderAAAAAA"],
modified: 125.45,
}, {
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
children: [],
}], { needsMerge: false });

Просмотреть файл

@ -31,7 +31,7 @@ function mapFilterIterator(iter, fn) {
add_task(async function test_update_frecencies() {
let buf = await openMirror("update_frecencies");
info("Make local changes");
info("Set up mirror");
await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.menuGuid,
children: [{
@ -51,7 +51,38 @@ add_task(async function test_update_frecencies() {
guid: "bookmarkBBB1",
title: "B1",
url: "http://example.com/b1",
}, {
}],
});
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "bookmarkBBBB", "bookmarkBBB1"],
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
}, {
id: "bookmarkBBBB",
parentid: "menu",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
}, {
id: "bookmarkBBB1",
parentid: "menu",
type: "bookmark",
title: "B1",
bmkUri: "http://example.com/b1",
}], { needsMerge: false });
await PlacesTestUtils.markBookmarksAsSynced();
info("Make local changes");
await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.menuGuid,
children: [{
// Query; shouldn't recalculate frecency.
guid: "queryCCCCCCC",
title: "C",
@ -69,37 +100,53 @@ add_task(async function test_update_frecencies() {
info("Make remote changes");
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "bookmarkBBBB", "bookmarkBBB1"],
}, {
id: "unfiled",
parentid: "places",
type: "folder",
children: ["bookmarkBBB2", "bookmarkDDDD", "bookmarkEEEE", "queryFFFFFFF"],
}, {
// Existing bookmark changed to existing URL.
id: "bookmarkBBBB",
parentid: "menu",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b1",
}, {
// Existing bookmark with new URL; should recalculate frecency first.
id: "bookmarkBBB1",
parentid: "menu",
type: "bookmark",
title: "B1",
bmkUri: "http://example.com/b11",
}, {
id: "bookmarkBBB2",
parentid: "unfiled",
type: "bookmark",
title: "B2",
bmkUri: "http://example.com/b",
}, {
// New bookmark with new URL; should recalculate frecency first.
id: "bookmarkDDDD",
parentid: "unfiled",
type: "bookmark",
title: "D",
bmkUri: "http://example.com/d",
}, {
// New bookmark with new URL.
id: "bookmarkEEEE",
parentid: "unfiled",
type: "bookmark",
title: "E",
bmkUri: "http://example.com/e",
}, {
// New query; shouldn't count against limit.
id: "queryFFFFFFF",
parentid: "unfiled",
type: "query",
title: "F",
bmkUri: `place:parent=${PlacesUtils.bookmarks.menuGuid}`,
@ -139,6 +186,7 @@ add_task(async function test_update_frecencies() {
info("Change non-URL property of D");
await storeRecords(buf, [{
id: "bookmarkDDDD",
parentid: "unfiled",
type: "bookmark",
title: "D (remote)",
bmkUri: "http://example.com/d",
@ -221,22 +269,26 @@ add_task(async function test_apply_then_revert() {
info("Make remote changes");
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkEEEE", "bookmarkFFFF"],
modified: now,
}, {
id: "toolbar",
parentid: "places",
type: "folder",
children: ["folderAAAAAA"],
modified: now,
}, {
id: "folderAAAAAA",
parentid: "toolbar",
type: "folder",
title: "A (remote)",
children: ["bookmarkCCCC", "bookmarkBBBB"],
modified: now,
}, {
id: "bookmarkBBBB",
parentid: "folderAAAAAA",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b-remote",
@ -247,12 +299,14 @@ add_task(async function test_apply_then_revert() {
modified: now,
}, {
id: "bookmarkEEEE",
parentid: "menu",
type: "bookmark",
title: "E",
bmkUri: "http://example.com/e",
modified: now,
}, {
id: "bookmarkFFFF",
parentid: "menu",
type: "bookmark",
title: "F",
bmkUri: "http://example.com/f",

Просмотреть файл

@ -33,35 +33,41 @@ add_task(async function test_value_structure_conflict() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderAAAAAA", "folderDDDDDD"],
modified: Date.now() / 1000 - 60,
}, {
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
title: "A",
children: ["bookmarkBBBB", "bookmarkCCCC"],
modified: Date.now() / 1000 - 60,
}, {
id: "bookmarkBBBB",
parentid: "folderAAAAAA",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
modified: Date.now() / 1000 - 60,
}, {
id: "bookmarkCCCC",
parentid: "folderAAAAAA",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
modified: Date.now() / 1000 - 60,
}, {
id: "folderDDDDDD",
parentid: "menu",
type: "folder",
title: "D",
children: ["bookmarkEEEE"],
modified: Date.now() / 1000 - 60,
}, {
id: "bookmarkEEEE",
parentid: "folderDDDDDD",
type: "bookmark",
title: "E",
bmkUri: "http://example.com/e",
@ -85,6 +91,7 @@ add_task(async function test_value_structure_conflict() {
info("Make remote value change");
await storeRecords(buf, [{
id: "folderDDDDDD",
parentid: "menu",
type: "folder",
title: "D (remote)",
children: ["bookmarkEEEE"],
@ -222,47 +229,56 @@ add_task(async function test_move() {
await storeRecords(buf, shuffle([{
id: "unfiled",
parentid: "places",
type: "folder",
children: ["mozFolder___"],
}, {
id: "toolbar",
parentid: "places",
type: "folder",
children: ["devFolder___"],
}, {
id: "devFolder___",
// Moving to toolbar.
id: "devFolder___",
parentid: "toolbar",
type: "folder",
title: "Dev",
children: ["bzBmk_______", "wmBmk_______"],
}, {
// Moving to "Mozilla".
id: "mdnBmk______",
parentid: "mozFolder___",
type: "bookmark",
title: "MDN",
bmkUri: "https://developer.mozilla.org",
}, {
// Rearranging children and moving to unfiled.
id: "mozFolder___",
parentid: "unfiled",
type: "folder",
title: "Mozilla",
children: ["nightlyBmk__", "mdnBmk______", "fxBmk_______"],
}, {
id: "fxBmk_______",
parentid: "mozFolder___",
type: "bookmark",
title: "Get Firefox!",
bmkUri: "http://getfirefox.com/",
}, {
id: "nightlyBmk__",
parentid: "mozFolder___",
type: "bookmark",
title: "Nightly",
bmkUri: "https://nightly.mozilla.org",
}, {
id: "wmBmk_______",
parentid: "devFolder___",
type: "bookmark",
title: "Webmaker",
bmkUri: "https://webmaker.org",
}, {
id: "bzBmk_______",
parentid: "devFolder___",
type: "bookmark",
title: "Bugzilla",
bmkUri: "https://bugzilla.mozilla.org",
@ -461,15 +477,18 @@ add_task(async function test_move_into_parent_sibling() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderAAAAAA"],
}, {
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
title: "A",
children: ["bookmarkBBBB"],
}, {
id: "bookmarkBBBB",
parentid: "folderAAAAAA",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
@ -479,17 +498,26 @@ add_task(async function test_move_into_parent_sibling() {
info("Make remote changes: Menu > (A (B > C))");
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderAAAAAA", "folderCCCCCC"],
}, {
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
title: "A",
}, {
id: "folderCCCCCC",
parentid: "menu",
type: "folder",
title: "C",
children: ["bookmarkBBBB"],
}, {
id: "bookmarkBBBB",
parentid: "folderCCCCCC",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
}]);
info("Apply remote");
@ -588,20 +616,24 @@ add_task(async function test_complex_move_with_additions() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderAAAAAA"],
}, {
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
title: "A",
children: ["bookmarkBBBB", "bookmarkCCCC"],
}, {
id: "bookmarkBBBB",
parentid: "folderAAAAAA",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
}, {
id: "bookmarkCCCC",
parentid: "folderAAAAAA",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
@ -619,24 +651,29 @@ add_task(async function test_complex_move_with_additions() {
info("Make remote change: ((Menu > C) (Toolbar > A > (B E)))");
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkCCCC"],
}, {
id: "toolbar",
parentid: "places",
type: "folder",
children: ["folderAAAAAA"],
}, {
id: "folderAAAAAA",
parentid: "toolbar",
type: "folder",
title: "A",
children: ["bookmarkBBBB", "bookmarkEEEE"],
}, {
id: "bookmarkCCCC",
parentid: "menu",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
}, {
id: "bookmarkEEEE",
parentid: "folderAAAAAA",
type: "bookmark",
title: "E",
bmkUri: "http://example.com/e",
@ -800,39 +837,47 @@ add_task(async function test_reorder_and_insert() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "bookmarkBBBB", "bookmarkCCCC"],
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
}, {
id: "bookmarkBBBB",
parentid: "menu",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
}, {
id: "bookmarkCCCC",
parentid: "menu",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
}, {
id: "toolbar",
parentid: "places",
type: "folder",
children: ["bookmarkDDDD", "bookmarkEEEE", "bookmarkFFFF"],
}, {
id: "bookmarkDDDD",
parentid: "toolbar",
type: "bookmark",
title: "D",
bmkUri: "http://example.com/d",
}, {
id: "bookmarkEEEE",
parentid: "toolbar",
type: "bookmark",
title: "E",
bmkUri: "http://example.com/e",
}, {
id: "bookmarkFFFF",
parentid: "toolbar",
type: "bookmark",
title: "F",
bmkUri: "http://example.com/f",
@ -866,6 +911,7 @@ add_task(async function test_reorder_and_insert() {
// The server has a newer toolbar, so we should use the remote order (F D E)
// as the base, then append (G H).
id: "toolbar",
parentid: "places",
type: "folder",
children: ["bookmarkFFFF", "bookmarkDDDD", "bookmarkEEEE"],
modified: now / 1000 + 5,
@ -873,17 +919,20 @@ add_task(async function test_reorder_and_insert() {
// The server has an older menu, so we should use the local order (C A B)
// as the base, then append (I J).
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "bookmarkBBBB", "bookmarkCCCC", "bookmarkIIII",
"bookmarkJJJJ"],
modified: now / 1000 - 5,
}, {
id: "bookmarkIIII",
parentid: "menu",
type: "bookmark",
title: "I",
bmkUri: "http://example.com/i",
}, {
id: "bookmarkJJJJ",
parentid: "menu",
type: "bookmark",
title: "J",
bmkUri: "http://example.com/j",
@ -1062,12 +1111,14 @@ add_task(async function test_newer_remote_moves() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "folderBBBBBB", "folderDDDDDD"],
dateAdded: now - 5000,
modified: now / 1000 - 5,
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
@ -1075,6 +1126,7 @@ add_task(async function test_newer_remote_moves() {
modified: now / 1000 - 5,
}, {
id: "folderBBBBBB",
parentid: "menu",
type: "folder",
title: "B",
children: ["bookmarkCCCC"],
@ -1082,6 +1134,7 @@ add_task(async function test_newer_remote_moves() {
modified: now / 1000 - 5,
}, {
id: "bookmarkCCCC",
parentid: "folderBBBBBB",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
@ -1089,18 +1142,21 @@ add_task(async function test_newer_remote_moves() {
modified: now / 1000 - 5,
}, {
id: "folderDDDDDD",
parentid: "menu",
type: "folder",
title: "D",
dateAdded: now - 5000,
modified: now / 1000 - 5,
}, {
id: "toolbar",
parentid: "places",
type: "folder",
children: ["bookmarkEEEE", "folderFFFFFF", "folderHHHHHH"],
dateAdded: now - 5000,
modified: now / 1000 - 5,
}, {
id: "bookmarkEEEE",
parentid: "toolbar",
type: "bookmark",
title: "E",
bmkUri: "http://example.com/e",
@ -1108,6 +1164,7 @@ add_task(async function test_newer_remote_moves() {
modified: now / 1000 - 5,
}, {
id: "folderFFFFFF",
parentid: "toolbar",
type: "folder",
title: "F",
children: ["bookmarkGGGG"],
@ -1115,6 +1172,7 @@ add_task(async function test_newer_remote_moves() {
modified: now / 1000 - 5,
}, {
id: "bookmarkGGGG",
parentid: "folderFFFFFF",
type: "bookmark",
title: "G",
bmkUri: "http://example.com/g",
@ -1122,6 +1180,7 @@ add_task(async function test_newer_remote_moves() {
modified: now / 1000 - 5,
}, {
id: "folderHHHHHH",
parentid: "toolbar",
type: "folder",
title: "H",
dateAdded: now - 5000,
@ -1158,12 +1217,14 @@ add_task(async function test_newer_remote_moves() {
info("Make remote changes: Mobile > A, Unfiled > B; Toolbar > (F E H); D > G; H > C");
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderDDDDDD"],
dateAdded: now - 5000,
modified: now / 1000,
}, {
id: "mobile",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA"],
dateAdded: now - 5000,
@ -1172,6 +1233,7 @@ add_task(async function test_newer_remote_moves() {
// This is similar to H > C, explained below, except we'll always reupload
// the mobile root, because we always prefer the local state for roots.
id: "bookmarkAAAA",
parentid: "mobile",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
@ -1179,12 +1241,14 @@ add_task(async function test_newer_remote_moves() {
modified: now / 1000,
}, {
id: "unfiled",
parentid: "places",
type: "folder",
children: ["folderBBBBBB"],
dateAdded: now - 5000,
modified: now / 1000,
}, {
id: "folderBBBBBB",
parentid: "unfiled",
type: "folder",
title: "B",
children: [],
@ -1192,12 +1256,14 @@ add_task(async function test_newer_remote_moves() {
modified: now / 1000,
}, {
id: "toolbar",
parentid: "places",
type: "folder",
children: ["folderFFFFFF", "bookmarkEEEE", "folderHHHHHH"],
dateAdded: now - 5000,
modified: now / 1000,
}, {
id: "folderHHHHHH",
parentid: "toolbar",
type: "folder",
title: "H",
children: ["bookmarkCCCC"],
@ -1210,6 +1276,7 @@ add_task(async function test_newer_remote_moves() {
// changed locally, we'll reupload it, even though it didn't actually
// change.
id: "bookmarkCCCC",
parentid: "folderHHHHHH",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
@ -1217,6 +1284,7 @@ add_task(async function test_newer_remote_moves() {
modified: now / 1000,
}, {
id: "folderDDDDDD",
parentid: "menu",
type: "folder",
title: "D",
children: ["bookmarkGGGG"],
@ -1225,6 +1293,7 @@ add_task(async function test_newer_remote_moves() {
}, {
// Same as C above.
id: "bookmarkGGGG",
parentid: "folderDDDDDD",
type: "bookmark",
title: "G",
bmkUri: "http://example.com/g",
@ -1479,12 +1548,14 @@ add_task(async function test_newer_local_moves() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "folderBBBBBB", "folderDDDDDD"],
dateAdded: now - 5000,
modified: now / 1000 - 5,
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
@ -1492,6 +1563,7 @@ add_task(async function test_newer_local_moves() {
modified: now / 1000 - 5,
}, {
id: "folderBBBBBB",
parentid: "menu",
type: "folder",
title: "B",
children: ["bookmarkCCCC"],
@ -1499,6 +1571,7 @@ add_task(async function test_newer_local_moves() {
modified: now / 1000 - 5,
}, {
id: "bookmarkCCCC",
parentid: "folderBBBBBB",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
@ -1506,18 +1579,21 @@ add_task(async function test_newer_local_moves() {
modified: now / 1000 - 5,
}, {
id: "folderDDDDDD",
parentid: "menu",
type: "folder",
title: "D",
dateAdded: now - 5000,
modified: now / 1000 - 5,
}, {
id: "toolbar",
parentid: "places",
type: "folder",
children: ["bookmarkEEEE", "folderFFFFFF", "folderHHHHHH"],
dateAdded: now - 5000,
modified: now / 1000 - 5,
}, {
id: "bookmarkEEEE",
parentid: "toolbar",
type: "bookmark",
title: "E",
bmkUri: "http://example.com/e",
@ -1525,6 +1601,7 @@ add_task(async function test_newer_local_moves() {
modified: now / 1000 - 5,
}, {
id: "folderFFFFFF",
parentid: "toolbar",
type: "folder",
title: "F",
children: ["bookmarkGGGG"],
@ -1532,6 +1609,7 @@ add_task(async function test_newer_local_moves() {
modified: now / 1000 - 5,
}, {
id: "bookmarkGGGG",
parentid: "folderFFFFFF",
type: "bookmark",
title: "G",
bmkUri: "http://example.com/g",
@ -1539,6 +1617,7 @@ add_task(async function test_newer_local_moves() {
modified: now / 1000 - 5,
}, {
id: "folderHHHHHH",
parentid: "toolbar",
type: "folder",
title: "H",
dateAdded: now - 5000,
@ -1575,18 +1654,21 @@ add_task(async function test_newer_local_moves() {
info("Make remote changes: Mobile > A, Unfiled > B; Toolbar > (F E H); D > G; H > C");
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderDDDDDD"],
dateAdded: now - 5000,
modified: now / 1000 - 2.5,
}, {
id: "mobile",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA"],
dateAdded: now - 5000,
modified: now / 1000 - 2.5,
}, {
id: "bookmarkAAAA",
parentid: "mobile",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
@ -1594,12 +1676,14 @@ add_task(async function test_newer_local_moves() {
modified: now / 1000 - 2.5,
}, {
id: "unfiled",
parentid: "places",
type: "folder",
children: ["folderBBBBBB"],
dateAdded: now - 5000,
modified: now / 1000 - 2.5,
}, {
id: "folderBBBBBB",
parentid: "unfiled",
type: "folder",
title: "B",
children: [],
@ -1607,12 +1691,14 @@ add_task(async function test_newer_local_moves() {
modified: now / 1000 - 2.5,
}, {
id: "toolbar",
parentid: "places",
type: "folder",
children: ["folderFFFFFF", "bookmarkEEEE", "folderHHHHHH"],
dateAdded: now - 5000,
modified: now / 1000 - 2.5,
}, {
id: "folderHHHHHH",
parentid: "toolbar",
type: "folder",
title: "H",
children: ["bookmarkCCCC"],
@ -1620,6 +1706,7 @@ add_task(async function test_newer_local_moves() {
modified: now / 1000 - 2.5,
}, {
id: "bookmarkCCCC",
parentid: "folderHHHHHH",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
@ -1627,6 +1714,7 @@ add_task(async function test_newer_local_moves() {
modified: now / 1000 - 2.5,
}, {
id: "folderDDDDDD",
parentid: "menu",
type: "folder",
title: "D",
children: ["bookmarkGGGG"],
@ -1634,6 +1722,7 @@ add_task(async function test_newer_local_moves() {
modified: now / 1000 - 2.5,
}, {
id: "bookmarkGGGG",
parentid: "folderDDDDDD",
type: "bookmark",
title: "G",
bmkUri: "http://example.com/g",
@ -1955,18 +2044,21 @@ add_task(async function test_unchanged_newer_changed_older() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderAAAAAA", "bookmarkBBBB"],
dateAdded: modified.getTime() - 5000,
modified: modified.getTime() / 1000,
}, {
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
title: "A",
dateAdded: modified.getTime() - 5000,
modified: modified.getTime() / 1000,
}, {
id: "bookmarkBBBB",
parentid: "menu",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
@ -1974,18 +2066,21 @@ add_task(async function test_unchanged_newer_changed_older() {
modified: modified.getTime() / 1000,
}, {
id: "toolbar",
parentid: "places",
type: "folder",
children: ["folderCCCCCC", "bookmarkDDDD"],
dateAdded: modified.getTime() - 5000,
modified: modified.getTime() / 1000,
}, {
id: "folderCCCCCC",
parentid: "toolbar",
type: "folder",
title: "C",
dateAdded: modified.getTime() - 5000,
modified: modified.getTime() / 1000,
}, {
id: "bookmarkDDDD",
parentid: "toolbar",
type: "bookmark",
title: "D",
bmkUri: "http://example.com/d",
@ -2009,6 +2104,7 @@ add_task(async function test_unchanged_newer_changed_older() {
});
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkBBBB"],
dateAdded: modified.getTime() - 5000,
@ -2023,6 +2119,7 @@ add_task(async function test_unchanged_newer_changed_older() {
info("Add C > F remotely with newer time; delete C locally with older time");
await storeRecords(buf, shuffle([{
id: "folderCCCCCC",
parentid: "toolbar",
type: "folder",
title: "C",
children: ["bookmarkFFFF"],
@ -2030,6 +2127,7 @@ add_task(async function test_unchanged_newer_changed_older() {
modified: modified.getTime() / 1000 + 5,
}, {
id: "bookmarkFFFF",
parentid: "folderCCCCCC",
type: "bookmark",
title: "F",
bmkUri: "http://example.com/f",

Просмотреть файл

@ -57,36 +57,50 @@ add_task(async function test_inconsistencies() {
info("Set up mirror");
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "bookmarkDDDD"],
children: ["bookmarkAAAA", "bookmarkDDDD", "bookmarkGGGG"],
}, {
id: "toolbar",
parentid: "places",
type: "folder",
children: ["bookmarkFFFF"],
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
}, {
id: "bookmarkDDDD",
parentid: "menu",
type: "bookmark",
title: "D",
bmkUri: "http://example.com/d",
}, {
id: "bookmarkFFFF",
parentid: "toolbar",
type: "bookmark",
title: "F",
bmkUri: "http://example.com/f",
}, {
// Merged bookmark that doesn't exist locally.
id: "bookmarkGGGG",
parentid: "menu",
type: "bookmark",
title: "G",
bmkUri: "http://example.com/g",
}], { needsMerge: false });
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "bookmarkDDDD", "bookmarkGGGG", "bookmarkHHHH"],
}, {
// New bookmark that doesn't exist locally; not an inconsistency.
id: "bookmarkHHHH",
parentid: "unfiled",
type: "bookmark",
title: "H",
bmkUri: "http://example.com/h",

Просмотреть файл

@ -31,10 +31,12 @@ add_task(async function test_value_combo() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["mozBmk______"],
}, {
id: "mozBmk______",
parentid: "menu",
type: "bookmark",
title: "Mozilla",
bmkUri: "https://mozilla.org",
@ -56,27 +58,32 @@ add_task(async function test_value_combo() {
info("Insert remote bookmarks and folder to apply");
await storeRecords(buf, shuffle([{
id: "mozBmk______",
parentid: "menu",
type: "bookmark",
title: "Mozilla home page",
bmkUri: "https://mozilla.org",
tags: ["browsers"],
}, {
id: "toolbar",
parentid: "places",
type: "folder",
children: ["fxBmk_______", "tFolder_____"],
}, {
id: "fxBmk_______",
parentid: "toolbar",
type: "bookmark",
title: "Get Firefox",
bmkUri: "http://getfirefox.com",
tags: ["taggy", "browsers"],
}, {
id: "tFolder_____",
parentid: "toolbar",
type: "folder",
title: "Mail",
children: ["tbBmk_______"],
}, {
id: "tbBmk_______",
parentid: "tFolder_____",
type: "bookmark",
title: "Get Thunderbird",
bmkUri: "http://getthunderbird.com",
@ -263,61 +270,73 @@ add_task(async function test_value_only_changes() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["folderAAAAAA", "folderFFFFFF"],
}, {
id: "folderAAAAAA",
parentid: "menu",
type: "folder",
title: "A",
children: ["bookmarkBBBB", "bookmarkCCCC", "folderJJJJJJ", "bookmarkDDDD",
"bookmarkEEEE"],
}, {
id: "bookmarkBBBB",
parentid: "folderAAAAAA",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
}, {
id: "bookmarkCCCC",
parentid: "folderAAAAAA",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
}, {
id: "folderJJJJJJ",
parentid: "folderAAAAAA",
type: "folder",
title: "J",
children: ["bookmarkKKKK"],
}, {
id: "bookmarkKKKK",
parentid: "folderJJJJJJ",
type: "bookmark",
title: "K",
bmkUri: "http://example.com/k",
}, {
id: "bookmarkDDDD",
parentid: "folderAAAAAA",
type: "bookmark",
title: "D",
bmkUri: "http://example.com/d",
}, {
id: "bookmarkEEEE",
parentid: "folderAAAAAA",
type: "bookmark",
title: "E",
bmkUri: "http://example.com/e",
}, {
id: "folderFFFFFF",
parentid: "menu",
type: "folder",
title: "F",
children: ["bookmarkGGGG", "folderHHHHHH"],
}, {
id: "bookmarkGGGG",
parentid: "folderFFFFFF",
type: "bookmark",
title: "G",
bmkUri: "http://example.com/g",
}, {
id: "folderHHHHHH",
parentid: "folderFFFFFF",
type: "folder",
title: "H",
children: ["bookmarkIIII"],
}, {
id: "bookmarkIIII",
parentid: "folderHHHHHH",
type: "bookmark",
title: "I",
bmkUri: "http://example.com/i",
@ -327,21 +346,25 @@ add_task(async function test_value_only_changes() {
info("Make remote changes");
await storeRecords(buf, shuffle([{
id: "bookmarkCCCC",
parentid: "folderAAAAAA",
type: "bookmark",
title: "C (remote)",
bmkUri: "http://example.com/c-remote",
}, {
id: "bookmarkEEEE",
parentid: "folderAAAAAA",
type: "bookmark",
title: "E (remote)",
bmkUri: "http://example.com/e-remote",
}, {
id: "bookmarkIIII",
parentid: "folderHHHHHH",
type: "bookmark",
title: "I (remote)",
bmkUri: "http://example.com/i-remote",
}, {
id: "folderFFFFFF",
parentid: "menu",
type: "folder",
title: "F (remote)",
children: ["bookmarkGGGG", "folderHHHHHH"],
@ -474,10 +497,12 @@ add_task(async function test_conflicting_keywords() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA"],
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
@ -500,10 +525,12 @@ add_task(async function test_conflicting_keywords() {
{
await storeRecords(buf, shuffle([{
id: "toolbar",
parentid: "places",
type: "folder",
children: ["bookmarkAAA1"],
}, {
id: "bookmarkAAA1",
parentid: "toolbar",
type: "bookmark",
title: "A1",
bmkUri: "http://example.com/a",
@ -548,6 +575,7 @@ add_task(async function test_conflicting_keywords() {
{
await storeRecords(buf, shuffle([{
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
@ -622,27 +650,32 @@ add_task(async function test_keywords() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "bookmarkBBBB", "bookmarkCCCC", "bookmarkDDDD"],
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
keyword: "one",
}, {
id: "bookmarkBBBB",
parentid: "menu",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
keyword: "two",
}, {
id: "bookmarkCCCC",
parentid: "menu",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
}, {
id: "bookmarkDDDD",
parentid: "menu",
type: "bookmark",
title: "D",
bmkUri: "http://example.com/d",
@ -653,12 +686,14 @@ add_task(async function test_keywords() {
info("Change keywords remotely");
await storeRecords(buf, shuffle([{
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
keyword: "two",
}, {
id: "bookmarkBBBB",
parentid: "menu",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
@ -727,27 +762,32 @@ add_task(async function test_keywords_complex() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkBBBB", "bookmarkCCCC", "bookmarkDDDD", "bookmarkEEEE"],
}, {
id: "bookmarkBBBB",
parentid: "menu",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
keyword: "four",
}, {
id: "bookmarkCCCC",
parentid: "menu",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
keyword: "five",
}, {
id: "bookmarkDDDD",
parentid: "menu",
type: "bookmark",
title: "D",
bmkUri: "http://example.com/d",
}, {
id: "bookmarkEEEE",
parentid: "menu",
type: "bookmark",
title: "E",
bmkUri: "http://example.com/e",
@ -758,28 +798,33 @@ add_task(async function test_keywords_complex() {
info("Make remote changes");
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "bookmarkAAA1", "bookmarkBBBB", "bookmarkCCCC",
"bookmarkDDDD", "bookmarkEEEE"],
children: ["bookmarkAAAA", "bookmarkAAA1", "bookmarkBBB1", "bookmarkBBBB",
"bookmarkCCCC", "bookmarkDDDD", "bookmarkEEEE"],
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
keyword: "one",
}, {
id: "bookmarkAAA1",
parentid: "menu",
type: "bookmark",
title: "A (copy)",
bmkUri: "http://example.com/a",
keyword: "two",
}, {
id: "bookmarkBBB1",
parentid: "menu",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
}, {
id: "bookmarkCCCC",
parentid: "menu",
type: "bookmark",
title: "C (remote)",
bmkUri: "http://example.com/c-remote",
@ -840,11 +885,11 @@ add_task(async function test_keywords_complex() {
}, {
name: "bookmark-added",
params: { itemId: localItemIds.get("bookmarkBBB1"),
parentId: unfiledFolderId, index: 0,
parentId: PlacesUtils.bookmarksMenuFolderId, index: 2,
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
urlHref: "http://example.com/b", title: "B",
guid: "bookmarkBBB1",
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
parentGuid: PlacesUtils.bookmarks.menuGuid,
source: PlacesUtils.bookmarks.SOURCES.SYNC },
}, {
// These `onItemMoved` notifications aren't necessary: we only moved
@ -856,7 +901,7 @@ add_task(async function test_keywords_complex() {
params: { itemId: localItemIds.get("bookmarkBBBB"),
oldParentId: PlacesUtils.bookmarksMenuFolderId,
oldIndex: 0, newParentId: PlacesUtils.bookmarksMenuFolderId,
newIndex: 2, type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
newIndex: 3, type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
guid: "bookmarkBBBB",
oldParentGuid: PlacesUtils.bookmarks.menuGuid,
newParentGuid: PlacesUtils.bookmarks.menuGuid,
@ -867,7 +912,7 @@ add_task(async function test_keywords_complex() {
params: { itemId: localItemIds.get("bookmarkCCCC"),
oldParentId: PlacesUtils.bookmarksMenuFolderId,
oldIndex: 1, newParentId: PlacesUtils.bookmarksMenuFolderId,
newIndex: 3, type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
newIndex: 4, type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
guid: "bookmarkCCCC",
oldParentGuid: PlacesUtils.bookmarks.menuGuid,
newParentGuid: PlacesUtils.bookmarks.menuGuid,
@ -878,7 +923,7 @@ add_task(async function test_keywords_complex() {
params: { itemId: localItemIds.get("bookmarkDDDD"),
oldParentId: PlacesUtils.bookmarksMenuFolderId,
oldIndex: 2, newParentId: PlacesUtils.bookmarksMenuFolderId,
newIndex: 4, type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
newIndex: 5, type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
guid: "bookmarkDDDD",
oldParentGuid: PlacesUtils.bookmarks.menuGuid,
newParentGuid: PlacesUtils.bookmarks.menuGuid,
@ -889,7 +934,7 @@ add_task(async function test_keywords_complex() {
params: { itemId: localItemIds.get("bookmarkEEEE"),
oldParentId: PlacesUtils.bookmarksMenuFolderId,
oldIndex: 3, newParentId: PlacesUtils.bookmarksMenuFolderId,
newIndex: 5, type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
newIndex: 6, type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
guid: "bookmarkEEEE",
oldParentGuid: PlacesUtils.bookmarks.menuGuid,
newParentGuid: PlacesUtils.bookmarks.menuGuid,
@ -969,27 +1014,32 @@ add_task(async function test_tags() {
});
await storeRecords(buf, shuffle([{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "bookmarkBBBB", "bookmarkCCCC", "bookmarkDDDD"],
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
tags: ["one", "two", "three", "four"],
}, {
id: "bookmarkBBBB",
parentid: "menu",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
tags: ["five", "six"],
}, {
id: "bookmarkCCCC",
parentid: "menu",
type: "bookmark",
title: "C",
bmkUri: "http://example.com/c",
}, {
id: "bookmarkDDDD",
parentid: "menu",
type: "bookmark",
title: "D",
bmkUri: "http://example.com/d",
@ -1000,12 +1050,14 @@ add_task(async function test_tags() {
info("Change tags remotely");
await storeRecords(buf, shuffle([{
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
tags: ["one", "two", "ten"],
}, {
id: "bookmarkBBBB",
parentid: "menu",
type: "bookmark",
title: "B",
bmkUri: "http://example.com/b",
@ -1065,15 +1117,18 @@ add_task(async function test_rewrite_tag_queries() {
});
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "bookmarkDDDD"],
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
bmkUri: "http://example.com/a",
}, {
id: "bookmarkDDDD",
parentid: "menu",
type: "bookmark",
title: "D",
bmkUri: "http://example.com/d",
@ -1084,22 +1139,26 @@ add_task(async function test_rewrite_tag_queries() {
info("Add tag queries for new and existing tags");
await storeRecords(buf, [{
id: "toolbar",
parentid: "places",
type: "folder",
children: ["queryBBBBBBB", "queryCCCCCCC", "bookmarkEEEE"],
}, {
id: "queryBBBBBBB",
parentid: "toolbar",
type: "query",
title: "Tagged stuff",
bmkUri: "place:type=7&folder=999",
folderName: "taggy",
}, {
id: "queryCCCCCCC",
parentid: "toolbar",
type: "query",
title: "Cats",
bmkUri: "place:type=7&folder=888",
folderName: "kitty",
}, {
id: "bookmarkEEEE",
parentid: "toolbar",
type: "bookmark",
title: "E",
bmkUri: "http://example.com/e",
@ -1173,16 +1232,19 @@ add_task(async function test_date_added() {
});
await storeRecords(buf, [{
id: "menu",
parentid: "places",
type: "folder",
children: ["bookmarkAAAA", "bookmarkBBBB"],
}, {
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A",
dateAdded: aDateAdded.getTime(),
bmkUri: "http://example.com/a",
}, {
id: "bookmarkBBBB",
parentid: "menu",
type: "bookmark",
title: "B",
dateAdded: bDateAdded.getTime(),
@ -1194,12 +1256,14 @@ add_task(async function test_date_added() {
let bNewDateAdded = new Date(bDateAdded.getTime() - 1 * 60 * 60 * 1000);
await storeRecords(buf, [{
id: "bookmarkAAAA",
parentid: "menu",
type: "bookmark",
title: "A (remote)",
dateAdded: Date.now(),
bmkUri: "http://example.com/a",
}, {
id: "bookmarkBBBB",
parentid: "menu",
type: "bookmark",
title: "B (remote)",
dateAdded: bNewDateAdded.getTime(),