Bug 365384 - Handle exception from newURI. r=IanN a=IanN
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Thu, 05 Jul 2018 19:15:03 +0200
changeset 28260 7387dbe5eda5e9e4d8d2d100e6695acf64a3b214
parent 28259 ea267e2e930dab08040ec0a490f67d68c623c4d7
child 28266 eb5d99108c1a5080566a459722ceccc2dac629e5
push id2095
push userfrgrahl@gmx.net
push dateThu, 05 Jul 2018 17:16:51 +0000
treeherdercomm-esr52@7387dbe5eda5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN, IanN
bugs365384
Bug 365384 - Handle exception from newURI. r=IanN a=IanN
suite/mailnews/phishingDetector.js
--- a/suite/mailnews/phishingDetector.js
+++ b/suite/mailnews/phishingDetector.js
@@ -84,17 +84,21 @@ function isPhishingURL(aLinkNode, aSilen
   var phishingType = kPhishingNotSuspicious;
   var href = aHref || aLinkNode.href;
   if (!href)
     return false;
 
   var linkTextURL = {};
   var isPhishingURL = false;
 
-  var hrefURL = Services.io.newURI(href, null, null);
+  var hrefURL;
+  // Make sure relative link urls don't make us bail out.
+  try {
+    hrefURL = Services.io.newURI(href, null, null);
+  } catch(ex) { return false; }
 
   // only check for phishing urls if the url is an http or https link.
   // this prevents us from flagging imap and other internally handled urls
   if (hrefURL.schemeIs('http') || hrefURL.schemeIs('https'))
   {
     let ipAddress = isLegalIPAddress(hrefURL.host, true);
     if (ipAddress && !isLegalLocalIPAddress(ipAddress))
       phishingType = kPhishingWithIPAddress;