зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1164426 - build reader mode blocklist, r=margaret
--HG-- extra : rebase_source : f17054b616a47a70194a083d749c0858fe299864
This commit is contained in:
Родитель
ba7724eb4b
Коммит
4276f1730c
|
@ -282,6 +282,13 @@ this.ReaderMode = {
|
|||
dump("Reader: " + msg);
|
||||
},
|
||||
|
||||
_blockedHosts: [
|
||||
"twitter.com",
|
||||
"mail.google.com",
|
||||
"github.com",
|
||||
"reddit.com",
|
||||
],
|
||||
|
||||
_shouldCheckUri: function (uri) {
|
||||
if (!(uri.schemeIs("http") || uri.schemeIs("https") || uri.schemeIs("file"))) {
|
||||
this.log("Not parsing URI scheme: " + uri.scheme);
|
||||
|
@ -294,6 +301,12 @@ this.ReaderMode = {
|
|||
// If this doesn't work, presumably the URL is not well-formed or something
|
||||
return false;
|
||||
}
|
||||
// Sadly, some high-profile pages have false positives, so bail early for those:
|
||||
let asciiHost = uri.asciiHost;
|
||||
if (this._blockedHosts.some(blockedHost => asciiHost.endsWith(blockedHost))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!uri.filePath || uri.filePath == "/") {
|
||||
this.log("Not parsing home page: " + uri.spec);
|
||||
return false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче