Bug 1520665 - Replace context.autofill property with autofillValue, and make the UnifiedComplete provider set it based on result.getValueAt() r=mak

Differential Revision: https://phabricator.services.mozilla.com/D16766

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Drew Willcoxon 2019-01-17 17:04:03 +00:00
parent 512fb1d5ec
commit 53c6c30ee4
2 changed files with 5 additions and 4 deletions

View File

@ -184,7 +184,7 @@ function convertResultToMatches(context, result, urls) {
continue;
}
urls.add(url);
// Not used yet: result.getValueAt(i), result.getLabelAt(i)
// Not used yet: result.getLabelAt(i)
let style = result.getStyleAt(i);
let match = makeUrlbarMatch(context.tokens, {
url,
@ -198,10 +198,10 @@ function convertResultToMatches(context, result, urls) {
continue;
}
matches.push(match);
// Manage autofill and preselected properties for the first match.
// Manage autofillValue and preselected properties for the first match.
if (i == 0) {
if (style.includes("autofill") && result.defaultIndex == 0) {
context.autofill = true;
context.autofillValue = result.getValueAt(i);
}
if (style.includes("heuristic")) {
context.preselected = true;

View File

@ -75,7 +75,8 @@ It is augmented as it progresses through the system, with various information:
// MATCH_SOURCE.*, that can be returned by the model.
// Properties added by the Model.
autofill; // {boolean} whether the first match is an autofill match.
autofillValue; // {string} the text value that should be autofilled in the
// input, if any.
preselected; // {boolean} whether the first match should be preselected.
results; // {array} list of UrlbarMatch objects.
tokens; // {array} tokens extracted from the searchString, each token is an