Bug 773556 - Check URI scheme for readability. r=mfinkle

This commit is contained in:
Brian Nicholson 2012-07-13 12:54:52 -07:00
Родитель 359d98077a
Коммит 08d57c6379
1 изменённых файлов: 7 добавлений и 1 удалений

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

@ -6302,6 +6302,13 @@ let Reader = {
let tab = BrowserApp.getTabForId(tabId);
let url = tab.browser.contentWindow.location.href;
let uri = Services.io.newURI(url, null, null);
if (!(uri.schemeIs("http") || uri.schemeIs("https") || uri.schemeIs("file"))) {
this.log("Not parsing URI scheme: " + uri.scheme);
callback(null);
return;
}
// First, try to find a cached parsed article in the DB
this.getArticleFromCache(url, function(article) {
@ -6315,7 +6322,6 @@ let Reader = {
// changes the document object in several ways to find the article
// in it.
let doc = tab.browser.contentWindow.document.cloneNode(true);
let uri = Services.io.newURI(url, null, null);
let readability = new Readability(uri, doc);
article = readability.parse();