diff --git a/toolkit/components/places/public/nsIAnnotationService.idl b/toolkit/components/places/public/nsIAnnotationService.idl index ae03628fec8..97ecf32a3b9 100644 --- a/toolkit/components/places/public/nsIAnnotationService.idl +++ b/toolkit/components/places/public/nsIAnnotationService.idl @@ -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; diff --git a/toolkit/components/places/src/nsNavBookmarks.cpp b/toolkit/components/places/src/nsNavBookmarks.cpp index 24ac4a3d9a8..a9864c4e496 100644 --- a/toolkit/components/places/src/nsNavBookmarks.cpp +++ b/toolkit/components/places/src/nsNavBookmarks.cpp @@ -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 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; } diff --git a/toolkit/components/places/src/nsNavHistoryExpire.cpp b/toolkit/components/places/src/nsNavHistoryExpire.cpp index 727cc004c5d..7cadde99e58 100644 --- a/toolkit/components/places/src/nsNavHistoryExpire.cpp +++ b/toolkit/components/places/src/nsNavHistoryExpire.cpp @@ -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) {