зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1087380 - avoid alternate (www....com) URI fixup for localhost and items with ports, r=bz
MozReview-Commit-ID: HB9SxRSWnz --HG-- extra : rebase_source : 99a9708588b277e31c8082b9579371609fc658d1
This commit is contained in:
Родитель
b8329c34d6
Коммит
faf81a4714
|
@ -545,11 +545,22 @@ nsDefaultURIFixup::MakeAlternateURI(nsIURI* aURI)
|
|||
if (!userpass.IsEmpty()) {
|
||||
return false;
|
||||
}
|
||||
// Don't fix up hosts with ports
|
||||
int32_t port;
|
||||
aURI->GetPort(&port);
|
||||
if (port != -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoCString oldHost;
|
||||
nsAutoCString newHost;
|
||||
aURI->GetHost(oldHost);
|
||||
|
||||
// Don't fix up 'localhost' because that's confusing:
|
||||
if (oldHost.EqualsLiteral("localhost")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoCString newHost;
|
||||
// Count the dots
|
||||
int32_t numDots = 0;
|
||||
nsReadingIterator<char> iter;
|
||||
|
|
|
@ -182,12 +182,10 @@ var testcases = [ {
|
|||
}, {
|
||||
input: "[::1]:8000",
|
||||
fixedURI: "http://[::1]:8000/",
|
||||
alternateURI: "http://[::1]:8000/",
|
||||
protocolChange: true,
|
||||
}, {
|
||||
input: "[::1]:8000/",
|
||||
fixedURI: "http://[::1]:8000/",
|
||||
alternateURI: "http://[::1]:8000/",
|
||||
protocolChange: true,
|
||||
}, {
|
||||
input: "[[::1]]/",
|
||||
|
@ -215,7 +213,6 @@ var testcases = [ {
|
|||
}, {
|
||||
input: "[::1][100",
|
||||
fixedURI: null,
|
||||
alternateURI: null,
|
||||
keywordLookup: true,
|
||||
protocolChange: true
|
||||
}, {
|
||||
|
@ -471,7 +468,22 @@ var testcases = [ {
|
|||
keywordLookup: true,
|
||||
protocolChange: true,
|
||||
affectedByDNSForSingleHosts: true,
|
||||
}];
|
||||
}, {
|
||||
input: "localhost",
|
||||
fixedURI: "http://localhost/",
|
||||
keywordLookup: true,
|
||||
protocolChange: true,
|
||||
affectedByDNSForSingleHosts: true,
|
||||
}, {
|
||||
input: "localhost:8080",
|
||||
fixedURI: "http://localhost:8080/",
|
||||
protocolChange: true,
|
||||
}, {
|
||||
input: "plonk:8080",
|
||||
fixedURI: "http://plonk:8080/",
|
||||
protocolChange: true,
|
||||
}
|
||||
];
|
||||
|
||||
if (Services.appinfo.OS.toLowerCase().startsWith("win")) {
|
||||
testcases.push({
|
||||
|
|
Загрузка…
Ссылка в новой задаче