From 08d57c6379496c8cbb4c86c528776c5abe1db526 Mon Sep 17 00:00:00 2001 From: Brian Nicholson Date: Fri, 13 Jul 2012 12:54:52 -0700 Subject: [PATCH] Bug 773556 - Check URI scheme for readability. r=mfinkle --- mobile/android/chrome/content/browser.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 498c14ee77af..49c18dc46836 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -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();