moebius#130: URL parser - fix: don't allow empty host name

https://github.com/MoonchildProductions/moebius/issues/130
This commit is contained in:
janekptacijarabaci 2018-04-15 07:29:18 +02:00 committed by Roy Tam
commit 196fddddb6
14 changed files with 51 additions and 72 deletions

View file

@ -949,6 +949,10 @@ nsresult // static
nsNavHistory::AsciiHostNameFromHostString(const nsACString& aHostName,
nsACString& aAscii)
{
aAscii.Truncate();
if (aHostName.IsEmpty()) {
return NS_OK;
}
// To properly generate a uri we must provide a protocol.
nsAutoCString fakeURL("http://");
fakeURL.Append(aHostName);