Bug 691524 - Remove support for browser.startup.page == 2 and deprecate lastPageVisited. r=mak, sr=gavin

This commit is contained in:
Margaret Leibovic 2011-10-03 15:57:19 -07:00
parent a91e8559c6
commit 6c64b90493
4 changed files with 1 additions and 42 deletions

View File

@ -629,10 +629,6 @@ nsBrowserContentHandler.prototype = {
var choice = prefb.getIntPref("browser.startup.page"); var choice = prefb.getIntPref("browser.startup.page");
if (choice == 1 || choice == 3) if (choice == 1 || choice == 3)
startPage = this.startPage; startPage = this.startPage;
if (choice == 2)
startPage = Components.classes["@mozilla.org/browser/global-history;2"]
.getService(nsIBrowserHistory).lastPageVisited;
} catch (e) { } catch (e) {
Components.utils.reportError(e); Components.utils.reportError(e);
} }

View File

@ -42,7 +42,7 @@
#include "nsISupports.idl" #include "nsISupports.idl"
#include "nsIGlobalHistory2.idl" #include "nsIGlobalHistory2.idl"
[scriptable, uuid(212371ab-d8b9-4835-b867-d0eb78c0cb18)] [scriptable, uuid(d092f5a5-33a8-456c-ac89-6ae6f880bd04)]
interface nsIBrowserHistory : nsIGlobalHistory2 interface nsIBrowserHistory : nsIGlobalHistory2
{ {
/** /**
@ -60,11 +60,6 @@ interface nsIBrowserHistory : nsIGlobalHistory2
in wstring aTitle, in wstring aTitle,
in long long aLastVisited); in long long aLastVisited);
/**
* The last page that was visited in a top-level window.
*/
readonly attribute AUTF8String lastPageVisited;
/** /**
* Indicates if there are entries in global history. * Indicates if there are entries in global history.
* *

View File

@ -4075,35 +4075,6 @@ nsNavHistory::AddPageWithDetails(nsIURI *aURI, const PRUnichar *aTitle,
} }
/**
* This was once used when the new window was set to "previous page".
* Currently it is still referenced by browser.startup.page == 2, but that value
* is not selectable from the UI.
* TODO: Should be deprecated? There is no fast alternative to get this info.
*/
NS_IMETHODIMP
nsNavHistory::GetLastPageVisited(nsACString & aLastPageVisited)
{
NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
nsCOMPtr<mozIStorageStatement> statement;
nsresult rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
"SELECT url FROM moz_places "
"WHERE hidden = 0 "
"AND last_visit_date NOTNULL "
"ORDER BY last_visit_date DESC "),
getter_AddRefs(statement));
NS_ENSURE_SUCCESS(rv, rv);
bool hasMatch = false;
if (NS_SUCCEEDED(statement->ExecuteStep(&hasMatch)) && hasMatch)
return statement->GetUTF8String(0, aLastPageVisited);
aLastPageVisited.Truncate(0);
return NS_OK;
}
// nsNavHistory::GetCount // nsNavHistory::GetCount
// //
// This function is used in legacy code to see if there is any history to // This function is used in legacy code to see if there is any history to

View File

@ -59,7 +59,6 @@ function add_page(aURL, aTime)
add_test(function test_addPageWithDetails() add_test(function test_addPageWithDetails()
{ {
add_page(TEST_URL); add_page(TEST_URL);
do_check_eq(TEST_URL, PlacesUtils.bhistory.lastPageVisited);
do_check_eq(1, PlacesUtils.bhistory.count); do_check_eq(1, PlacesUtils.bhistory.count);
run_next_test(); run_next_test();
}); });
@ -68,7 +67,6 @@ add_test(function test_removePage()
{ {
PlacesUtils.bhistory.removePage(NetUtil.newURI(TEST_URL)); PlacesUtils.bhistory.removePage(NetUtil.newURI(TEST_URL));
do_check_eq(0, PlacesUtils.bhistory.count); do_check_eq(0, PlacesUtils.bhistory.count);
do_check_eq("", PlacesUtils.bhistory.lastPageVisited);
run_next_test(); run_next_test();
}); });
@ -98,7 +96,6 @@ add_test(function test_removePages()
PlacesUtils.bhistory.removePages(pages, pages.length); PlacesUtils.bhistory.removePages(pages, pages.length);
do_check_eq(0, PlacesUtils.bhistory.count); do_check_eq(0, PlacesUtils.bhistory.count);
do_check_eq("", PlacesUtils.bhistory.lastPageVisited);
// Check that the bookmark and its annotation still exist. // Check that the bookmark and its annotation still exist.
do_check_true(PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.unfiledBookmarksFolderId, 0) > 0); do_check_true(PlacesUtils.bookmarks.getIdForItemAt(PlacesUtils.unfiledBookmarksFolderId, 0) > 0);