Bug 1047393 - fix crash in nsIURIFixup, r=gavin

--HG--
extra : rebase_source : 054a4d4e0f0893f7497390071cc3a1c59f8af575
This commit is contained in:
Gijs Kruitbosch 2014-08-04 16:44:33 +01:00
parent 98f4f1ce42
commit 1340beff86
2 changed files with 5 additions and 3 deletions

View File

@ -960,7 +960,8 @@ void nsDefaultURIFixup::KeywordURIFixup(const nsACString & aURIString,
colonLoc == uint32_t(kNotFound) && qMarkLoc == uint32_t(kNotFound))
{
nsAutoCString asciiHost;
if (NS_SUCCEEDED(aFixupInfo->mFixedURI->GetAsciiHost(asciiHost)) &&
if (aFixupInfo->mFixedURI &&
NS_SUCCEEDED(aFixupInfo->mFixedURI->GetAsciiHost(asciiHost)) &&
!asciiHost.IsEmpty())
{
// Check if this domain is whitelisted as an actual

View File

@ -59,7 +59,8 @@ let testcases = [
["test.", "http://test./", "http://www.test./", true, true],
[".test", "http://.test/", "http://www..test/", true, true],
["mozilla is amazing", null, null, true, true],
["", null, null, true, true]
["", null, null, true, true],
["[]", null, null, true, true]
];
if (Services.appinfo.OS.toLowerCase().startsWith("win")) {
@ -114,7 +115,7 @@ function run_test() {
// Check the preferred URI
if (couldDoKeywordLookup && expectKeywordLookup) {
let urlparamInput = testInput.replace(/ /g, '+');
let urlparamInput = encodeURIComponent(testInput).replace("%20", "+", "g");
let searchURL = kSearchEngineURL.replace("{searchTerms}", urlparamInput);
do_check_eq(info.preferredURI.spec, searchURL);
} else {