Bug 389808 Firefox start with a blank personal toolbar (r=sspitzer, a=schrep)

This commit is contained in:
dietrich@mozilla.com 2007-07-27 13:47:45 -07:00
Родитель ea36e2eef8
Коммит 88d4295b9a
3 изменённых файлов: 47 добавлений и 13 удалений

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

@ -71,25 +71,16 @@ interface nsIAnnotationService : nsISupports
* to time.
*/
// For annotations that only live as long as the URI is in history
// (eg: Has >0 visits).
const unsigned short EXPIRE_WITH_HISTORY = 0;
// For data that should never expire. Must be explictly removed.
const unsigned short EXPIRE_NEVER = 1;
// For temporary data that can be discarded when the user exits.
// Removed at application exit.
const unsigned short EXPIRE_SESSION = 2;
const unsigned short EXPIRE_SESSION = 0;
// For short-lived temporary data that you still want to outlast a session.
// Removed at 7 days.
const unsigned short EXPIRE_DAYS = 3;
// NOTE: 1 is skipped due to it's temporary use as EXPIRE_NEVER in bug #319455.
// For general page settings, things the user is interested in seeing
// if they come back to this page some time in the near future.
// Removed at 30 days.
const unsigned short EXPIRE_WEEKS = 4;
const unsigned short EXPIRE_WEEKS = 2;
// Something that the user will be interested in seeing in their
// history like favicons. If they haven't visited a page in a couple
@ -97,7 +88,18 @@ interface nsIAnnotationService : nsISupports
// the positions of things, or other stuff you create, so put that in
// the weeks policy.
// Removed at 180 days.
const unsigned short EXPIRE_MONTHS = 5;
const unsigned short EXPIRE_MONTHS = 3;
// For data that should never expire. Must be explictly removed.
const unsigned short EXPIRE_NEVER = 4;
// For annotations that only live as long as the URI is in history
// (eg: Has >0 visits).
const unsigned short EXPIRE_WITH_HISTORY = 5;
// For short-lived temporary data that you still want to outlast a session.
// Removed at 7 days.
const unsigned short EXPIRE_DAYS = 6;
// type constants
const unsigned short TYPE_INT32 = 1;

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

@ -493,6 +493,34 @@ nsNavBookmarks::InitToolbarFolder()
NS_ENSURE_SUCCESS(rv, rv);
rv = SetToolbarFolder(toolbarFolder);
NS_ENSURE_SUCCESS(rv, rv);
} else {
/**
* XXXdietrich: temporary migration code to fix bug 389808.
* should be removed some time after alpha 7.
*/
nsCOMPtr<mozIStorageStatement> getToolbarFolderStatement;
rv = dbConn->CreateStatement(NS_LITERAL_CSTRING("SELECT id from moz_bookmarks WHERE title = ?1 AND type = ?2"),
getter_AddRefs(getToolbarFolderStatement));
NS_ENSURE_SUCCESS(rv, rv);
nsXPIDLString toolbarTitle;
rv = mBundle->GetStringFromName(NS_LITERAL_STRING("PlacesBookmarksToolbarTitle").get(),
getter_Copies(toolbarTitle));
NS_ENSURE_SUCCESS(rv, rv);
rv = getToolbarFolderStatement->BindStringParameter(0, toolbarTitle);
NS_ENSURE_SUCCESS(rv, rv);
rv = getToolbarFolderStatement->BindInt32Parameter(1, TYPE_FOLDER);
NS_ENSURE_SUCCESS(rv, rv);
rv = getToolbarFolderStatement->ExecuteStep(&hasResult);
NS_ENSURE_SUCCESS(rv, rv);
if (hasResult) {
PRInt64 toolbarFolder;
rv = getToolbarFolderStatement->GetInt64(0, &toolbarFolder);
NS_ENSURE_SUCCESS(rv, rv);
rv = SetToolbarFolder(toolbarFolder);
NS_ENSURE_SUCCESS(rv, rv);
}
}
return NS_OK;
}

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

@ -542,6 +542,10 @@ nsNavHistoryExpire::EraseAnnotations(mozIStorageConnection* aConnection,
//
// Periodic expiration of annotations that have time-sensitive
// expiration policies.
//
// NOTE: Always specify the exact policy constant, as they're
// not guaranteed to be in numerical order.
//
nsresult
nsNavHistoryExpire::ExpireAnnotations(mozIStorageConnection* aConnection)
{