mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-01 04:47:31 +09:00
moebius#130: URL parser - fix: don't allow empty host name
https://github.com/MoonchildProductions/moebius/issues/130
This commit is contained in:
parent
aa1df43166
commit
196fddddb6
14 changed files with 51 additions and 72 deletions
|
|
@ -192,7 +192,6 @@ add_task(function test_search_all_full_case_sensitive()
|
|||
{
|
||||
checkAllSearches({ hostname: "http://www.example.com" }, 1);
|
||||
checkAllSearches({ hostname: "http://www.example.com/" }, 0);
|
||||
checkAllSearches({ hostname: "http://" }, 0);
|
||||
checkAllSearches({ hostname: "example.com" }, 0);
|
||||
|
||||
checkAllSearches({ formSubmitURL: "http://www.example.com" }, 2);
|
||||
|
|
|
|||
|
|
@ -1245,7 +1245,7 @@ Search.prototype = {
|
|||
// * If the protocol differs we should not match. For example if the user
|
||||
// searched https we should not return http.
|
||||
try {
|
||||
let prefixURI = NetUtil.newURI(this._strippedPrefix);
|
||||
let prefixURI = NetUtil.newURI(this._strippedPrefix + match.token);
|
||||
let finalURI = NetUtil.newURI(match.url);
|
||||
if (prefixURI.scheme != finalURI.scheme)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue