Bug 788119 - Don't even parse home pages in Reader's worker thread (r=mfinkle)

This commit is contained in:
Lucas Rocha 2012-09-06 18:55:24 +01:00
Родитель 16dfbb3811
Коммит 08d07b16af
2 изменённых файлов: 15 добавлений и 7 удалений

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

@ -1408,11 +1408,6 @@ Readability.prototype = {
* @return void
**/
parse: function () {
let uri = this._uri;
if ((uri.prePath + "/") === uri.spec) {
return null;
}
// Remove script tags from the document.
this._removeScripts(this._doc);

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

@ -6676,8 +6676,7 @@ let Reader = {
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);
if (!this._shouldCheckUri(uri)) {
callback(null);
return;
}
@ -6804,6 +6803,20 @@ let Reader = {
dump("Reader: " + msg);
},
_shouldCheckUri: function Reader_shouldCheckUri(uri) {
if ((uri.prePath + "/") === uri.spec) {
this.log("Not parsing home page: " + uri.spec);
return false;
}
if (!(uri.schemeIs("http") || uri.schemeIs("https") || uri.schemeIs("file"))) {
this.log("Not parsing URI scheme: " + uri.scheme);
return false;
}
return true;
},
_readerParse: function Reader_readerParse(uri, doc, callback) {
let numTags = doc.getElementsByTagName("*").length;
if (numTags > this.MAX_ELEMS_TO_PARSE) {