[Pkg-mozext-commits] [sage-extension] 30/54: relative feed item uri fix, bug 7202
David Prévot
taffit at moszumanska.debian.org
Fri May 1 03:10:38 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to tag sage_1_3
in repository sage-extension.
commit ee1c53591d48aa0fb126f0a4ef57e73f6f569050
Author: Peter Andrews <petea at jhu.edu>
Date: Fri Oct 1 15:02:37 2004 +0000
relative feed item uri fix, bug 7202
---
src/sage/content/feedlib.js | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/sage/content/feedlib.js b/src/sage/content/feedlib.js
index 93ac359..a0b4d96 100644
--- a/src/sage/content/feedlib.js
+++ b/src/sage/content/feedlib.js
@@ -31,6 +31,9 @@ function Feed(feedXML) {
Feed.prototype.parseRSS = function() {
var feedXML = this.feedXML;
+
+ const nsIURIFixup = Components.interfaces.nsIURIFixup;
+ const URIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"].getService(nsIURIFixup);
var firstElement = feedXML.documentElement;
@@ -90,7 +93,7 @@ Feed.prototype.parseRSS = function() {
break;
case "link":
if(!item.link) {
- item.link = CommonFunc.getInnerText(j);
+ item.link = URIFixup.createFixupURI(this.link, nsIURIFixup.FIXUP_FLAG_NONE).resolve(CommonFunc.getInnerText(j));
}
break;
case "guid":
@@ -123,9 +126,8 @@ Feed.prototype.parseRSS = function() {
}
if(!item.link && guid) {
- item.link = guid;
+ item.link = URIFixup.createFixupURI(this.link, nsIURIFixup.FIXUP_FLAG_NONE).resolve(guid);
}
- // TODO: We should make the link absolute. Bug #7202
var tmpFeedItem = new FeedItem(item.title, item.link, item.content, item.pubDate);
@@ -143,6 +145,9 @@ Feed.prototype.parseAtom = function() {
var feedXML = this.feedXML;
+ const nsIURIFixup = Components.interfaces.nsIURIFixup;
+ const URIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"].getService(nsIURIFixup);
+
var firstElement = feedXML.documentElement;
if(firstElement.hasAttribute("version")) {
@@ -185,7 +190,7 @@ Feed.prototype.parseAtom = function() {
if(linkNodes.length) {
for (var j = 0; j < linkNodes.length; j++) {
if (linkNodes[j].getAttribute("rel").toLowerCase() == "alternate") {
- item.link = linkNodes[j].getAttribute("href");
+ item.link = URIFixup.createFixupURI(this.link, nsIURIFixup.FIXUP_FLAG_NONE).resolve(linkNodes[j].getAttribute("href"));
break;
}
}
@@ -223,8 +228,6 @@ Feed.prototype.parseAtom = function() {
item.content = CommonFunc.getInnerText(summaryNodes[0]);
}
- // TODO: This should make the link absolute. Bug #7202
-
var tmpFeedItem = new FeedItem(item.title, item.link, item.content, item.pubDate);
if(tmpFeedItem.hasPubDate()) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/sage-extension.git
More information about the Pkg-mozext-commits
mailing list