зеркало из https://github.com/mozilla/gecko-dev.git
Bug 707949 - Don't recalculate frecency for tags.
r=dietrich
This commit is contained in:
Родитель
d7cc070d5f
Коммит
1b26c04d0a
|
@ -664,9 +664,11 @@ nsNavBookmarks::InsertBookmark(PRInt64 aFolder,
|
|||
nsnull, aNewBookmarkId, guid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Recalculate frecency for this entry, since it changed.
|
||||
rv = history->UpdateFrecency(placeId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// If not a tag, recalculate frecency for this entry, since it changed.
|
||||
if (grandParentId != mTagsRoot) {
|
||||
rv = history->UpdateFrecency(placeId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
rv = transaction.Commit();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -778,10 +780,13 @@ nsNavBookmarks::RemoveItem(PRInt64 aItemId)
|
|||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
if (bookmark.type == TYPE_BOOKMARK) {
|
||||
nsNavHistory* history = nsNavHistory::GetHistoryService();
|
||||
NS_ENSURE_TRUE(history, NS_ERROR_OUT_OF_MEMORY);
|
||||
rv = history->UpdateFrecency(bookmark.placeId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// If not a tag, recalculate frecency for this entry, since it changed.
|
||||
if (bookmark.grandParentId != mTagsRoot) {
|
||||
nsNavHistory* history = nsNavHistory::GetHistoryService();
|
||||
NS_ENSURE_TRUE(history, NS_ERROR_OUT_OF_MEMORY);
|
||||
rv = history->UpdateFrecency(bookmark.placeId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
rv = UpdateKeywordsHashForRemovedBookmark(aItemId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -1234,10 +1239,13 @@ nsNavBookmarks::RemoveFolderChildren(PRInt64 aFolderId)
|
|||
for (PRUint32 i = 0; i < folderChildrenArray.Length(); i++) {
|
||||
BookmarkData& child = folderChildrenArray[i];
|
||||
if (child.type == TYPE_BOOKMARK) {
|
||||
nsNavHistory* history = nsNavHistory::GetHistoryService();
|
||||
NS_ENSURE_TRUE(history, NS_ERROR_OUT_OF_MEMORY);
|
||||
rv = history->UpdateFrecency(child.placeId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// If not a tag, recalculate frecency for this entry, since it changed.
|
||||
if (child.grandParentId != mTagsRoot) {
|
||||
nsNavHistory* history = nsNavHistory::GetHistoryService();
|
||||
NS_ENSURE_TRUE(history, NS_ERROR_OUT_OF_MEMORY);
|
||||
rv = history->UpdateFrecency(child.placeId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
rv = UpdateKeywordsHashForRemovedBookmark(child.id);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -159,6 +159,22 @@ var tests = [function() { ensure_tag_results([uri1, uri2, uri3], "foo"); },
|
|||
function() { ensure_tag_results([uri4, uri5, uri6], "BAR MUD"); },
|
||||
function() { ensure_tag_results([uri4, uri5, uri6], "Bar Mud"); }];
|
||||
|
||||
/**
|
||||
* Properly tags a uri adding it to bookmarks.
|
||||
*
|
||||
* @param aURI
|
||||
* The nsIURI to tag.
|
||||
* @param aTags
|
||||
* The tags to add.
|
||||
*/
|
||||
function tagURI(aURI, aTags) {
|
||||
PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
|
||||
aURI,
|
||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||
"A title");
|
||||
tagssvc.tagURI(aURI, aTags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test bug #408221
|
||||
*/
|
||||
|
@ -169,15 +185,15 @@ function run_test() {
|
|||
prefs.setIntPref("browser.urlbar.search.sources", 3);
|
||||
prefs.setIntPref("browser.urlbar.default.behavior", 0);
|
||||
|
||||
tagssvc.tagURI(uri1, ["Foo"]);
|
||||
tagssvc.tagURI(uri2, ["FOO"]);
|
||||
tagssvc.tagURI(uri3, ["foO"]);
|
||||
tagssvc.tagURI(uri4, ["BAR"]);
|
||||
tagssvc.tagURI(uri4, ["MUD"]);
|
||||
tagssvc.tagURI(uri5, ["bar"]);
|
||||
tagssvc.tagURI(uri5, ["mud"]);
|
||||
tagssvc.tagURI(uri6, ["baR"]);
|
||||
tagssvc.tagURI(uri6, ["muD"]);
|
||||
tagURI(uri1, ["Foo"]);
|
||||
tagURI(uri2, ["FOO"]);
|
||||
tagURI(uri3, ["foO"]);
|
||||
tagURI(uri4, ["BAR"]);
|
||||
tagURI(uri4, ["MUD"]);
|
||||
tagURI(uri5, ["bar"]);
|
||||
tagURI(uri5, ["mud"]);
|
||||
tagURI(uri6, ["baR"]);
|
||||
tagURI(uri6, ["muD"]);
|
||||
|
||||
tests[0]();
|
||||
}
|
||||
|
|
|
@ -182,6 +182,22 @@ var tests = [
|
|||
function() ensure_tag_results([uri6], "foo bar cheese bbb"),
|
||||
];
|
||||
|
||||
/**
|
||||
* Properly tags a uri adding it to bookmarks.
|
||||
*
|
||||
* @param aURI
|
||||
* The nsIURI to tag.
|
||||
* @param aTags
|
||||
* The tags to add.
|
||||
*/
|
||||
function tagURI(aURI, aTags) {
|
||||
PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
|
||||
aURI,
|
||||
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
||||
"A title");
|
||||
tagssvc.tagURI(aURI, aTags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test history autocomplete
|
||||
*/
|
||||
|
@ -192,12 +208,12 @@ function run_test() {
|
|||
prefs.setIntPref("browser.urlbar.search.sources", 3);
|
||||
prefs.setIntPref("browser.urlbar.default.behavior", 0);
|
||||
|
||||
tagssvc.tagURI(uri1, ["foo"]);
|
||||
tagssvc.tagURI(uri2, ["bar"]);
|
||||
tagssvc.tagURI(uri3, ["cheese"]);
|
||||
tagssvc.tagURI(uri4, ["foo bar"]);
|
||||
tagssvc.tagURI(uri5, ["bar cheese"]);
|
||||
tagssvc.tagURI(uri6, ["foo bar cheese"]);
|
||||
tagURI(uri1, ["foo"]);
|
||||
tagURI(uri2, ["bar"]);
|
||||
tagURI(uri3, ["cheese"]);
|
||||
tagURI(uri4, ["foo bar"]);
|
||||
tagURI(uri5, ["bar cheese"]);
|
||||
tagURI(uri6, ["foo bar cheese"]);
|
||||
|
||||
tests[0]();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче