From 11d951d56329171f9943c9ee824bb4091981a212 Mon Sep 17 00:00:00 2001 From: Mark Hammond Date: Tue, 13 Oct 2015 10:32:18 +1100 Subject: [PATCH] Bug 1212633 - include mobile and unfiled folders in Sync's concept of 'all IDs'. r=rnewman --- services/sync/modules/engines/bookmarks.js | 10 +++++++++- services/sync/tests/unit/test_bookmark_engine.js | 8 +++++--- .../sync/tests/unit/test_bookmark_smart_bookmarks.js | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/services/sync/modules/engines/bookmarks.js b/services/sync/modules/engines/bookmarks.js index 135e42f29265..81b96344d398 100644 --- a/services/sync/modules/engines/bookmarks.js +++ b/services/sync/modules/engines/bookmarks.js @@ -1352,7 +1352,15 @@ BookmarksStore.prototype = { getAllIDs: function BStore_getAllIDs() { let items = {"menu": true, - "toolbar": true}; + "toolbar": true, + "unfiled": true, + }; + // We also want "mobile" but only if a local mobile folder already exists + // (otherwise we'll later end up creating it, which we want to avoid until + // we actually need it.) + if (kSpecialIds.findMobileRoot(false)) { + items["mobile"] = true; + } for each (let guid in kSpecialIds.guids) { if (guid != "places" && guid != "tags") this._getChildren(guid, items); diff --git a/services/sync/tests/unit/test_bookmark_engine.js b/services/sync/tests/unit/test_bookmark_engine.js index bd4c740cbcd3..a27d1b2b63fb 100644 --- a/services/sync/tests/unit/test_bookmark_engine.js +++ b/services/sync/tests/unit/test_bookmark_engine.js @@ -227,7 +227,7 @@ add_task(function test_restorePromptsReupload() { _("Verify that there's only one bookmark on the server, and it's Thunderbird."); // Of course, there's also the Bookmarks Toolbar and Bookmarks Menu... let wbos = collection.keys(function (id) { - return ["menu", "toolbar", "mobile", folder1_guid].indexOf(id) == -1; + return ["menu", "toolbar", "mobile", "unfiled", folder1_guid].indexOf(id) == -1; }); do_check_eq(wbos.length, 1); do_check_eq(wbos[0], bmk2_guid); @@ -257,7 +257,7 @@ add_task(function test_restorePromptsReupload() { do_check_true(found); _("Have the correct number of IDs locally, too."); - do_check_eq(count, ["menu", "toolbar", folder1_id, bmk1_id].length); + do_check_eq(count, ["menu", "toolbar", "mobile", "unfiled", folder1_id, bmk1_id].length); _("Sync again. This'll wipe bookmarks from the server."); try { @@ -277,7 +277,9 @@ add_task(function test_restorePromptsReupload() { let folderWBOs = payloads.filter(function (wbo) { return ((wbo.type == "folder") && (wbo.id != "menu") && - (wbo.id != "toolbar")); + (wbo.id != "toolbar") && + (wbo.id != "unfiled") && + (wbo.id != "mobile")); }); do_check_eq(bookmarkWBOs.length, 1); diff --git a/services/sync/tests/unit/test_bookmark_smart_bookmarks.js b/services/sync/tests/unit/test_bookmark_smart_bookmarks.js index f7758556e3d3..abcf91e07259 100644 --- a/services/sync/tests/unit/test_bookmark_smart_bookmarks.js +++ b/services/sync/tests/unit/test_bookmark_smart_bookmarks.js @@ -112,7 +112,7 @@ add_test(function test_annotation_uploaded() { try { engine.sync(); let wbos = collection.keys(function (id) { - return ["menu", "toolbar", "mobile"].indexOf(id) == -1; + return ["menu", "toolbar", "mobile", "unfiled"].indexOf(id) == -1; }); do_check_eq(wbos.length, 1);