Bug 296952 - Improve Phishing Detector to recognize host names of the same domain (address review comments); r=mkmelin

This commit is contained in:
Jim Porter 2014-01-27 20:12:14 -06:00
Родитель e325890ffc
Коммит 71db0b6da8
2 изменённых файлов: 6 добавлений и 13 удалений

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

@ -24,9 +24,9 @@ var gPhishingDetector = {
},
/**
* initialize the phishing warden.
* initialize the black and white list url tables.
* update the local tables if necessary
* Initialize the phishing warden.
* Initialize the black and white list url tables.
* Update the local tables if necessary.
*/
init: function()
{
@ -223,17 +223,14 @@ var gPhishingDetector = {
aLinkNodeText = aLinkNodeText.replace(/ /g, "");
// Only worry about http: and https: urls.
if (aLinkNodeText && aLinkNodeText.search(/(^https?:)/) != -1)
if (/^https?:/.test(aLinkNodeText))
{
let eTLD = Components.classes["@mozilla.org/network/effective-tld-service;1"]
.getService(Components.interfaces.nsIEffectiveTLDService);
let linkTextURI = Services.io.newURI(aLinkNodeText, null, null);
// Compare the base domain of the href and the link text.
try {
return eTLD.getBaseDomain(aHrefURL) !=
eTLD.getBaseDomain(linkTextURI);
return Services.eTLD.getBaseDomain(aHrefURL) !=
Services.eTLD.getBaseDomain(linkTextURI);
} catch (e) {
// If we throw above, one of the URIs probably has no TLD (e.g.
// http://localhost), so just check the entire host.

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

@ -151,7 +151,3 @@ function test_phishing_warning_for_local_domain() {
select_click_row(5);
assert_notification_displayed(mc, kBoxId, kNotificationValue, true); // shown
}