Bug 1678611: Remove onTitleChanged interface from nsINavHistoryService. r=mak,mixedpuppy

Depends on D98280

Differential Revision: https://phabricator.services.mozilla.com/D98281
This commit is contained in:
Daisuke Akatsuka 2020-12-18 07:25:49 +00:00
Родитель 62cb87a93f
Коммит 2b482f984d
25 изменённых файлов: 4 добавлений и 96 удалений

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

@ -104,9 +104,6 @@ const getHistoryObserver = () => {
}
onBeginUpdateBatch() {}
onEndUpdateBatch() {}
onTitleChanged(uri, title) {
this.emit("titleChanged", { url: uri.spec, title: title });
}
onClearHistory() {
this.emit("visitRemoved", { allHistory: true, urls: [] });
}

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

@ -80,8 +80,6 @@ class HistoryObserver extends Observer {
onEndUpdateBatch() {}
onTitleChanged() {}
onFrecencyChanged() {}
onManyFrecenciesChanged() {}

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

@ -753,7 +753,6 @@ describe("PlacesFeed", () => {
it("should have a various empty functions for xpconnect happiness", () => {
observer.onBeginUpdateBatch();
observer.onEndUpdateBatch();
observer.onTitleChanged();
observer.onFrecencyChanged();
observer.onManyFrecenciesChanged();
observer.onDeleteVisits();

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

@ -78,7 +78,6 @@ XPCOMUtils.defineLazyGetter(this, "gHistoryObserver", function() {
onBeginUpdateBatch() {},
onEndUpdateBatch() {},
onVisits() {},
onTitleChanged() {},
onFrecencyChanged() {},
onManyFrecenciesChanged() {},
onDeleteURI() {},

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

@ -610,6 +610,5 @@ HistoryTracker.prototype = {
onBeginUpdateBatch() {},
onEndUpdateBatch() {},
onTitleChanged() {},
onBeforeDeleteURI() {},
};

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

@ -633,7 +633,6 @@ async function promiseVisit(expectedType, expectedURI) {
},
onBeginUpdateBatch() {},
onEndUpdateBatch() {},
onTitleChanged() {},
onFrecencyChanged() {},
onManyFrecenciesChanged() {},
onDeleteURI(uri) {

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

@ -332,7 +332,6 @@ var DownloadCache = {
},
onBeginUpdateBatch() {},
onEndUpdateBatch() {},
onTitleChanged() {},
onFrecencyChanged() {},
onManyFrecenciesChanged() {},
onDeleteVisits() {},

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

@ -1267,7 +1267,6 @@ DownloadHistoryObserver.prototype = {
this._list.removeFinished();
},
onTitleChanged() {},
onBeginUpdateBatch() {},
onEndUpdateBatch() {},
onDeleteVisits() {},

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

@ -472,10 +472,6 @@ class NotifyManyVisitsObservers : public Runnable {
}
mHistory->NotifyVisited(aURI, IHistory::VisitedStatus::Visited);
if (aPlace.titleChanged) {
aNavHistory->NotifyTitleChange(aURI, aPlace.title, aPlace.guid);
}
aNavHistory->UpdateDaysOfHistory(aPlace.visitTime);
return NS_OK;
@ -586,16 +582,6 @@ class NotifyTitleObservers : public Runnable {
NS_IMETHOD Run() override {
MOZ_ASSERT(NS_IsMainThread(), "This should be called on the main thread");
nsNavHistory* navHistory = nsNavHistory::GetHistoryService();
NS_ENSURE_TRUE(navHistory, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsIURI> uri;
MOZ_ALWAYS_SUCCEEDS(NS_NewURI(getter_AddRefs(uri), mSpec));
if (!uri) {
return NS_ERROR_UNEXPECTED;
}
navHistory->NotifyTitleChange(uri, mTitle, mGUID);
RefPtr<PlacesVisitTitle> titleEvent = new PlacesVisitTitle();
titleEvent->mUrl.Assign(NS_ConvertUTF8toUTF16(mSpec));
titleEvent->mPageGuid.Assign(mGUID);

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

@ -588,7 +588,6 @@ nsPlacesExpiration.prototype = {
this.status = STATUS.CLEAN;
},
onTitleChanged() {},
onDeleteURI() {},
onDeleteVisits() {},

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

@ -579,30 +579,6 @@ interface nsINavHistoryObserver : nsISupports
*/
void onEndUpdateBatch();
/**
* Called whenever either the "real" title or the custom title of the page
* changed. BOTH TITLES ARE ALWAYS INCLUDED in this notification, even though
* only one will change at a time. Often, consumers will want to display the
* user title if it is available, and fall back to the page title (the one
* specified in the <title> tag of the page).
*
* Note that there is a difference between an empty title and a NULL title.
* An empty string means that somebody specifically set the title to be
* nothing. NULL means nobody set it. From C++: use IsVoid() and SetIsVoid()
* to see whether an empty string is "null" or not (it will always be an
* empty string in either case).
*
* @param aURI
* The URI of the page.
* @param aPageTitle
* The new title of the page.
* @param aGUID
* The unique ID associated with the page.
*/
void onTitleChanged(in nsIURI aURI,
in AString aPageTitle,
in ACString aGUID);
/**
* Called when an individual page's frecency has changed.
*

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

@ -601,11 +601,6 @@ void nsNavHistory::UpdateDaysOfHistory(PRTime visitTime) {
}
}
void nsNavHistory::NotifyTitleChange(nsIURI* aURI, const nsString& aTitle,
const nsACString& aGUID) {
MOZ_ASSERT(!aGUID.IsEmpty());
}
void nsNavHistory::NotifyFrecencyChanged(const nsACString& aSpec,
int32_t aNewFrecency,
const nsACString& aGUID, bool aHidden,

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

@ -345,12 +345,6 @@ class nsNavHistory final : public nsSupportsWeakReference,
*/
void UpdateDaysOfHistory(PRTime visitTime);
/**
* Fires onTitleChanged event to nsINavHistoryService observers
*/
void NotifyTitleChange(nsIURI* aURI, const nsString& title,
const nsACString& aGUID);
/**
* Fires onFrecencyChanged event to nsINavHistoryService observers
*/

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

@ -2186,10 +2186,8 @@ nsresult nsNavHistoryQueryResultNode::OnVisit(nsIURI* aURI, int64_t aVisitId,
* when the user visits the page, and then the title will be set asynchronously
* when the title element of the page is parsed.
*/
NS_IMETHODIMP
nsNavHistoryQueryResultNode::OnTitleChanged(nsIURI* aURI,
const nsAString& aPageTitle,
const nsACString& aGUID) {
nsresult nsNavHistoryQueryResultNode::OnTitleChanged(
nsIURI* aURI, const nsAString& aPageTitle, const nsACString& aGUID) {
if (!mExpanded) {
// When we are not expanded, we don't update, just invalidate and unhook.
// It would still be pretty easy to traverse the results and update the
@ -4219,15 +4217,6 @@ void nsNavHistoryResult::HandlePlacesEvent(const PlacesEventSequence& aEvents) {
}
}
NS_IMETHODIMP
nsNavHistoryResult::OnTitleChanged(nsIURI* aURI, const nsAString& aPageTitle,
const nsACString& aGUID) {
NS_ENSURE_ARG(aURI);
ENUMERATE_HISTORY_OBSERVERS(OnTitleChanged(aURI, aPageTitle, aGUID));
return NS_OK;
}
NS_IMETHODIMP
nsNavHistoryResult::OnFrecencyChanged(nsIURI* aURI, int32_t aNewFrecency,
const nsACString& aGUID, bool aHidden,

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

@ -64,8 +64,6 @@ class nsTrimInt64HashKey : public PLDHashEntryHdr {
// and nsINavHistoryObserver (some methods, such as BeginUpdateBatch overlap)
#define NS_DECL_BOOKMARK_HISTORY_OBSERVER_BASE(...) \
NS_DECL_NSINAVBOOKMARKOBSERVER \
NS_IMETHOD OnTitleChanged(nsIURI* aURI, const nsAString& aPageTitle, \
const nsACString& aGUID) __VA_ARGS__; \
NS_IMETHOD OnFrecencyChanged(nsIURI* aURI, int32_t aNewFrecency, \
const nsACString& aGUID, bool aHidden, \
PRTime aLastVisitDate) __VA_ARGS__; \
@ -710,6 +708,8 @@ class nsNavHistoryQueryResultNode final
// the history result creates a new query node dynamically.
nsresult OnVisit(nsIURI* aURI, int64_t aVisitId, PRTime aTime,
uint32_t aTransitionType, bool aHidden, uint32_t* aAdded);
nsresult OnTitleChanged(nsIURI* aURI, const nsAString& aPageTitle,
const nsACString& aGUID);
virtual void OnRemoving() override;
public:

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

@ -89,7 +89,6 @@ function NavHistoryObserver() {}
NavHistoryObserver.prototype = {
onBeginUpdateBatch() {},
onEndUpdateBatch() {},
onTitleChanged() {},
onDeleteURI() {},
onClearHistory() {},
onDeleteVisits() {},

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

@ -80,7 +80,6 @@ add_task(async function test_notifications_onDeleteURI() {
onBeginUpdateBatch: function PEX_onBeginUpdateBatch() {},
onEndUpdateBatch: function PEX_onEndUpdateBatch() {},
onClearHistory() {},
onTitleChanged() {},
onDeleteURI(aURI, aGUID, aReason) {
currentTest.receivedNotifications++;
// Check this uri was not bookmarked.

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

@ -115,7 +115,6 @@ add_task(async function test_notifications_onDeleteVisits() {
onBeginUpdateBatch: function PEX_onBeginUpdateBatch() {},
onEndUpdateBatch: function PEX_onEndUpdateBatch() {},
onClearHistory() {},
onTitleChanged() {},
onDeleteURI(aURI, aGUID, aReason) {
// Check this uri was not bookmarked.
Assert.equal(currentTest.bookmarks.indexOf(aURI.spec), -1);

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

@ -737,7 +737,6 @@ function NavHistoryObserver() {}
NavHistoryObserver.prototype = {
onBeginUpdateBatch() {},
onEndUpdateBatch() {},
onTitleChanged() {},
onDeleteURI() {},
onClearHistory() {},
onDeleteVisits() {},

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

@ -45,9 +45,6 @@ add_task(async function test_remove_single() {
observer = {
onBeginUpdateBatch() {},
onEndUpdateBatch() {},
onTitleChanged(aUri) {
reject(new Error("Unexpected call to onTitleChanged " + aUri.spec));
},
onClearHistory() {
reject("Unexpected call to onClearHistory");
},

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

@ -461,9 +461,6 @@ function getObserverPromise(bookmarkedUri) {
observer = {
onBeginUpdateBatch() {},
onEndUpdateBatch() {},
onTitleChanged(aUri) {
reject(new Error("Unexpected call to onTitleChanged"));
},
onClearHistory() {
reject(new Error("Unexpected call to onClearHistory"));
},

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

@ -84,9 +84,6 @@ add_task(async function test_remove_many() {
onVisits(aVisits) {
Assert.ok(false, "Unexpected call to onVisits " + aVisits.length);
},
onTitleChanged(aURI) {
Assert.ok(false, "Unexpected call to onTitleChanged " + aURI.spec);
},
onClearHistory() {
Assert.ok(false, "Unexpected call to onClearHistory");
},

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

@ -148,11 +148,6 @@ add_task(async function test_removeVisitsByFilter() {
deferred: PromiseUtils.defer(),
onBeginUpdateBatch() {},
onEndUpdateBatch() {},
onTitleChanged(uri) {
this.deferred.reject(
new Error("Unexpected call to onTitleChanged " + uri.spec)
);
},
onClearHistory() {
this.deferred.reject("Unexpected call to onClearHistory");
},

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

@ -9,7 +9,6 @@ function NavHistoryObserver() {}
NavHistoryObserver.prototype = {
onBeginUpdateBatch() {},
onEndUpdateBatch() {},
onTitleChanged() {},
onDeleteURI() {},
onClearHistory() {},
onDeleteVisits() {},

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

@ -871,7 +871,6 @@ var PageThumbsHistoryObserver = {
PageThumbsStorage.wipe();
},
onTitleChanged() {},
onBeginUpdateBatch() {},
onEndUpdateBatch() {},
onDeleteVisits() {},