Bug 329831 r=annie.sullivan Make QueryStringToQueries return empty array if

there is no input.
This commit is contained in:
brettw%gmail.com 2006-03-09 17:27:14 +00:00
parent 472ec2a4eb
commit b33591dc65
2 changed files with 11 additions and 6 deletions

View File

@ -1029,7 +1029,9 @@ interface nsINavHistoryService : nsISupports
/**
* Converts a query URI-like string to an array of actual query objects for
* use to executeQueries().
* use to executeQueries(). The output query array may be empty if there is
* no information. However, there will always be an options structure returned
* (if nothing is defined, it will just have the default values).
*/
void queryStringToQueries(in AUTF8String aQueryString,
[array, size_is(aResultCount)] out nsINavHistoryQuery aQueries, out PRUint32 aResultCount,

View File

@ -233,12 +233,15 @@ nsNavHistory::QueryStringToQueryArray(const nsACString& aQueryString,
rv = TokenizeQueryString(aQueryString, &tokens);
NS_ENSURE_SUCCESS(rv, rv);
rv = TokensToQueries(tokens, aQueries, options);
if (NS_FAILED(rv)) {
NS_WARNING("Unable to parse the query string: ");
NS_WARNING(PromiseFlatCString(aQueryString).get());
if (tokens.Length() > 0) {
rv = TokensToQueries(tokens, aQueries, options);
if (NS_FAILED(rv)) {
NS_WARNING("Unable to parse the query string: ");
NS_WARNING(PromiseFlatCString(aQueryString).get());
}
NS_ENSURE_SUCCESS(rv, rv);
}
NS_ENSURE_SUCCESS(rv, rv);
// when there are no tokens, leave the query array empty
NS_ADDREF(*aOptions = options);
return NS_OK;