Bug 1624704 - Part 1 - Remove UrlbarUtils.INSERTMETHOD. r=mak

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Harry Twyford 2020-03-25 17:09:59 +00:00
Родитель 8ef9e609d6
Коммит b5ec718191
3 изменённых файлов: 0 добавлений и 45 удалений

Просмотреть файл

@ -70,10 +70,6 @@ const PREF_URLBAR_DEFAULTS = new Map([
// Applies URL highlighting and other styling to the text in the urlbar input.
["formatting.enabled", false],
// Allows results from one search to be reused in the next search. One of the
// INSERTMETHOD values.
["insertMethod", UrlbarUtils.INSERTMETHOD.MERGE_RELATED],
// Controls the composition of search results.
["matchBuckets", "suggestion:4,general:Infinity"],

Просмотреть файл

@ -30,16 +30,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
});
var UrlbarUtils = {
// Values for browser.urlbar.insertMethod
INSERTMETHOD: {
// Just append new results.
APPEND: 0,
// Merge previous and current results if search strings are related.
MERGE_RELATED: 1,
// Always merge previous and current results.
MERGE: 2,
},
// Extensions are allowed to add suggestions if they have registered a keyword
// with the omnibox API. This is the maximum number of suggestions an extension
// is allowed to add for a given search string.

Просмотреть файл

@ -34,9 +34,6 @@ const REGEXP_USER_CONTEXT_ID = /(?:^| )user-context-id:(\d+)/;
// Regex used to match maxResults.
const REGEXP_MAX_RESULTS = /(?:^| )max-results:(\d+)/;
// Regex used to match insertMethod.
const REGEXP_INSERT_METHOD = /(?:^| )insert-method:(\d+)/;
// Regex used to match one or more whitespace.
const REGEXP_SPACES = /\s+/;
@ -3140,35 +3137,7 @@ UnifiedComplete.prototype = {
// previous one. This may leave stale matches from the previous search that
// would not be returned by the current one, thus once the current search is
// complete, we remove those stale matches with _cleanUpNonCurrentMatches().
// Extract the insert-method param if it exists.
let insertMethod = UrlbarUtils.INSERTMETHOD.APPEND;
if (!queryContext) {
insertMethod = searchParam.match(REGEXP_INSERT_METHOD);
insertMethod = insertMethod
? parseInt(insertMethod[1])
: UrlbarPrefs.get("insertMethod");
}
let previousResult = null;
if (
this._currentSearch &&
insertMethod != UrlbarUtils.INSERTMETHOD.APPEND
) {
let result = this._currentSearch._result;
// Only reuse the previous result when one of the search strings is an
// extension of the other one. We could expand this to any case, but
// that may leave exposed unrelated matches for a longer time.
let previousSearchString = result.searchString;
let stringsRelated =
!!previousSearchString.length &&
!!searchString.length &&
(previousSearchString.includes(searchString) ||
searchString.includes(previousSearchString));
if (insertMethod == UrlbarUtils.INSERTMETHOD.MERGE || stringsRelated) {
previousResult = result;
}
}
let search = (this._currentSearch = new Search(
searchString,