Bug 371821 - URI-based indexOfItem is obsolete. r=dietrich.

This commit is contained in:
mozilla.mano%sent.com 2007-03-07 01:33:20 +00:00
Родитель 638795c8b5
Коммит 7b7a0daffd
4 изменённых файлов: 2 добавлений и 47 удалений

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

@ -251,7 +251,6 @@ function run_test() {
bmsvc.moveFolder(workFolder, workFolder, bmsvc.DEFAULT_INDEX);
do_throw("moveFolder() allowed moving a folder to be it's own parent.");
} catch (e) {}
do_check_eq(bmsvc.indexOfItem(root, uri("http://google.com/")), 3);
do_check_eq(bmsvc.indexOfFolder(root, workFolder), 6);
// test insertSeparator
@ -264,11 +263,6 @@ function run_test() {
do_throw("insertSeparator: " + ex);
}
// test indexOfItem
var newId7 = bmsvc.insertItem(root, uri("http://blah.com"), 2);
do_check_eq(bmsvc.indexOfItem(root, uri("http://blah.com/")), 2);
bmsvc.removeItem(newId7);
// test indexOfFolder
var tmpFolder = bmsvc.createFolder(root, "tmp", 2);
do_check_eq(bmsvc.indexOfFolder(root, tmpFolder), 2);
@ -396,6 +390,7 @@ function run_test() {
var bmURI = bmsvc.getBookmarkURI(newId11);
do_check_eq("http://foo11.com/", bmURI.spec);
// test getItemIndex
var newId12 = bmsvc.insertItem(root, uri("http://foo11.com/"), 1);
var bmIndex = bmsvc.getItemIndex(newId12);
do_check_eq(1, bmIndex);

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

@ -181,7 +181,7 @@ interface nsINavBookmarkObserver : nsISupports
* folders. A URI in history can be contained in one or more such folders.
*/
[scriptable, uuid(860d786d-9bba-4011-a396-486a87af8f07)]
[scriptable, uuid(7a17cbcb-b4c8-4485-a254-9e8d58663fe7)]
interface nsINavBookmarksService : nsISupports
{
/**
@ -427,12 +427,6 @@ interface nsINavBookmarksService : nsISupports
[noscript] void getBookmarkIdsForURITArray(in nsIURI aURI,
in PRInt64Array aResult);
/**
* Returns the index of the given item in the given folder.
* Returns -1 if the item is not present in the folder.
*/
PRInt32 indexOfItem(in PRInt64 folder, in nsIURI uri);
/**
* Returns the index of the given subfolder in its parent.
* Returns -1 if the subfolder is not present in the parent folder.

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

@ -191,11 +191,6 @@ nsNavBookmarks::Init()
getter_AddRefs(mDBFolderCount));
NS_ENSURE_SUCCESS(rv, rv);
// mDBIndexOfItem: find the position of an item within a folder
rv = dbConn->CreateStatement(NS_LITERAL_CSTRING("SELECT position FROM moz_bookmarks WHERE item_child = ?1 AND parent = ?2"),
getter_AddRefs(mDBIndexOfItem));
NS_ENSURE_SUCCESS(rv, rv);
rv = dbConn->CreateStatement(NS_LITERAL_CSTRING("SELECT position FROM moz_bookmarks WHERE folder_child = ?1 AND parent = ?2"),
getter_AddRefs(mDBIndexOfFolder));
NS_ENSURE_SUCCESS(rv, rv);
@ -2024,34 +2019,6 @@ nsNavBookmarks::GetBookmarkIdsForURI(nsIURI *aURI, PRUint32 *aCount,
return NS_OK;
}
NS_IMETHODIMP
nsNavBookmarks::IndexOfItem(PRInt64 aFolder, nsIURI *aItem, PRInt32 *aIndex)
{
mozStorageTransaction transaction(DBConn(), PR_FALSE);
PRInt64 id;
nsresult rv = History()->GetUrlIdFor(aItem, &id, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
if (id == 0) {
*aIndex = -1;
return NS_OK;
}
mozStorageStatementScoper scope(mDBIndexOfItem);
mDBIndexOfItem->BindInt64Parameter(0, id);
mDBIndexOfItem->BindInt64Parameter(1, aFolder);
PRBool results;
rv = mDBIndexOfItem->ExecuteStep(&results);
NS_ENSURE_SUCCESS(rv, rv);
if (!results) {
*aIndex = -1;
return NS_OK;
}
*aIndex = mDBIndexOfItem->AsInt32(0);
return NS_OK;
}
NS_IMETHODIMP
nsNavBookmarks::IndexOfFolder(PRInt64 aParent,
PRInt64 aFolder, PRInt32 *aIndex)

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

@ -177,7 +177,6 @@ private:
nsCOMPtr<mozIStorageStatement> mDBFolderCount;
nsCOMPtr<mozIStorageStatement> mDBIndexOfItem;
nsCOMPtr<mozIStorageStatement> mDBIndexOfFolder;
nsCOMPtr<mozIStorageStatement> mDBGetChildAt;