mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1558408 - fix fixup of host port URLs with querystrings or refs without forward slashes, r=valentin
Differential Revision: https://phabricator.services.mozilla.com/D52847 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
35cf6bc398
commit
e618913512
@ -748,13 +748,13 @@ bool nsDefaultURIFixup::PossiblyHostPortUrl(const nsACString& aUrl) {
|
||||
++iter;
|
||||
|
||||
// Count the number of digits after the colon and before the
|
||||
// next forward slash (or end of string)
|
||||
// next forward slash, question mark, hash sign, or end of string.
|
||||
|
||||
uint32_t digitCount = 0;
|
||||
while (iter != iterEnd && digitCount <= 5) {
|
||||
if (IsAsciiDigit(*iter)) {
|
||||
digitCount++;
|
||||
} else if (*iter == '/') {
|
||||
} else if (*iter == '/' || *iter == '?' || *iter == '#') {
|
||||
break;
|
||||
} else {
|
||||
// Whatever it is, it ain't a port!
|
||||
|
@ -83,6 +83,18 @@ var data = [
|
||||
wrong: "://user:pass@example.com:8080/this/is/a/test.html",
|
||||
fixed: "http://user:pass@example.com:8080/this/is/a/test.html",
|
||||
},
|
||||
{
|
||||
wrong: "localhost:8080/?param=1",
|
||||
fixed: "http://localhost:8080/?param=1",
|
||||
},
|
||||
{
|
||||
wrong: "localhost:8080?param=1",
|
||||
fixed: "http://localhost:8080/?param=1",
|
||||
},
|
||||
{
|
||||
wrong: "localhost:8080#somewhere",
|
||||
fixed: "http://localhost:8080/#somewhere",
|
||||
},
|
||||
{
|
||||
wrong: "whatever://this/is/a@b/test.html",
|
||||
fixed: kSearchEngineURL.replace(
|
||||
|
Loading…
Reference in New Issue
Block a user