Bug 1636583 - URIFixup should force a visit when an uri-like search string ends with a slash. r=adw

Differential Revision: https://phabricator.services.mozilla.com/D75910
This commit is contained in:
Marco Bonardo 2020-05-21 14:58:15 +00:00
Родитель 9b5422f233
Коммит 36118c93a3
2 изменённых файлов: 23 добавлений и 2 удалений

Просмотреть файл

@ -14,7 +14,7 @@
// getFixupURIInfo has a complex logic, that likely could be simplified, but
// the risk of regressions is high, thus that should be done with care.
/* eslint complexity: ["error", 39] */
/* eslint complexity: ["error", 40] */
var EXPORTED_SYMBOLS = ["URIFixup", "URIFixupInfo"];
@ -389,6 +389,11 @@ URIFixup.prototype = {
info.fixupChangedProtocol = true;
maybeSetAlternateFixedURI(info, fixupFlags);
info.preferredURI = info.fixedURI;
// Check if it's a forced visit. The user can enforce a visit by
// appending a slash, but the string must be in a valid uri format.
if (uriString.endsWith("/")) {
return info;
}
}
}

Просмотреть файл

@ -411,7 +411,7 @@ var testcases = [
protocolChange: true,
},
{
input: "mozilla.nonexistent/",
input: "mozilla.nonexistent",
fixedURI: "http://mozilla.nonexistent/",
alternateURI: "http://www.mozilla.nonexistent/",
keywordLookup: true,
@ -603,6 +603,22 @@ var testcases = [
input: " moz\ti\tlla.org ",
keywordLookup: true,
},
{
input: "mozilla/",
fixedURI: "http://mozilla/",
alternateURI: "http://www.mozilla.com/",
protocolChange: true,
},
{
input: "mozilla/ test /",
fixedURI: "http://mozilla/%20test%20/",
alternateURI: "http://www.mozilla.com/%20test%20/",
protocolChange: true,
},
{
input: "mozilla /test/",
keywordLookup: true,
},
];
if (AppConstants.platform == "win") {