зеркало из https://github.com/mozilla/pjs.git
Bug 555218 - 2: (History.cpp) Fix Places usage of deprecated Storage APIs. r=dietrich
This commit is contained in:
Родитель
a7bc315ba8
Коммит
ac87ae779f
|
@ -39,11 +39,13 @@
|
|||
|
||||
#include "History.h"
|
||||
#include "nsNavHistory.h"
|
||||
#include "Helpers.h"
|
||||
|
||||
#include "mozilla/storage.h"
|
||||
#include "mozilla/dom/Link.h"
|
||||
#include "nsDocShellCID.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
|
@ -73,16 +75,14 @@ public:
|
|||
|
||||
nsNavHistory* navHist = nsNavHistory::GetHistoryService();
|
||||
NS_ENSURE_TRUE(navHist, NS_ERROR_FAILURE);
|
||||
mozIStorageStatement* stmt = navHist->DBGetIsVisited();
|
||||
mozIStorageStatement* stmt = navHist->GetStatementById(DB_IS_PAGE_VISITED);
|
||||
NS_ENSURE_STATE(stmt);
|
||||
|
||||
// Be sure to reset our statement!
|
||||
mozStorageStatementScoper scoper(stmt);
|
||||
nsCString spec;
|
||||
nsresult rv = aURI->GetSpec(spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = BindStatementURLCString(stmt, 0, spec);
|
||||
// Bind by index for performance.
|
||||
nsresult rv = URIBinder::Bind(stmt, 0, aURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRefPtr<VisitedQuery> callback = new VisitedQuery(aURI);
|
||||
|
@ -116,7 +116,7 @@ public:
|
|||
// Notify any observers about that we have resolved the visited state of
|
||||
// this URI.
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
|
||||
mozilla::services::GetObserverService();
|
||||
if (observerService) {
|
||||
nsAutoString status;
|
||||
if (mIsVisited) {
|
||||
|
|
|
@ -1148,6 +1148,7 @@ nsNavHistory::InitStatements()
|
|||
// We are not checking for duplicated ids into the unified table
|
||||
// for perf reasons, LIMIT 1 will discard duplicates faster since we
|
||||
// only need to know if a visit exists.
|
||||
// Use indexed params here for performance.
|
||||
rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"SELECT h.id "
|
||||
"FROM moz_places_temp h "
|
||||
|
|
|
@ -107,6 +107,7 @@ namespace places {
|
|||
enum HistoryStatementId {
|
||||
DB_GET_PAGE_INFO = 0
|
||||
, DB_GET_TAGS = 1
|
||||
, DB_IS_PAGE_VISITED = 2
|
||||
};
|
||||
|
||||
} // namespace places
|
||||
|
@ -261,8 +262,6 @@ public:
|
|||
|
||||
PRInt64 GetTagsFolder();
|
||||
|
||||
mozIStorageStatement *DBGetIsVisited() { return mDBIsPageVisited; }
|
||||
|
||||
// Constants for the columns returned by the above statement
|
||||
// (in addition to the ones above).
|
||||
static const PRInt32 kGetInfoIndex_VisitDate;
|
||||
|
@ -404,6 +403,8 @@ public:
|
|||
return mDBGetURLPageInfo;
|
||||
case DB_GET_TAGS:
|
||||
return mDBGetTags;
|
||||
case DB_IS_PAGE_VISITED:
|
||||
return mDBIsPageVisited;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче