Bug 532094 - crash [@ nsNavHistory::AutoCompleteFeedback(int, nsIAutoCompleteController*)], r=sdwilsh

This commit is contained in:
Marco Bonardo 2009-12-02 17:39:16 +01:00
Родитель 5c6d8d1bee
Коммит 41e8fb5eec
4 изменённых файлов: 20 добавлений и 22 удалений

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

@ -2582,7 +2582,7 @@ nsNavBookmarks::GetBookmarkedURIFor(nsIURI* aURI, nsIURI** _retval)
if (GetBookmarksHash()->Get(urlID, &bookmarkID)) {
// found one, convert ID back to URL. This statement is NOT refcounted
mozIStorageStatement* statement = history->DBGetIdPageInfo();
NS_ENSURE_TRUE(statement, NS_ERROR_UNEXPECTED);
NS_ENSURE_STATE(statement);
mozStorageStatementScoper scoper(statement);
rv = statement->BindInt64Parameter(0, bookmarkID);

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

@ -5260,21 +5260,20 @@ nsNavHistory::GetPageTitle(nsIURI* aURI, nsAString& aTitle)
aTitle.Truncate(0);
mozIStorageStatement *statement = DBGetURLPageInfo();
mozStorageStatementScoper scope(statement);
nsresult rv = BindStatementURI(statement, 0, aURI);
mozStorageStatementScoper scope(mDBGetURLPageInfo);
nsresult rv = BindStatementURI(mDBGetURLPageInfo, 0, aURI);
NS_ENSURE_SUCCESS(rv, rv);
PRBool hasResults = PR_FALSE;
rv = statement->ExecuteStep(&hasResults);
rv = mDBGetURLPageInfo->ExecuteStep(&hasResults);
NS_ENSURE_SUCCESS(rv, rv);
if (!hasResults) {
aTitle.SetIsVoid(PR_TRUE);
return NS_OK; // not found: return void string
return NS_OK; // Not found, return a void string.
}
rv = statement->GetString(nsNavHistory::kGetInfoIndex_Title, aTitle);
rv = mDBGetURLPageInfo->GetString(nsNavHistory::kGetInfoIndex_Title, aTitle);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -5466,6 +5465,7 @@ nsNavHistory::Observe(nsISupports *aSubject, const char *aTopic,
nsCOMPtr<nsIObserverService> os =
do_GetService("@mozilla.org/observer-service;1");
if (os) {
os->RemoveObserver(this, gAutoCompleteFeedback);
os->RemoveObserver(this, NS_PRIVATE_BROWSING_SWITCH_TOPIC);
os->RemoveObserver(this, gIdleDaily);
os->RemoveObserver(this, gXpcomShutdown);
@ -6829,7 +6829,7 @@ nsNavHistory::VisitIdToResultNode(PRInt64 visitId,
// by registering their own observers when they are expanded.
return NS_OK;
}
NS_ENSURE_TRUE(statement, NS_ERROR_UNEXPECTED);
NS_ENSURE_STATE(statement);
mozStorageStatementScoper scoper(statement);
nsresult rv = statement->BindInt64Parameter(0, visitId);
@ -6851,7 +6851,7 @@ nsNavHistory::BookmarkIdToResultNode(PRInt64 aBookmarkId, nsNavHistoryQueryOptio
nsNavHistoryResultNode** aResult)
{
mozIStorageStatement *stmt = GetDBBookmarkToUrlResult();
NS_ENSURE_TRUE(stmt, NS_ERROR_UNEXPECTED);
NS_ENSURE_STATE(stmt);
mozStorageStatementScoper scoper(stmt);
nsresult rv = stmt->BindInt64Parameter(0, aBookmarkId);
NS_ENSURE_SUCCESS(rv, rv);
@ -7752,6 +7752,7 @@ nsNavHistory::AutoCompleteFeedback(PRInt32 aIndex,
return NS_OK;
mozIStorageStatement *stmt = GetDBFeedbackIncrease();
NS_ENSURE_STATE(stmt);
mozStorageStatementScoper scope(stmt);
nsAutoString input;
@ -7776,7 +7777,7 @@ nsNavHistory::AutoCompleteFeedback(PRInt32 aIndex,
return NS_OK;
}
mozIStorageStatement*
mozIStorageStatement *
nsNavHistory::GetDBFeedbackIncrease()
{
if (mDBFeedbackIncrease)

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

@ -129,7 +129,7 @@ public:
/**
* Obtains the nsNavHistory object.
*/
static nsNavHistory * GetSingleton();
static nsNavHistory *GetSingleton();
/**
* Initializes the nsNavHistory object. This should only be called once.
@ -141,7 +141,7 @@ public:
* service to get a reference to this history object. Returns a pointer to
* the service if it exists. Otherwise creates one. Returns NULL on error.
*/
static nsNavHistory * GetHistoryService()
static nsNavHistory *GetHistoryService()
{
if (!gHistoryService) {
nsCOMPtr<nsINavHistoryService> serv =
@ -215,9 +215,6 @@ public:
// returns true if history has been disabled
PRBool IsHistoryDisabled() { return mExpireDaysMax == 0 || InPrivateBrowsingMode(); }
// get the statement for selecting a history row by URL
mozIStorageStatement* DBGetURLPageInfo() { return mDBGetURLPageInfo; }
// Constants for the columns returned by the above statement.
static const PRInt32 kGetInfoIndex_PageID;
static const PRInt32 kGetInfoIndex_URL;
@ -231,9 +228,9 @@ public:
static const PRInt32 kGetInfoIndex_ItemParentId;
// select a history row by id
mozIStorageStatement* DBGetIdPageInfo() { return mDBGetIdPageInfo; }
mozIStorageStatement *DBGetIdPageInfo() { return mDBGetIdPageInfo; }
mozIStorageStatement* DBGetTags() { return mDBGetTags; }
mozIStorageStatement *DBGetTags() { return mDBGetTags; }
PRInt64 GetTagsFolder();
// Constants for the columns returned by the above statement
@ -644,7 +641,7 @@ protected:
#ifdef MOZ_XUL
// AutoComplete stuff
mozIStorageStatement* GetDBFeedbackIncrease();
mozIStorageStatement *GetDBFeedbackIncrease();
nsCOMPtr<mozIStorageStatement> mDBFeedbackIncrease;
nsresult AutoCompleteFeedback(PRInt32 aIndex,

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

@ -290,10 +290,10 @@ nsNavHistoryResultNode::GetTags(nsAString& aTags) {
}
// Fetch the tags
nsNavHistory* history = nsNavHistory::GetHistoryService();
NS_ENSURE_STATE(history);
mozIStorageStatement* getTagsStatement = history->DBGetTags();
nsNavHistory *history = nsNavHistory::GetHistoryService();
NS_ENSURE_TRUE(history, NS_ERROR_OUT_OF_MEMORY);
mozIStorageStatement *getTagsStatement = history->DBGetTags();
NS_ENSURE_STATE(getTagsStatement);
mozStorageStatementScoper scoper(getTagsStatement);
nsresult rv = getTagsStatement->BindInt64Parameter(0, history->GetTagsFolder());
NS_ENSURE_SUCCESS(rv, rv);