mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 781617 - autoFill should respect user's input.
r=unfocused
This commit is contained in:
parent
67e3ae7491
commit
9793dac4c0
@ -1555,6 +1555,8 @@ nsAutoCompleteController::GetFinalDefaultCompleteValue(nsAString &_retval)
|
||||
_retval = commentValue;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(FindInReadable(inputValue, _retval, nsCaseInsensitiveStringComparator()),
|
||||
"Return value must include input value.");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1403,6 +1403,13 @@ urlInlineComplete.prototype = {
|
||||
|
||||
if (hasDomainResult) {
|
||||
// We got a match for a domain, we can add it immediately.
|
||||
// If the untrimmed value doesn't preserve the user's input just
|
||||
// ignore it and complete to the found domain.
|
||||
if (untrimmedDomain &&
|
||||
!untrimmedDomain.toLowerCase().contains(this._originalSearchString.toLowerCase())) {
|
||||
untrimmedDomain = null;
|
||||
}
|
||||
|
||||
// TODO (bug 754265): this is a temporary solution introduced while
|
||||
// waiting for a propert dedicated API.
|
||||
result.appendMatch(this._strippedPrefix + domain, untrimmedDomain);
|
||||
@ -1513,9 +1520,17 @@ urlInlineComplete.prototype = {
|
||||
}
|
||||
|
||||
// Add the result.
|
||||
// If the untrimmed value doesn't preserve the user's input just
|
||||
// ignore it and complete to the found url.
|
||||
let untrimmedURL = prefix + url;
|
||||
if (untrimmedURL &&
|
||||
!untrimmedURL.toLowerCase().contains(this._originalSearchString.toLowerCase())) {
|
||||
untrimmedURL = null;
|
||||
}
|
||||
|
||||
// TODO (bug 754265): this is a temporary solution introduced while
|
||||
// waiting for a propert dedicated API.
|
||||
this._result.appendMatch(this._strippedPrefix + url, prefix + url);
|
||||
this._result.appendMatch(this._strippedPrefix + url, untrimmedURL);
|
||||
|
||||
// handleCompletion() will cause the result listener to be called, and
|
||||
// will display the result in the UI.
|
||||
|
@ -59,7 +59,7 @@ add_autocomplete_test([
|
||||
add_autocomplete_test([
|
||||
"Searching for untrimmed cased entry with www",
|
||||
"http://www.mOz",
|
||||
{ autoFilled: "http://www.mOzilla.org/", completed: "www.mozilla.org/" },
|
||||
{ autoFilled: "http://www.mOzilla.org/", completed: "http://www.mozilla.org/" },
|
||||
function () {
|
||||
addBookmark({ url: "http://www.mozilla.org/Test/" });
|
||||
},
|
||||
|
@ -142,3 +142,23 @@ add_autocomplete_test([
|
||||
transition: TRANSITION_TYPED });
|
||||
},
|
||||
]);
|
||||
|
||||
add_autocomplete_test([
|
||||
"Don't return unsecure URL when searching for secure ones",
|
||||
"https://test.moz.org/t",
|
||||
{ autoFilled: "https://test.moz.org/test/", completed: "https://test.moz.org/test/" },
|
||||
function () {
|
||||
addVisits({ uri: NetUtil.newURI("http://test.moz.org/test/"),
|
||||
transition: TRANSITION_TYPED });
|
||||
},
|
||||
]);
|
||||
|
||||
add_autocomplete_test([
|
||||
"Don't return unsecure domain when searching for secure ones",
|
||||
"https://test.moz",
|
||||
{ autoFilled: "https://test.moz.org/", completed: "https://test.moz.org/" },
|
||||
function () {
|
||||
addVisits({ uri: NetUtil.newURI("http://test.moz.org/test/"),
|
||||
transition: TRANSITION_TYPED });
|
||||
},
|
||||
]);
|
||||
|
Loading…
Reference in New Issue
Block a user