From 901c68f10f163c2bada30a500eef2fa71142dbe9 Mon Sep 17 00:00:00 2001 From: "asqueella%gmail.com" Date: Tue, 20 Feb 2007 20:33:34 +0000 Subject: [PATCH] Bug 327226 - www prefix can confuse the phishing detector p=Magnus Melin r=iann, sr=mscott git-svn-id: svn://10.0.0.236/trunk@220597 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/mail/base/content/phishingDetector.js | 3 ++- mozilla/mailnews/base/resources/content/phishingDetector.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mozilla/mail/base/content/phishingDetector.js b/mozilla/mail/base/content/phishingDetector.js index 31ebbff7f35..523ab22e8ed 100644 --- a/mozilla/mail/base/content/phishingDetector.js +++ b/mozilla/mail/base/content/phishingDetector.js @@ -223,7 +223,8 @@ var gPhishingDetector = { { var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService); aLinkTextURL.value = ioService.newURI(aLinkNodeText, null, null); - return aHrefURL.host != aLinkTextURL.value.host; + // compare hosts, but ignore possible www. prefix + return !(aHrefURL.host.replace(/^www\./, "") == aLinkTextURL.value.host.replace(/^www\./, "")); } } diff --git a/mozilla/mailnews/base/resources/content/phishingDetector.js b/mozilla/mailnews/base/resources/content/phishingDetector.js index c36d30b38e3..688991686d0 100755 --- a/mozilla/mailnews/base/resources/content/phishingDetector.js +++ b/mozilla/mailnews/base/resources/content/phishingDetector.js @@ -153,7 +153,8 @@ function misMatchedHostWithLinkText(aLinkNode, aHrefURL, aLinkTextURL) var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService); var linkTextURL = ioService.newURI(linkNodeText, null, null); aLinkTextURL.value = linkTextURL; - return aHrefURL.host != linkTextURL.host; + // compare hosts, but ignore possible www. prefix + return !(aHrefURL.host.replace(/^www\./, "") == aLinkTextURL.value.host.replace(/^www\./, "")); } }