зеркало из https://github.com/mozilla/gecko-dev.git
Bug 610375 - Make bookmark folders not sync last [r=mconnor]
This commit is contained in:
Родитель
80f1e34958
Коммит
959c42dca4
|
@ -45,6 +45,7 @@ const Cu = Components.utils;
|
|||
const PARENT_ANNO = "weave/parent";
|
||||
const PREDECESSOR_ANNO = "weave/predecessor";
|
||||
const SERVICE_NOT_SUPPORTED = "Service not supported on this platform";
|
||||
const FOLDER_SORTINDEX = 1000000;
|
||||
|
||||
try {
|
||||
Cu.import("resource://gre/modules/PlacesUtils.jsm");
|
||||
|
@ -862,6 +863,10 @@ BookmarksStore.prototype = {
|
|||
},
|
||||
|
||||
_calculateIndex: function _calculateIndex(record) {
|
||||
// Ensure folders have a very high sort index so they're not synced last.
|
||||
if (record.type == "folder")
|
||||
return FOLDER_SORTINDEX;
|
||||
|
||||
// For anything directly under the toolbar, give it a boost of more than an
|
||||
// unvisited bookmark
|
||||
let index = 0;
|
||||
|
|
|
@ -42,6 +42,13 @@ function run_test() {
|
|||
|
||||
_("The calculated sort index is based on frecency data.");
|
||||
do_check_true(newrecord.sortindex >= 150);
|
||||
|
||||
_("Folders have high sort index to ensure they're synced first.");
|
||||
let folder_id = Svc.Bookmark.createFolder(Svc.Bookmark.toolbarFolder,
|
||||
"Test Folder", 0);
|
||||
let folder_guid = Svc.Bookmark.getItemGUID(folder_id);
|
||||
let folder_record = store.createRecord(folder_guid, "http://fake/uri");
|
||||
do_check_eq(folder_record.sortindex, 1000000);
|
||||
} finally {
|
||||
_("Clean up.");
|
||||
store.wipe();
|
||||
|
|
Загрузка…
Ссылка в новой задаче