diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-11-07 12:47:12 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-11-07 12:47:12 +0100 |
commit | 8240fb9c736f91044cabbdde8c537b179fc4921e (patch) | |
tree | 49a4cc8dc683cf955d61b6618ad471860554ccb5 /docshell/base | |
parent | f9e04b54c2ccbc1f8e24b511003de09b4565193c (diff) | |
parent | 5c83a18cde404b5c0c9fba1d35f003d951ea32e2 (diff) | |
download | UXP-8240fb9c736f91044cabbdde8c537b179fc4921e.tar UXP-8240fb9c736f91044cabbdde8c537b179fc4921e.tar.gz UXP-8240fb9c736f91044cabbdde8c537b179fc4921e.tar.lz UXP-8240fb9c736f91044cabbdde8c537b179fc4921e.tar.xz UXP-8240fb9c736f91044cabbdde8c537b179fc4921e.zip |
Merge branch 'master' into Pale_Moon-release
# Conflicts:
# application/palemoon/config/version.txt
Diffstat (limited to 'docshell/base')
-rw-r--r-- | docshell/base/nsDefaultURIFixup.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/docshell/base/nsDefaultURIFixup.cpp b/docshell/base/nsDefaultURIFixup.cpp index e519720ab..d2876181a 100644 --- a/docshell/base/nsDefaultURIFixup.cpp +++ b/docshell/base/nsDefaultURIFixup.cpp @@ -154,6 +154,15 @@ HasUserPassword(const nsACString& aStringURI) return false; } +// Assume that 1 tab is accidental, but more than 1 implies this is +// supposed to be tab-separated content. +static bool +MaybeTabSeparatedContent(const nsCString& aStringURI) +{ + auto firstTab = aStringURI.FindChar('\t'); + return firstTab != kNotFound && aStringURI.RFindChar('\t') != firstTab; +} + NS_IMETHODIMP nsDefaultURIFixup::GetFixupURIInfo(const nsACString& aStringURI, uint32_t aFixupFlags, @@ -168,8 +177,8 @@ nsDefaultURIFixup::GetFixupURIInfo(const nsACString& aStringURI, // Eliminate embedded newlines, which single-line text fields now allow: uriString.StripChars("\r\n"); - // Cleanup the empty spaces that might be on each end: - uriString.Trim(" "); + // Cleanup the empty spaces and tabs that might be on each end: + uriString.Trim(" \t"); NS_ENSURE_TRUE(!uriString.IsEmpty(), NS_ERROR_FAILURE); @@ -367,12 +376,16 @@ nsDefaultURIFixup::GetFixupURIInfo(const nsACString& aStringURI, inputHadDuffProtocol = true; } - // NB: this rv gets returned at the end of this method if we never - // do a keyword fixup after this (because the pref or the flags passed - // might not let us). - rv = FixupURIProtocol(uriString, info, getter_AddRefs(uriWithProtocol)); - if (uriWithProtocol) { - info->mFixedURI = uriWithProtocol; + // Note: this rv gets returned at the end of this method if we don't fix up + // the protocol and don't do a keyword fixup after this (because the pref + // or the flags passed might not let us). + rv = NS_OK; + // Avoid fixing up content that looks like tab-separated values + if (!MaybeTabSeparatedContent(uriString)) { + rv = FixupURIProtocol(uriString, info, getter_AddRefs(uriWithProtocol)); + if (uriWithProtocol) { + info->mFixedURI = uriWithProtocol; + } } // See if it is a keyword |