Bug 901952 - RSS live bookmark history should get updated after Recent history is cleared. r=mak

This commit is contained in:
Chirag Bhatia 2015-03-28 08:33:00 -04:00
parent c5ebe4d871
commit 677b4e1320

View File

@ -472,7 +472,11 @@ LivemarkService.prototype = {
onPageChanged: function () {}, onPageChanged: function () {},
onTitleChanged: function () {}, onTitleChanged: function () {},
onDeleteVisits: function () {}, onDeleteVisits: function () {},
onClearHistory: function () {}, onClearHistory() {
for each (let livemark in this._livemarks) {
livemark.updateURIVisitedStatus(null, false);
}
},
onDeleteURI: function PS_onDeleteURI(aURI) { onDeleteURI: function PS_onDeleteURI(aURI) {
for each (let livemark in this._livemarks) { for each (let livemark in this._livemarks) {
@ -803,11 +807,20 @@ Livemark.prototype = {
} }
}, },
/**
* Updates the visited status of nodes observing this livemark.
*
* @param aURI
* If provided will update nodes having the given uri,
* otherwise any node.
* @param aVisitedStatus
* Whether the nodes should be set as visited.
*/
updateURIVisitedStatus: updateURIVisitedStatus:
function LM_updateURIVisitedStatus(aURI, aVisitedStatus) function LM_updateURIVisitedStatus(aURI, aVisitedStatus)
{ {
for (let i = 0; i < this.children.length; i++) { for (let i = 0; i < this.children.length; i++) {
if (this.children[i].uri.equals(aURI)) { if (!aURI || this.children[i].uri.equals(aURI)) {
this.children[i].visited = aVisitedStatus; this.children[i].visited = aVisitedStatus;
} }
} }
@ -819,7 +832,7 @@ Livemark.prototype = {
let nodes = this._nodes.get(container); let nodes = this._nodes.get(container);
for (let j = 0; j < nodes.length; j++) { for (let j = 0; j < nodes.length; j++) {
let node = nodes[j]; let node = nodes[j];
if (node.uri == aURI.spec) { if (!aURI || node.uri == aURI.spec) {
Services.tm.mainThread.dispatch((function () { Services.tm.mainThread.dispatch((function () {
observer.nodeHistoryDetailsChanged(node, 0, aVisitedStatus); observer.nodeHistoryDetailsChanged(node, 0, aVisitedStatus);
}).bind(this), Ci.nsIThread.DISPATCH_NORMAL); }).bind(this), Ci.nsIThread.DISPATCH_NORMAL);