Bug 1212633 - include mobile and unfiled folders in Sync's concept of 'all IDs'. r=rnewman

This commit is contained in:
Mark Hammond 2015-10-13 10:32:18 +11:00
parent 06f9f34bc8
commit 7e5f84eea0
3 changed files with 15 additions and 5 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);