зеркало из https://github.com/mozilla/gecko-dev.git
Bug #258465 --> work around a nasty RDF entity replacement bug to prevent certain RSS feed items
from getting duplicated every time you check a feed for new articles.
This commit is contained in:
Родитель
2a262ddd94
Коммит
650eb25d41
|
@ -173,10 +173,29 @@ FeedItem.prototype.isStored = function() {
|
|||
}
|
||||
|
||||
var ds = getItemsDS(server);
|
||||
var itemResource = rdf.GetResource(this.url || ("urn:" + this.id));
|
||||
var itemURI = this.url || ("urn:" + this.id);
|
||||
var itemResource = rdf.GetResource(itemURI);
|
||||
|
||||
var downloaded = ds.GetTarget(itemResource, FZ_STORED, true);
|
||||
if (!downloaded || downloaded.QueryInterface(Components.interfaces.nsIRDFLiteral).Value == "false")
|
||||
{
|
||||
// HACK ALERT: before we give up, try to work around an entity escaping bug in RDF
|
||||
// See Bug #258465 for more details
|
||||
itemURI = itemURI.replace(/</g, '<');
|
||||
itemURI = itemURI.replace(/>/g, '>');
|
||||
itemURI = itemURI.replace(/&/g, '&');
|
||||
itemURI = itemURI.replace(/"/g, '"');
|
||||
|
||||
debug('Failed to find item, trying entity replacement version: ' + itemURI);
|
||||
itemResource = rdf.GetResource(itemURI);
|
||||
downloaded = ds.GetTarget(itemResource, FZ_STORED, true);
|
||||
|
||||
if (downloaded)
|
||||
{
|
||||
debug(this.identity + " not stored");
|
||||
return true;
|
||||
}
|
||||
|
||||
debug(this.identity + " not stored");
|
||||
return false;
|
||||
}
|
||||
|
@ -219,10 +238,9 @@ FeedItem.prototype.markStored = function() {
|
|||
currentValue = ds.GetTarget(resource, FZ_STORED, true);
|
||||
ds.Change(resource, FZ_STORED, currentValue, RDF_LITERAL_TRUE);
|
||||
}
|
||||
else {
|
||||
else
|
||||
ds.Assert(resource, FZ_STORED, RDF_LITERAL_TRUE, true);
|
||||
}
|
||||
}
|
||||
|
||||
FeedItem.prototype.download = function() {
|
||||
this.request = new XMLHttpRequest();
|
||||
|
|
Загрузка…
Ссылка в новой задаче