Bug 1509493 - Do not include unmatched ')' in email addresses r=BenB
☠☠ backed out by a0e0ae690520 ☠ ☠
authorFabian Henneke <fabian@henneke.me>
Thu, 29 Nov 2018 14:04:57 +0000
changeset 505182 6498765e1d6544fc962945e2f0873356434f4bd9
parent 505181 5e4a5cf81c26fc19a52f9e39e42f0f2470d80774
child 505183 05562b7d3effc75bba30fb7f02175162f1484816
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBenB
bugs1509493
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1509493 - Do not include unmatched ')' in email addresses r=BenB Differential Revision: https://phabricator.services.mozilla.com/D13390
netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
netwerk/test/unit/test_mozTXTToHTMLConv.js
--- a/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
+++ b/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
@@ -246,16 +246,17 @@ mozTXTToHTMLConv::FindURLStart(const cha
              && aInString[uint32_t(i)] != '>' && aInString[uint32_t(i)] != '<'
              && aInString[uint32_t(i)] != '"' && aInString[uint32_t(i)] != '\''
              && aInString[uint32_t(i)] != '`' && aInString[uint32_t(i)] != ','
              && aInString[uint32_t(i)] != '{' && aInString[uint32_t(i)] != '['
              && aInString[uint32_t(i)] != '(' && aInString[uint32_t(i)] != '|'
              && aInString[uint32_t(i)] != '\\'
              && !IsSpace(aInString[uint32_t(i)])
              && (!isEmail || nsCRT::IsAscii(aInString[uint32_t(i)]))
+             && (!isEmail || aInString[uint32_t(i)] != ')')
          ; i--)
       ;
     if
       (
         ++i >= 0 && uint32_t(i) < pos
           &&
           (
             IsAsciiAlpha(aInString[uint32_t(i)]) ||
--- a/netwerk/test/unit/test_mozTXTToHTMLConv.js
+++ b/netwerk/test/unit/test_mozTXTToHTMLConv.js
@@ -109,16 +109,20 @@ function run_test() {
       input: "parenthesis: (john.doe+test@mozilla.org) etc.",
       url: "mailto:john.doe+test@mozilla.org"
     },
     {
       input: "(thunderbird)http://mozilla.org/thunderbird",
       url: "http://mozilla.org/thunderbird"
     },
     {
+      input: "(mail)john.doe+test@mozilla.org",
+      url: "mailto:john.doe+test@mozilla.org"
+    },
+    {
       input: "()http://mozilla.org",
       url: "http://mozilla.org"
     },
     {
       input: "parenthesis included: http://kb.mozillazine.org/Performance_(Thunderbird) etc.",
       url: "http://kb.mozillazine.org/Performance_(Thunderbird)"
     },
     {