mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 633266 - nsINavHistoryObserver: also pass in GUID whenever we pass in a URI. r=mak
Part 3: Implementation
This commit is contained in:
parent
41c630cdf8
commit
396ff23f45
@ -1851,7 +1851,8 @@ nsDownloadManager::OnEndUpdateBatch()
|
||||
NS_IMETHODIMP
|
||||
nsDownloadManager::OnVisit(nsIURI *aURI, PRInt64 aVisitID, PRTime aTime,
|
||||
PRInt64 aSessionID, PRInt64 aReferringID,
|
||||
PRUint32 aTransitionType, PRUint32 *aAdded)
|
||||
PRUint32 aTransitionType, const nsACString& aGUID,
|
||||
PRUint32 *aAdded)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1863,13 +1864,13 @@ nsDownloadManager::OnTitleChanged(nsIURI *aURI, const nsAString &aPageTitle)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDownloadManager::OnBeforeDeleteURI(nsIURI *aURI)
|
||||
nsDownloadManager::OnBeforeDeleteURI(nsIURI *aURI, const nsACString& aGUID)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDownloadManager::OnDeleteURI(nsIURI *aURI)
|
||||
nsDownloadManager::OnDeleteURI(nsIURI *aURI, const nsACString& aGUID)
|
||||
{
|
||||
return RemoveDownloadsForURI(aURI);
|
||||
}
|
||||
@ -1888,7 +1889,8 @@ nsDownloadManager::OnPageChanged(nsIURI *aURI, PRUint32 aWhat,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDownloadManager::OnDeleteVisits(nsIURI *aURI, PRTime aVisitTime)
|
||||
nsDownloadManager::OnDeleteVisits(nsIURI *aURI, PRTime aVisitTime,
|
||||
const nsACString& aGUID)
|
||||
{
|
||||
// Don't bother removing downloads until the page is removed.
|
||||
return NS_OK;
|
||||
|
@ -464,7 +464,7 @@ public:
|
||||
mPlace.transitionType != nsINavHistoryService::TRANSITION_FRAMED_LINK) {
|
||||
navHistory->NotifyOnVisit(uri, mPlace.visitId, mPlace.visitTime,
|
||||
mPlace.sessionId, mReferrer.visitId,
|
||||
mPlace.transitionType);
|
||||
mPlace.transitionType, mPlace.guid);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIObserverService> obsService =
|
||||
@ -801,8 +801,9 @@ private:
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// We need the place id and guid of the page we just inserted when we
|
||||
// have a callback. No point in doing the disk I/O if we do not need it.
|
||||
if (mCallback) {
|
||||
// have a callback or when the GUID isn't known. No point in doing the
|
||||
// disk I/O if we do not need it.
|
||||
if (mCallback || aPlace.guid.IsEmpty()) {
|
||||
bool exists = mHistory->FetchPageInfo(aPlace);
|
||||
if (!exists) {
|
||||
NS_NOTREACHED("should have an entry in moz_places");
|
||||
|
@ -3045,7 +3045,8 @@ nsNavBookmarks::OnEndUpdateBatch()
|
||||
NS_IMETHODIMP
|
||||
nsNavBookmarks::OnVisit(nsIURI* aURI, PRInt64 aVisitId, PRTime aTime,
|
||||
PRInt64 aSessionID, PRInt64 aReferringID,
|
||||
PRUint32 aTransitionType, PRUint32* aAdded)
|
||||
PRUint32 aTransitionType, const nsACString& aGUID,
|
||||
PRUint32* aAdded)
|
||||
{
|
||||
// If the page is bookmarked, notify observers for each associated bookmark.
|
||||
ItemVisitData visitData;
|
||||
@ -3063,14 +3064,14 @@ nsNavBookmarks::OnVisit(nsIURI* aURI, PRInt64 aVisitId, PRTime aTime,
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNavBookmarks::OnBeforeDeleteURI(nsIURI* aURI)
|
||||
nsNavBookmarks::OnBeforeDeleteURI(nsIURI* aURI, const nsACString& aGUID)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNavBookmarks::OnDeleteURI(nsIURI* aURI)
|
||||
nsNavBookmarks::OnDeleteURI(nsIURI* aURI, const nsACString& aGUID)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
nsNavHistory* history = nsNavHistory::GetHistoryService();
|
||||
@ -3148,7 +3149,8 @@ nsNavBookmarks::OnPageChanged(nsIURI* aURI, PRUint32 aWhat,
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNavBookmarks::OnDeleteVisits(nsIURI* aURI, PRTime aVisitTime)
|
||||
nsNavBookmarks::OnDeleteVisits(nsIURI* aURI, PRTime aVisitTime,
|
||||
const nsACString& aGUID)
|
||||
{
|
||||
// Notify "cleartime" only if all visits to the page have been removed.
|
||||
if (!aVisitTime) {
|
||||
|
@ -28,6 +28,7 @@
|
||||
* Michael Ventnor <m.ventnor@gmail.com>
|
||||
* Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
||||
* Drew Willcoxon <adw@mozilla.com>
|
||||
* Philipp von Weitershausen <philipp@weitershausen.de>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
@ -1193,8 +1194,10 @@ nsNavHistory::GetStatement(const nsCOMPtr<mozIStorageStatement>& aStmt)
|
||||
if (!mCanNotify)
|
||||
return nsnull;
|
||||
|
||||
// Note that this query violates the kGetInfoIndex_* convention in
|
||||
// the last column.
|
||||
RETURN_IF_STMT(mDBGetURLPageInfo, NS_LITERAL_CSTRING(
|
||||
"SELECT id, url, title, rev_host, visit_count "
|
||||
"SELECT id, url, title, rev_host, visit_count, guid "
|
||||
"FROM moz_places "
|
||||
"WHERE url = :page_url "
|
||||
));
|
||||
@ -1226,7 +1229,7 @@ nsNavHistory::GetStatement(const nsCOMPtr<mozIStorageStatement>& aStmt)
|
||||
));
|
||||
|
||||
RETURN_IF_STMT(mDBGetPageVisitStats, NS_LITERAL_CSTRING(
|
||||
"SELECT id, visit_count, typed, hidden "
|
||||
"SELECT id, visit_count, typed, hidden, guid "
|
||||
"FROM moz_places "
|
||||
"WHERE url = :page_url "
|
||||
));
|
||||
@ -1722,7 +1725,8 @@ nsNavHistory::GetUrlIdFor(nsIURI* aURI, PRInt64* aEntryID,
|
||||
// create a new hidden, untyped, unvisited entry
|
||||
nsAutoString voidString;
|
||||
voidString.SetIsVoid(PR_TRUE);
|
||||
return InternalAddNewPage(aURI, voidString, PR_TRUE, PR_FALSE, 0, PR_TRUE, aEntryID);
|
||||
nsCAutoString guid;
|
||||
return InternalAddNewPage(aURI, voidString, PR_TRUE, PR_FALSE, 0, PR_TRUE, aEntryID, guid);
|
||||
}
|
||||
|
||||
// Doesn't exist: don't do anything, entry ID was already set to 0 above
|
||||
@ -1748,7 +1752,8 @@ nsNavHistory::InternalAddNewPage(nsIURI* aURI,
|
||||
PRBool aTyped,
|
||||
PRInt32 aVisitCount,
|
||||
PRBool aCalculateFrecency,
|
||||
PRInt64* aPageID)
|
||||
PRInt64* aPageID,
|
||||
nsACString& guid)
|
||||
{
|
||||
DECLARE_AND_ASSIGN_SCOPED_LAZY_STMT(stmt, mDBAddNewPage);
|
||||
nsresult rv = URIBinder::Bind(stmt, NS_LITERAL_CSTRING("page_url"), aURI);
|
||||
@ -1800,6 +1805,8 @@ nsNavHistory::InternalAddNewPage(nsIURI* aURI,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ASSERTION(hasResult, "hasResult is false but the call succeeded?");
|
||||
pageId = getIdStmt->AsInt64(0);
|
||||
rv = getIdStmt->GetUTF8String(5, guid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (aCalculateFrecency) {
|
||||
@ -2024,13 +2031,15 @@ nsNavHistory::NotifyOnVisit(nsIURI* aURI,
|
||||
PRTime aTime,
|
||||
PRInt64 aSessionID,
|
||||
PRInt64 referringVisitID,
|
||||
PRInt32 aTransitionType)
|
||||
PRInt32 aTransitionType,
|
||||
const nsACString& aGUID)
|
||||
{
|
||||
PRUint32 added = 0;
|
||||
MOZ_ASSERT(!aGUID.IsEmpty());
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver,
|
||||
OnVisit(aURI, aVisitID, aTime, aSessionID,
|
||||
referringVisitID, aTransitionType, &added));
|
||||
referringVisitID, aTransitionType, aGUID, &added));
|
||||
}
|
||||
|
||||
void
|
||||
@ -2606,6 +2615,7 @@ nsNavHistory::AddVisit(nsIURI* aURI, PRTime aTime, nsIURI* aReferringURI,
|
||||
rv = stmt->ExecuteStep(&alreadyVisited);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCAutoString guid;
|
||||
PRInt64 pageID = 0;
|
||||
PRInt32 hidden;
|
||||
PRInt32 typed;
|
||||
@ -2627,6 +2637,9 @@ nsNavHistory::AddVisit(nsIURI* aURI, PRTime aTime, nsIURI* aReferringURI,
|
||||
rv = stmt->GetInt32(3, &oldHiddenState);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = stmt->GetUTF8String(4, guid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// free the previous statement before we make a new one
|
||||
stmt->Reset();
|
||||
scoper.Abandon();
|
||||
@ -2681,7 +2694,7 @@ nsNavHistory::AddVisit(nsIURI* aURI, PRTime aTime, nsIURI* aReferringURI,
|
||||
nsString voidString;
|
||||
voidString.SetIsVoid(PR_TRUE);
|
||||
rv = InternalAddNewPage(aURI, voidString, hidden == 1, typed == 1, 1,
|
||||
PR_TRUE, &pageID);
|
||||
PR_TRUE, &pageID, guid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
@ -2716,7 +2729,7 @@ nsNavHistory::AddVisit(nsIURI* aURI, PRTime aTime, nsIURI* aReferringURI,
|
||||
// FIXME bug 325241: make a way to observe hidden URLs
|
||||
if (!hidden) {
|
||||
NotifyOnVisit(aURI, *aVisitID, aTime, aSessionID, referringVisitID,
|
||||
aTransitionType);
|
||||
aTransitionType, guid);
|
||||
}
|
||||
|
||||
// Normally docshell sends the link visited observer notification for us (this
|
||||
@ -4169,16 +4182,17 @@ nsNavHistory::CleanupPlacesOnVisitsDelete(const nsCString& aPlaceIdsQueryString)
|
||||
// Collect about-to-be-deleted URIs to notify onDeleteURI.
|
||||
nsCOMPtr<mozIStorageStatement> stmt;
|
||||
mDBConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"SELECT h.id, h.url, (SUBSTR(h.url, 1, 6) <> 'place:' "
|
||||
"AND NOT EXISTS (SELECT b.id FROM moz_bookmarks b "
|
||||
"WHERE b.fk = h.id LIMIT 1)"
|
||||
") as whole_entry "
|
||||
"SELECT h.id, h.url, h.guid, "
|
||||
"(SUBSTR(h.url, 1, 6) <> 'place:' "
|
||||
" AND NOT EXISTS (SELECT b.id FROM moz_bookmarks b "
|
||||
"WHERE b.fk = h.id LIMIT 1)) as whole_entry "
|
||||
"FROM moz_places h "
|
||||
"WHERE h.id IN ( ") + aPlaceIdsQueryString + NS_LITERAL_CSTRING(") "
|
||||
), getter_AddRefs(stmt));
|
||||
NS_ENSURE_STATE(stmt);
|
||||
nsCString filteredPlaceIds;
|
||||
nsCOMArray<nsIURI> URIs;
|
||||
nsTArray<nsCString> GUIDs;
|
||||
PRBool hasMore;
|
||||
while (NS_SUCCEEDED(stmt->ExecuteStep(&hasMore)) && hasMore) {
|
||||
PRInt64 placeId;
|
||||
@ -4186,8 +4200,10 @@ nsNavHistory::CleanupPlacesOnVisitsDelete(const nsCString& aPlaceIdsQueryString)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCAutoString URLString;
|
||||
rv = stmt->GetUTF8String(1, URLString);
|
||||
nsCString guid;
|
||||
rv = stmt->GetUTF8String(2, guid);
|
||||
PRInt32 wholeEntry;
|
||||
rv = stmt->GetInt32(2, &wholeEntry);
|
||||
rv = stmt->GetInt32(3, &wholeEntry);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = NS_NewURI(getter_AddRefs(uri), URLString);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -4197,15 +4213,16 @@ nsNavHistory::CleanupPlacesOnVisitsDelete(const nsCString& aPlaceIdsQueryString)
|
||||
}
|
||||
filteredPlaceIds.AppendInt(placeId);
|
||||
URIs.AppendObject(uri);
|
||||
GUIDs.AppendElement(guid);
|
||||
// Notify we are about to remove this uri.
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnBeforeDeleteURI(uri));
|
||||
nsINavHistoryObserver, OnBeforeDeleteURI(uri, guid));
|
||||
}
|
||||
else {
|
||||
// Notify that we will delete all visits for this page, but not the page
|
||||
// itself, since it's bookmarked or a place: query.
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnDeleteVisits(uri, 0));
|
||||
nsINavHistoryObserver, OnDeleteVisits(uri, 0, guid));
|
||||
}
|
||||
}
|
||||
|
||||
@ -4228,7 +4245,7 @@ nsNavHistory::CleanupPlacesOnVisitsDelete(const nsCString& aPlaceIdsQueryString)
|
||||
// Finally notify about the removed URIs.
|
||||
for (PRInt32 i = 0; i < URIs.Count(); ++i) {
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnDeleteURI(URIs[i]));
|
||||
nsINavHistoryObserver, OnDeleteURI(URIs[i], GUIDs[i]));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -5351,20 +5368,21 @@ nsNavHistory::AsyncExecuteLegacyQueries(nsINavHistoryQuery** aQueries,
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNavHistory::NotifyOnPageExpired(nsIURI *aURI, PRTime aVisitTime,
|
||||
PRBool aWholeEntry)
|
||||
PRBool aWholeEntry, const nsACString& aGUID)
|
||||
{
|
||||
// Invalidate the cached value for whether there's history or not.
|
||||
mHasHistoryEntries = -1;
|
||||
|
||||
MOZ_ASSERT(!aGUID.IsEmpty());
|
||||
if (aWholeEntry) {
|
||||
// Notify our observers that the page has been removed.
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnDeleteURI(aURI));
|
||||
nsINavHistoryObserver, OnDeleteURI(aURI, aGUID));
|
||||
}
|
||||
else {
|
||||
// Notify our observers that some visits for the page have been removed.
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnDeleteVisits(aURI, aVisitTime));
|
||||
nsINavHistoryObserver, OnDeleteVisits(aURI, aVisitTime, aGUID));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -6840,6 +6858,7 @@ nsNavHistory::AddPageWithVisits(nsIURI *aURI,
|
||||
PRInt32 typed = 0;
|
||||
PRInt32 hidden = 0;
|
||||
|
||||
nsCAutoString guid;
|
||||
if (alreadyVisited) {
|
||||
// Update the existing entry
|
||||
rv = stmt->GetInt64(0, &placeId);
|
||||
@ -6849,6 +6868,8 @@ nsNavHistory::AddPageWithVisits(nsIURI *aURI,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = stmt->GetInt32(3, &hidden);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = stmt->GetUTF8String(4, guid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (typed == 0 && aTransitionType == TRANSITION_TYPED) {
|
||||
typed = 1;
|
||||
@ -6868,7 +6889,7 @@ nsNavHistory::AddPageWithVisits(nsIURI *aURI,
|
||||
// Insert the new place entry
|
||||
rv = InternalAddNewPage(aURI, aTitle, hidden == 1,
|
||||
aTransitionType == TRANSITION_TYPED, 0,
|
||||
PR_FALSE, &placeId);
|
||||
PR_FALSE, &placeId, guid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
@ -595,12 +595,14 @@ public:
|
||||
PRTime aTime,
|
||||
PRInt64 aSessionID,
|
||||
PRInt64 referringVisitID,
|
||||
PRInt32 aTransitionType);
|
||||
PRInt32 aTransitionType,
|
||||
const nsACString& aGUID);
|
||||
|
||||
/**
|
||||
* Fires onTitleChanged event to nsINavHistoryService observers
|
||||
*/
|
||||
void NotifyTitleChange(nsIURI* aURI, const nsString& title);
|
||||
void NotifyTitleChange(nsIURI* aURI,
|
||||
const nsString& title);
|
||||
|
||||
bool isBatching() {
|
||||
return mBatchLevel > 0;
|
||||
@ -732,7 +734,7 @@ protected:
|
||||
nsresult InternalAddNewPage(nsIURI* aURI, const nsAString& aTitle,
|
||||
PRBool aHidden, PRBool aTyped,
|
||||
PRInt32 aVisitCount, PRBool aCalculateFrecency,
|
||||
PRInt64* aPageID);
|
||||
PRInt64* aPageID, nsACString& guid);
|
||||
nsresult InternalAddVisit(PRInt64 aPageID, PRInt64 aReferringVisit,
|
||||
PRInt64 aSessionID, PRTime aTime,
|
||||
PRInt32 aTransitionType, PRInt64* aVisitID);
|
||||
|
@ -2879,6 +2879,7 @@ nsNavHistoryQueryResultNode::OnVisit(nsIURI* aURI, PRInt64 aVisitId,
|
||||
PRTime aTime, PRInt64 aSessionId,
|
||||
PRInt64 aReferringId,
|
||||
PRUint32 aTransitionType,
|
||||
const nsACString& aGUID,
|
||||
PRUint32* aAdded)
|
||||
{
|
||||
nsNavHistory* history = nsNavHistory::GetHistoryService();
|
||||
@ -3061,7 +3062,8 @@ nsNavHistoryQueryResultNode::OnTitleChanged(nsIURI* aURI,
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNavHistoryQueryResultNode::OnBeforeDeleteURI(nsIURI *aURI)
|
||||
nsNavHistoryQueryResultNode::OnBeforeDeleteURI(nsIURI *aURI,
|
||||
const nsACString& aGUID)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
@ -3071,7 +3073,8 @@ nsNavHistoryQueryResultNode::OnBeforeDeleteURI(nsIURI *aURI)
|
||||
* the given URI.
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsNavHistoryQueryResultNode::OnDeleteURI(nsIURI *aURI)
|
||||
nsNavHistoryQueryResultNode::OnDeleteURI(nsIURI *aURI,
|
||||
const nsACString& aGUID)
|
||||
{
|
||||
if (IsContainersQuery()) {
|
||||
// Incremental updates of query returning queries are pretty much
|
||||
@ -3165,7 +3168,8 @@ nsNavHistoryQueryResultNode::OnPageChanged(nsIURI *aURI, PRUint32 aWhat,
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNavHistoryQueryResultNode::OnDeleteVisits(nsIURI* aURI, PRTime aVisitTime)
|
||||
nsNavHistoryQueryResultNode::OnDeleteVisits(nsIURI* aURI, PRTime aVisitTime,
|
||||
const nsACString& aGUID)
|
||||
{
|
||||
NS_PRECONDITION(mOptions->QueryType() == nsINavHistoryQueryOptions::QUERY_TYPE_HISTORY,
|
||||
"Bookmarks queries should not get a OnDeleteVisits notification");
|
||||
@ -3173,7 +3177,7 @@ nsNavHistoryQueryResultNode::OnDeleteVisits(nsIURI* aURI, PRTime aVisitTime)
|
||||
// All visits for this uri have been removed, but the uri won't be removed
|
||||
// from the databse, most likely because it's a bookmark. For a history
|
||||
// query this is equivalent to a onDeleteURI notification.
|
||||
nsresult rv = OnDeleteURI(aURI);
|
||||
nsresult rv = OnDeleteURI(aURI, aGUID);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
@ -5064,12 +5068,14 @@ nsNavHistoryResult::OnItemMoved(PRInt64 aItemId,
|
||||
NS_IMETHODIMP
|
||||
nsNavHistoryResult::OnVisit(nsIURI* aURI, PRInt64 aVisitId, PRTime aTime,
|
||||
PRInt64 aSessionId, PRInt64 aReferringId,
|
||||
PRUint32 aTransitionType, PRUint32* aAdded)
|
||||
PRUint32 aTransitionType, const nsACString& aGUID,
|
||||
PRUint32* aAdded)
|
||||
{
|
||||
PRUint32 added = 0;
|
||||
|
||||
ENUMERATE_HISTORY_OBSERVERS(OnVisit(aURI, aVisitId, aTime, aSessionId,
|
||||
aReferringId, aTransitionType, &added));
|
||||
aReferringId, aTransitionType, aGUID,
|
||||
&added));
|
||||
|
||||
if (!mRootNode->mExpanded)
|
||||
return NS_OK;
|
||||
@ -5130,16 +5136,16 @@ nsNavHistoryResult::OnTitleChanged(nsIURI* aURI, const nsAString& aPageTitle)
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNavHistoryResult::OnBeforeDeleteURI(nsIURI *aURI)
|
||||
nsNavHistoryResult::OnBeforeDeleteURI(nsIURI *aURI, const nsACString& aGUID)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNavHistoryResult::OnDeleteURI(nsIURI *aURI)
|
||||
nsNavHistoryResult::OnDeleteURI(nsIURI *aURI, const nsACString& aGUID)
|
||||
{
|
||||
ENUMERATE_HISTORY_OBSERVERS(OnDeleteURI(aURI));
|
||||
ENUMERATE_HISTORY_OBSERVERS(OnDeleteURI(aURI, aGUID));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -5165,8 +5171,9 @@ nsNavHistoryResult::OnPageChanged(nsIURI *aURI,
|
||||
* Don't do anything when visits expire.
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsNavHistoryResult::OnDeleteVisits(nsIURI* aURI, PRTime aVisitTime)
|
||||
nsNavHistoryResult::OnDeleteVisits(nsIURI* aURI, PRTime aVisitTime,
|
||||
const nsACString& aGUID)
|
||||
{
|
||||
ENUMERATE_HISTORY_OBSERVERS(OnDeleteVisits(aURI, aVisitTime));
|
||||
ENUMERATE_HISTORY_OBSERVERS(OnDeleteVisits(aURI, aVisitTime, aGUID));
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -98,14 +98,16 @@ private:
|
||||
NS_DECL_NSINAVBOOKMARKOBSERVER \
|
||||
NS_IMETHOD OnVisit(nsIURI* aURI, PRInt64 aVisitId, PRTime aTime, \
|
||||
PRInt64 aSessionId, PRInt64 aReferringId, \
|
||||
PRUint32 aTransitionType, PRUint32* aAdded); \
|
||||
PRUint32 aTransitionType, const nsACString& aGUID, \
|
||||
PRUint32* aAdded); \
|
||||
NS_IMETHOD OnTitleChanged(nsIURI* aURI, const nsAString& aPageTitle); \
|
||||
NS_IMETHOD OnBeforeDeleteURI(nsIURI *aURI); \
|
||||
NS_IMETHOD OnDeleteURI(nsIURI *aURI); \
|
||||
NS_IMETHOD OnBeforeDeleteURI(nsIURI *aURI, const nsACString& aGUID); \
|
||||
NS_IMETHOD OnDeleteURI(nsIURI *aURI, const nsACString& aGUID); \
|
||||
NS_IMETHOD OnClearHistory(); \
|
||||
NS_IMETHOD OnPageChanged(nsIURI *aURI, PRUint32 aWhat, \
|
||||
const nsAString &aValue); \
|
||||
NS_IMETHOD OnDeleteVisits(nsIURI* aURI, PRTime aVisitTime);
|
||||
NS_IMETHOD OnDeleteVisits(nsIURI* aURI, PRTime aVisitTime, \
|
||||
const nsACString& aGUID);
|
||||
|
||||
// nsNavHistoryResult
|
||||
//
|
||||
|
@ -212,8 +212,8 @@ const EXPIRATION_QUERIES = {
|
||||
// unique URIs limit.
|
||||
QUERY_FIND_VISITS_TO_EXPIRE: {
|
||||
sql: "INSERT INTO expiration_notify "
|
||||
+ "(v_id, url, visit_date, expected_results) "
|
||||
+ "SELECT v.id, h.url, v.visit_date, :limit_visits "
|
||||
+ "(v_id, url, guid, visit_date, expected_results) "
|
||||
+ "SELECT v.id, h.url, h.guid, v.visit_date, :limit_visits "
|
||||
+ "FROM moz_historyvisits v "
|
||||
+ "JOIN moz_places h ON h.id = v.place_id "
|
||||
+ "WHERE (SELECT COUNT(*) FROM moz_places) > :max_uris "
|
||||
@ -237,8 +237,8 @@ const EXPIRATION_QUERIES = {
|
||||
// run this query in such a case, but just delete URIs.
|
||||
QUERY_FIND_URIS_TO_EXPIRE: {
|
||||
sql: "INSERT INTO expiration_notify "
|
||||
+ "(p_id, url, visit_date, expected_results) "
|
||||
+ "SELECT h.id, h.url, h.last_visit_date, :limit_uris "
|
||||
+ "(p_id, url, guid, visit_date, expected_results) "
|
||||
+ "SELECT h.id, h.url, h.guid, h.last_visit_date, :limit_uris "
|
||||
+ "FROM moz_places h "
|
||||
+ "LEFT JOIN moz_historyvisits v ON h.id = v.place_id "
|
||||
+ "LEFT JOIN moz_bookmarks b ON h.id = b.fk "
|
||||
@ -388,7 +388,7 @@ const EXPIRATION_QUERIES = {
|
||||
// If p_id is set whole_entry = 1, then we have expired the full page.
|
||||
// Either p_id or v_id are always set.
|
||||
QUERY_SELECT_NOTIFICATIONS: {
|
||||
sql: "SELECT url, MAX(visit_date) AS visit_date, "
|
||||
sql: "SELECT url, guid, MAX(visit_date) AS visit_date, "
|
||||
+ "MAX(IFNULL(MIN(p_id, 1), MIN(v_id, 0))) AS whole_entry, "
|
||||
+ "expected_results "
|
||||
+ "FROM expiration_notify "
|
||||
@ -449,6 +449,7 @@ function nsPlacesExpiration()
|
||||
+ ", v_id INTEGER "
|
||||
+ ", p_id INTEGER "
|
||||
+ ", url TEXT NOT NULL "
|
||||
+ ", guid TEXT NOT NULL "
|
||||
+ ", visit_date INTEGER "
|
||||
+ ", expected_results INTEGER NOT NULL "
|
||||
+ ") ");
|
||||
@ -632,10 +633,11 @@ nsPlacesExpiration.prototype = {
|
||||
this._expectedResultsCount--;
|
||||
|
||||
let uri = Services.io.newURI(row.getResultByName("url"), null, null);
|
||||
let guid = row.getResultByName("guid");
|
||||
let visitDate = row.getResultByName("visit_date");
|
||||
let wholeEntry = row.getResultByName("whole_entry");
|
||||
// Dispatch expiration notifications to history.
|
||||
this._hsn.notifyOnPageExpired(uri, visitDate, wholeEntry);
|
||||
this._hsn.notifyOnPageExpired(uri, visitDate, wholeEntry, guid);
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user