Bug 742776 - Use a case sensitive match for the URI path in inline autocomplete query.
r=gavin a=desktop-only
--- a/suite/common/places/nsPlacesAutoComplete.js
+++ b/suite/common/places/nsPlacesAutoComplete.js
@@ -71,16 +71,17 @@ const kTopicShutdown = "places-shutdown"
const kPrefChanged = "nsPref:changed";
// Match type constants. These indicate what type of search function we should
// be using.
const MATCH_ANYWHERE = Ci.mozIPlacesAutoComplete.MATCH_ANYWHERE;
const MATCH_BOUNDARY_ANYWHERE = Ci.mozIPlacesAutoComplete.MATCH_BOUNDARY_ANYWHERE;
const MATCH_BOUNDARY = Ci.mozIPlacesAutoComplete.MATCH_BOUNDARY;
const MATCH_BEGINNING = Ci.mozIPlacesAutoComplete.MATCH_BEGINNING;
+const MATCH_BEGINNING_CASE_SENSITIVE = Ci.mozIPlacesAutoComplete.MATCH_BEGINNING_CASE_SENSITIVE;
// AutoComplete index constants. All AutoComplete queries will provide these
// columns in this order.
const kQueryIndexURL = 0;
const kQueryIndexTitle = 1;
const kQueryIndexFaviconURL = 2;
const kQueryIndexBookmarked = 3;
const kQueryIndexBookmarkTitle = 4;
@@ -1434,21 +1435,30 @@ urlInlineComplete.prototype = {
// We don't need to search if we have no "/" separator, or if it's at
// the end of the search text.
if (lastSlashIndex == -1 ||
lastSlashIndex == this._currentSearchString.length - 1) {
this._finishSearch();
return;
}
+ // The URIs in the database are fixed up, so we can match on a lowercased
+ // host, but the path must be matched in a case sensitive way.
+ let pathIndex =
+ this._originalSearchString.indexOf("/", this._strippedPrefix.length);
+ this._currentSearchString = fixupSearchText(
+ this._originalSearchString.slice(0, pathIndex).toLowerCase() +
+ this._originalSearchString.slice(pathIndex)
+ );
+
// Within the standard autocomplete query, we only search the beginning
// of URLs for 1 result.
let query = this._asyncQuery;
let (params = query.params) {
- params.matchBehavior = MATCH_BEGINNING;
+ params.matchBehavior = MATCH_BEGINNING_CASE_SENSITIVE;
params.searchBehavior = Ci.mozIPlacesAutoComplete["BEHAVIOR_URL"];
params.searchString = this._currentSearchString;
}
// Execute the async query
let wrapper = new AutoCompleteStatementCallbackWrapper(this, this._db);
this._pendingQuery = wrapper.executeAsync([query]);
},