Bug 1083634 - entering a trailing slash after a domain should not do a search. r=smaug r=Unfocused

This commit is contained in:
Gijs Kruitbosch 2014-12-22 00:03:26 +00:00
Родитель 03dbaa0232
Коммит 9fba7969d0
2 изменённых файлов: 41 добавлений и 2 удалений

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

@ -1096,6 +1096,13 @@ nsDefaultURIFixup::KeywordURIFixup(const nsACString & aURIString,
return NS_OK;
}
// ... unless there are no dots, and a slash, and alpha characters, and this is a valid host:
if (firstDotLoc == uint32_t(kNotFound) && lastSlashLoc != uint32_t(kNotFound) &&
hasAsciiAlpha && isValidAsciiHost) {
return NS_OK;
}
// If we get here, we don't have a valid URI, or we did but the
// host is not whitelisted, so we do a keyword search *anyway*:
rv = TryKeywordFixupForURIInfo(aFixupInfo->mOriginalInput, aFixupInfo, aPostData);

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

@ -375,6 +375,14 @@ let testcases = [ {
protocolChange: true,
affectedByWhitelist: true,
affectedByDNSForSingleHosts: true,
}, {
input: "5/2",
fixedURI: "http://5/2",
alternateURI: "http://www.5.com/2",
keywordLookup: true,
protocolChange: true,
affectedByWhitelist: true,
affectedByDNSForSingleHosts: true,
}, {
input: "moz ?.::%27",
keywordLookup: true,
@ -448,6 +456,32 @@ let testcases = [ {
keywordLookup: true,
protocolChange: true,
affectedByWhitelist: true
}, {
input: "mozilla/",
fixedURI: "http://mozilla/",
alternateURI: "http://www.mozilla.com/",
protocolChange: true,
affectedByWhitelist: true,
}, {
input: "mozilla",
fixedURI: "http://mozilla/",
alternateURI: "http://www.mozilla.com/",
protocolChange: true,
keywordLookup: true,
affectedByWhitelist: true,
affectedByDNSForSingleHosts: true,
}, {
input: "mozilla5/2",
fixedURI: "http://mozilla5/2",
alternateURI: "http://www.mozilla5.com/2",
protocolChange: true,
affectedByWhitelist: true,
}, {
input: "mozilla/foo",
fixedURI: "http://mozilla/foo",
alternateURI: "http://www.mozilla.com/foo",
protocolChange: true,
affectedByWhitelist: true,
}];
if (Services.appinfo.OS.toLowerCase().startsWith("win")) {
@ -467,10 +501,8 @@ if (Services.appinfo.OS.toLowerCase().startsWith("win")) {
input: "mozilla\\",
fixedURI: "http://mozilla/",
alternateURI: "http://www.mozilla.com/",
keywordLookup: true,
protocolChange: true,
affectedByWhitelist: true,
affectedByDNSForSingleHosts: true,
});
} else {
testcases.push({