Bug 1509493 - Always linkify common URL schemes in plain text r=BenB
authorFabian Henneke <fabian@henneke.me>
Sun, 02 Dec 2018 16:20:05 +0000
changeset 505612 51e67c682e39c167ae275cb2a18ee31f68346a09
parent 505611 c50c098e40c48f8ef04afe7267db57e2f2c7ff1f
child 505613 b4808c4e7d61c68cebd13865685a28a47d72b982
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 - Always linkify common URL schemes in plain text r=BenB Differential Revision: https://phabricator.services.mozilla.com/D13511
netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
--- a/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
+++ b/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
@@ -336,16 +336,20 @@ void mozTXTToHTMLConv::CalculateURLBound
 
 bool mozTXTToHTMLConv::ShouldLinkify(const nsCString& aURL) {
   if (!mIOService) return false;
 
   nsAutoCString scheme;
   nsresult rv = mIOService->ExtractScheme(aURL, scheme);
   if (NS_FAILED(rv)) return false;
 
+  if (scheme == "http" || scheme == "https" || scheme == "mailto") {
+    return true;
+  }
+
   // Get the handler for this scheme.
   nsCOMPtr<nsIProtocolHandler> handler;
   rv = mIOService->GetProtocolHandler(scheme.get(), getter_AddRefs(handler));
   if (NS_FAILED(rv)) return false;
 
   // Is it an external protocol handler? If not, linkify it.
   nsCOMPtr<nsIExternalProtocolHandler> externalHandler =
       do_QueryInterface(handler);