Bug 1471964 - Fix RSS feeds after Places observer redesign r=mak

1. Hold onto the weak callback reference inside livemarks so it
   doesn't get GC'd.
2. Update other consumers of updateURIVisitedStatus to use the
   string spec.

MozReview-Commit-ID: 2GOROCIJ4aA

--HG--
extra : rebase_source : e408ad53524d60f9e8ca07fa180d53b2a83dd643
This commit is contained in:
Doug Thayer 2018-06-28 13:39:00 -07:00
Родитель 4758d21e57
Коммит b7326c7d5f
1 изменённых файлов: 6 добавлений и 5 удалений

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

@ -15,9 +15,6 @@ XPCOMUtils.defineLazyGetter(this, "history", function() {
let livemarks = PlacesUtils.livemarks;
// Lazily add an history observer when it's actually needed.
PlacesUtils.history.addObserver(livemarks, true);
let listener = new PlacesWeakCallbackWrapper(
livemarks.handlePlacesEvents.bind(livemarks));
PlacesObservers.addListener(["page-visited"], listener);
return PlacesUtils.history;
});
@ -84,6 +81,10 @@ function LivemarkService() {
// Observe bookmarks but don't init the service just for that.
PlacesUtils.bookmarks.addObserver(this, true);
this._placesListener = new PlacesWeakCallbackWrapper(
this.handlePlacesEvents.bind(this));
PlacesObservers.addListener(["page-visited"], this._placesListener);
this._livemarksMap = null;
this._promiseLivemarksMapReady = Promise.resolve();
}
@ -426,7 +427,7 @@ LivemarkService.prototype = {
onDeleteURI(aURI) {
this._withLivemarksMap(livemarksMap => {
for (let livemark of livemarksMap.values()) {
livemark.updateURIVisitedStatus(aURI, false);
livemark.updateURIVisitedStatus(aURI.spec, false);
}
});
},
@ -609,7 +610,7 @@ Livemark.prototype = {
// Update visited status for each entry.
for (let child of this._children) {
history.hasVisits(child.uri).then(isVisited => {
this.updateURIVisitedStatus(child.uri, isVisited);
this.updateURIVisitedStatus(child.uri.spec, isVisited);
}).catch(Cu.reportError);
}