diff --git a/mozilla/mailnews/base/resources/content/mailWindow.js b/mozilla/mailnews/base/resources/content/mailWindow.js index 0282beefa54..82bd3de9a20 100644 --- a/mozilla/mailnews/base/resources/content/mailWindow.js +++ b/mozilla/mailnews/base/resources/content/mailWindow.js @@ -232,11 +232,10 @@ function messagePaneOnClick(event) // try to determine the href for what you are clicking on. // for example, it might be "" if you aren't left clicking on a link - var ceParams = {event: event, href: "", linkNode: null}; - hrefAndLinkNodeForClickEvent(ceParams); - var href = ceParams.href; - if (!href) + var ceParams = hrefAndLinkNodeForClickEvent(event); + if (!ceParams) return true; + var href = ceParams.href; // we know that http://, https://, ftp://, file://, chrome://, // resource://, about:, and gopher:// (as if), @@ -269,7 +268,7 @@ function messagePaneOnClick(event) // we want to preventDefault, so that in // nsGenericHTMLElement::HandleDOMEventForAnchors(), we don't try to handle the click again event.preventDefault(); - if (isPhishingURL(ceParams.linkNode, false)) + if (isPhishingURL(ceParams.linkNode, false, href)) return false; openTopBrowserWith(href); diff --git a/mozilla/mailnews/base/resources/content/phishingDetector.js b/mozilla/mailnews/base/resources/content/phishingDetector.js index 66fe8bb4148..10d92af2c81 100755 --- a/mozilla/mailnews/base/resources/content/phishingDetector.js +++ b/mozilla/mailnews/base/resources/content/phishingDetector.js @@ -87,15 +87,16 @@ function isMsgEmailScam(aUrl) // the URL is an email scam. // aLinkNode: the link node to examine // aSilentMode: don't prompt the user to confirm +// aHref: optional href for XLinks ////////////////////////////////////////////////////////////////////////////// -function isPhishingURL(aLinkNode, aSilentMode) +function isPhishingURL(aLinkNode, aSilentMode, aHref) { if (!gPrefBranch.getBoolPref("mail.phishing.detection.enabled")) return false; var phishingType = kPhishingNotSuspicious; - var href = aLinkNode.href; + var href = aHref || aLinkNode.href; if (!href) return false; diff --git a/mozilla/xpfe/communicator/resources/content/contentAreaClick.js b/mozilla/xpfe/communicator/resources/content/contentAreaClick.js index e087441cd54..8eb0453d6ba 100644 --- a/mozilla/xpfe/communicator/resources/content/contentAreaClick.js +++ b/mozilla/xpfe/communicator/resources/content/contentAreaClick.js @@ -110,12 +110,11 @@ } } - function hrefAndLinkNodeForClickEvent(aParams) + function hrefAndLinkNodeForClickEvent(event) { - var event = aParams.event; var target = event.target; - var href = aParams.href; - var linkNode = aParams.linkNode; + var href = ""; + var linkNode = null; var isKeyPress = (event.type == "keypress"); @@ -162,8 +161,7 @@ } } - aParams.href = href; - aParams.linkNode = linkNode; + return href ? {href: href, linkNode: linkNode} : null; } // Called whenever the user clicks in the content area, @@ -176,20 +174,19 @@ } var isKeyPress = (event.type == "keypress"); - var ceParams = {event: event, href: "", linkNode: null}; - hrefAndLinkNodeForClickEvent(ceParams); - var href = ceParams.href; - if (href) { + var ceParams = hrefAndLinkNodeForClickEvent(event); + if (ceParams) { + var href = ceParams.href; if (isKeyPress) { openNewTabWith(href, true, event.shiftKey); event.preventBubble(); } else { - handleLinkClick(event, href, null); + handleLinkClick(event, href, ceParams.linkNode); // if in mailnews block the link left click if we determine // that this URL is phishy (i.e. a potential email scam) if ("gMessengerBundle" in this && !event.button) - return !isPhishingURL(ceParams.linkNode, false); + return !isPhishingURL(ceParams.linkNode, false, href); } return true; }