Bug 739221 - Remove nsIBrowserHistory::count.

r=mak sr=gavin
This commit is contained in:
Marco Castelluccio 2012-05-05 14:26:25 +02:00
parent 4e28783b31
commit 6e367ec40e
4 changed files with 9 additions and 40 deletions

View File

@ -42,7 +42,7 @@
#include "nsISupports.idl"
#include "nsIGlobalHistory2.idl"
[scriptable, uuid(d092f5a5-33a8-456c-ac89-6ae6f880bd04)]
[scriptable, uuid(e0c3f659-8bc7-4a37-b39f-35903021e6a6)]
interface nsIBrowserHistory : nsIGlobalHistory2
{
/**
@ -60,14 +60,6 @@ interface nsIBrowserHistory : nsIGlobalHistory2
in wstring aTitle,
in long long aLastVisited);
/**
* Indicates if there are entries in global history.
*
* @note For performance reasons this is not the real number of entries.
* It will instead evaluate to 0 for no entries, 1 otherwise.
*/
readonly attribute PRUint32 count;
/**
* Removes a page from global history.
*

View File

@ -2714,29 +2714,6 @@ nsNavHistory::AddPageWithDetails(nsIURI *aURI, const PRUnichar *aTitle,
}
// nsNavHistory::GetCount
//
// This function is used in legacy code to see if there is any history to
// clear. Counting the actual number of history entries is very slow, so
// we just see if there are any and return 0 or 1, which is enough to make
// all the code that uses this function happy.
NS_IMETHODIMP
nsNavHistory::GetCount(PRUint32 *aCount)
{
NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
NS_ENSURE_ARG_POINTER(aCount);
bool hasEntries = false;
nsresult rv = GetHasHistoryEntries(&hasEntries);
if (hasEntries)
*aCount = 1;
else
*aCount = 0;
return rv;
}
// nsNavHistory::RemovePagesInternal
//
// Deletes a list of placeIds from history.

View File

@ -59,14 +59,14 @@ function add_page(aURL, aTime)
add_test(function test_addPageWithDetails()
{
add_page(TEST_URL);
do_check_eq(1, PlacesUtils.bhistory.count);
do_check_eq(1, PlacesUtils.history.hasHistoryEntries);
run_next_test();
});
add_test(function test_removePage()
{
PlacesUtils.bhistory.removePage(NetUtil.newURI(TEST_URL));
do_check_eq(0, PlacesUtils.bhistory.count);
do_check_eq(0, PlacesUtils.history.hasHistoryEntries);
run_next_test();
});
@ -95,7 +95,7 @@ add_test(function test_removePages()
Ci.nsIAnnotationService.EXPIRE_NEVER);
PlacesUtils.bhistory.removePages(pages, pages.length);
do_check_eq(0, PlacesUtils.bhistory.count);
do_check_eq(0, PlacesUtils.history.hasHistoryEntries);
// Check that the bookmark and its annotation still exist.
do_check_true(PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.unfiledBookmarksFolderId, 0) > 0);
@ -131,7 +131,7 @@ add_test(function test_removePagesByTimeframe()
// Clear remaining items and check that all pages have been removed.
PlacesUtils.bhistory.removePagesByTimeframe(startDate, startDate + 9);
do_check_eq(0, PlacesUtils.bhistory.count);
do_check_eq(0, PlacesUtils.history.hasHistoryEntries);
run_next_test();
});
@ -139,7 +139,7 @@ add_test(function test_removePagesFromHost()
{
add_page(TEST_URL);
PlacesUtils.bhistory.removePagesFromHost("mozilla.com", true);
do_check_eq(0, PlacesUtils.bhistory.count);
do_check_eq(0, PlacesUtils.history.hasHistoryEntries);
run_next_test();
});
@ -148,14 +148,14 @@ add_test(function test_removePagesFromHost_keepSubdomains()
add_page(TEST_URL);
add_page(TEST_SUBDOMAIN_URL);
PlacesUtils.bhistory.removePagesFromHost("mozilla.com", false);
do_check_eq(1, PlacesUtils.bhistory.count);
do_check_eq(1, PlacesUtils.history.hasHistoryEntries);
run_next_test();
});
add_test(function test_removeAllPages()
{
PlacesUtils.bhistory.removeAllPages();
do_check_eq(0, PlacesUtils.bhistory.count);
do_check_eq(0, PlacesUtils.history.hasHistoryEntries);
run_next_test();
});

View File

@ -53,7 +53,7 @@ let historyObserver = {
PlacesUtils.history.removeObserver(this, false);
// check browserHistory returns no entries
do_check_eq(0, PlacesUtils.bhistory.count);
do_check_eq(0, PlacesUtils.history.hasHistoryEntries);
Services.obs.addObserver(function observeExpiration(aSubject, aTopic, aData)
{