Bug 1509493 - Do not include unmatched ')' in email addresses r=BenB
authorFabian Henneke <fabian@henneke.me>
Sun, 02 Dec 2018 16:20:03 +0000
changeset 508394 00d7ff2eeb0ad9eaeb2fe79a0c275b305f26f766
parent 508393 b4808c4e7d61c68cebd13865685a28a47d72b982
child 508395 95e75223f6c7dc1bdd13488deb46a18541c00c93
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [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 Depends on D13644 Differential Revision: https://phabricator.services.mozilla.com/D13645
netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
netwerk/test/unit/test_mozTXTToHTMLConv.js
--- a/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
+++ b/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
@@ -209,17 +209,18 @@ bool mozTXTToHTMLConv::FindURLStart(cons
       // These chars mark the start of the URL
       for (; i >= 0 && 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 || nsCRT::IsAscii(aInString[uint32_t(i)])) &&
+             (!isEmail || aInString[uint32_t(i)] != ')');
            i--)
         ;
       if (++i >= 0 && uint32_t(i) < pos &&
           (IsAsciiAlpha(aInString[uint32_t(i)]) ||
            IsAsciiDigit(aInString[uint32_t(i)]))) {
         start = uint32_t(i);
         return true;
       }
--- 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)"
     },
     {