[Pkg-mozext-commits] [sage-extension] 14/54: Testing the uri scheme in the feed discovery. Bug #7172
David Prévot
taffit at moszumanska.debian.org
Fri May 1 03:10:37 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 674560409a5107140c643f22c96aa9b87d208e3e
Author: Erik Arvidsson <erik.arvidsson at gmail.com>
Date: Sun Sep 19 10:22:10 2004 +0000
Testing the uri scheme in the feed discovery. Bug #7172
---
src/sage/content/discover_feeds.js | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/sage/content/discover_feeds.js b/src/sage/content/discover_feeds.js
index b9d4ea1..c7eb618 100644
--- a/src/sage/content/discover_feeds.js
+++ b/src/sage/content/discover_feeds.js
@@ -47,7 +47,7 @@ function init() {
var browserWindow = windowManager.getMostRecentWindow("navigator:browser").document.getElementById("content");
bookmarksTree = window.arguments[0];
-
+
var current_document = browserWindow.contentDocument;
document_host = current_document.location.host;
@@ -58,18 +58,23 @@ function init() {
possibleFeeds = new Array();
var links, c;
+ // Allowing file: might not seem good but the XMLHttpRequest will prevent
+ // access to the file system if needed.
+ var uriSchemeRe = /^(http|https|ftp|file):$/;
if(discoveryMode == "exhaustive") {
links = current_document.getElementsByTagName("a");
for(c = 0; c < links.length; c++) {
- if(links[c].href.match(/xml$|rss|rdf|atom|feed/i)) {
+ if(uriSchemeRe.test(links[c].protocol) && links[c].href.test(/xml$|rss|rdf|atom|feed/i)) {
possibleFeeds[links[c].href] = Array(links[c].href, "implicit");
}
}
} else {
links = current_document.getElementsByTagName("a");
for(c = 0; c < links.length; c++) {
- if(links[c].href.match(/xml$|rss|rdf|atom|feed/i) && links[c].href.match(new RegExp(document_host, "i"))) {
+ if(uriSchemeRe.test(links[c].protocol) &&
+ links[c].href.test(/xml$|rss|rdf|atom|feed/i) &&
+ links[c].host.test(new RegExp(document_host, "i"))) {
possibleFeeds[links[c].href] = Array(links[c].href, "implicit");
}
}
@@ -209,7 +214,7 @@ function addDiscoveredFeed(uri, feed) {
if(possibleFeeds[uri.spec][1] == "explicit") valuation += 100;
if(feedClass == "Feeds") valuation += 10;
if(feed.hasLastPubDate()) valuation += 1;
-
+
ds.Assert(rdfService.GetResource(schema + feedClass), rdfService.GetResource(schema + "child"), rdfService.GetResource(schema + uri.spec), true);
ds.Assert(rdfService.GetResource(schema + uri.spec), rdfService.GetResource(schema + "Title"), rdfService.GetLiteral(feed.getTitle()), true);
@@ -222,4 +227,4 @@ function addDiscoveredFeed(uri, feed) {
feedTree.builder.rebuild();
logMessage("discovered feed: " + uri.spec);
-}
\ No newline at end of file
+}
--
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