Bug 1624704 - Part 1 - Remove UrlbarUtils.INSERTMETHOD. r=mak
authorHarry Twyford <htwyford@mozilla.com>
Wed, 25 Mar 2020 17:09:59 +0000
changeset 520550 4d7451d0f3dd971a62446117d3bea8668e5cce02
parent 520549 3b4a8229aacfe0b89aaeb0543b29494c6bd765c2
child 520551 a5255aaee6ad48974932e064328d8cd11e21bbc0
push id37253
push usernerli@mozilla.com
push dateThu, 26 Mar 2020 21:36:52 +0000
treeherdermozilla-central@c644dd16e2cc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1624704
milestone76.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1624704 - Part 1 - Remove UrlbarUtils.INSERTMETHOD. r=mak Differential Revision: https://phabricator.services.mozilla.com/D68098
browser/components/urlbar/UrlbarPrefs.jsm
browser/components/urlbar/UrlbarUtils.jsm
toolkit/components/places/UnifiedComplete.jsm
--- a/browser/components/urlbar/UrlbarPrefs.jsm
+++ b/browser/components/urlbar/UrlbarPrefs.jsm
@@ -65,20 +65,16 @@ const PREF_URLBAR_DEFAULTS = new Map([
   ["eventTelemetry.enabled", false],
 
   // When true, `javascript:` URLs are not included in search results.
   ["filter.javascript", true],
 
   // 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"],
 
   // If the heuristic result is a search engine result, we use this instead of
   // matchBuckets.
   ["matchBucketsSearch", ""],
 
   // For search suggestion results, we truncate the user's search string to this
--- a/browser/components/urlbar/UrlbarUtils.jsm
+++ b/browser/components/urlbar/UrlbarUtils.jsm
@@ -25,26 +25,16 @@ XPCOMUtils.defineLazyModuleGetters(this,
   PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
   PlacesUIUtils: "resource:///modules/PlacesUIUtils.jsm",
   PlacesUtils: "resource://gre/modules/PlacesUtils.jsm",
   Services: "resource://gre/modules/Services.jsm",
   UrlbarPrefs: "resource:///modules/UrlbarPrefs.jsm",
 });
 
 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.
   // This value includes the heuristic result.
   MAXIMUM_ALLOWED_EXTENSION_MATCHES: 6,
 
   // This is used by UnifiedComplete, the new implementation will use
   // PROVIDER_TYPE and RESULT_TYPE
--- a/toolkit/components/places/UnifiedComplete.jsm
+++ b/toolkit/components/places/UnifiedComplete.jsm
@@ -29,19 +29,16 @@ const MAXIMUM_ALLOWED_EXTENSION_TIME_MS 
 const RECENT_REMOTE_TAB_THRESHOLD_MS = 259200000; // 72 hours.
 
 // Regex used to match userContextId.
 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+/;
 
 // Regex used to strip prefixes from URLs.  See stripAnyPrefix().
 const REGEXP_STRIP_PREFIX = /^[a-z]+:(?:\/){0,2}/i;
 
 // The result is notified on a delay, to avoid rebuilding the panel at every match.
 const NOTIFYRESULT_DELAY_MS = 16;
@@ -3135,45 +3132,17 @@ UnifiedComplete.prototype = {
     //  * Adaptive History means a result may appear even if the previous string
     //    didn't match it.
     // What we can do is reuse the previous result along with the bucketing
     // system to avoid flickering. Since we know where a new match should be
     // positioned, we  wait for a new match to arrive before replacing the
     // 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,
       searchParam,
       listener,
       this,
       prohibitSearchSuggestions,
       previousResult,