Bug 1500138 - Remove browser.urlbar.matchBehavior and some unused Address Bar behaviors. r=adw
authorMarco Bonardo <mbonardo@mozilla.com>
Thu, 25 Oct 2018 23:23:36 +0000
changeset 443099 095cb0042729b07598ca8139eb30284c5a564024
parent 443098 eaf542a7bdb119fdb0585e149e4827eed185b456
child 443100 8d38810fdc7309de2520fb9b36abbb09767a4bee
push id34939
push usernerli@mozilla.com
push dateFri, 26 Oct 2018 15:47:55 +0000
treeherdermozilla-central@760a16bf0d2b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw
bugs1500138
milestone65.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 1500138 - Remove browser.urlbar.matchBehavior and some unused Address Bar behaviors. r=adw Remove browser.urlbar.matchBehavior pref. Remove code for BEGINNING behaviors, and stop referencing MATCH_BOUNDARY_ANYWHERE from our code. Differential Revision: https://phabricator.services.mozilla.com/D9806
browser/components/urlbar/UrlbarPrefs.jsm
toolkit/components/places/SQLFunctions.cpp
toolkit/components/places/UnifiedComplete.js
toolkit/components/places/mozIPlacesAutoComplete.idl
toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
toolkit/components/places/tests/unifiedcomplete/test_match_beginning.js
toolkit/components/places/tests/unifiedcomplete/test_word_boundary_search.js
toolkit/components/places/tests/unifiedcomplete/xpcshell.ini
--- a/browser/components/urlbar/UrlbarPrefs.jsm
+++ b/browser/components/urlbar/UrlbarPrefs.jsm
@@ -63,20 +63,16 @@ 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 how URLs are matched against the user's search string.  See
-  // mozIPlacesAutoComplete.
-  ["matchBehavior", Ci.mozIPlacesAutoComplete.MATCH_BOUNDARY_ANYWHERE],
-
   // 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
@@ -306,26 +302,16 @@ class Preferences {
           val |= Ci.mozIPlacesAutoComplete.BEHAVIOR_HISTORY;
         } else if (this.get("suggest.bookmark")) {
           val |= Ci.mozIPlacesAutoComplete.BEHAVIOR_BOOKMARK;
         } else {
           val |= Ci.mozIPlacesAutoComplete.BEHAVIOR_OPENPAGE;
         }
         return val;
       }
-      case "matchBehavior": {
-        // Validate matchBehavior; default to MATCH_BOUNDARY_ANYWHERE.
-        let val = this._readPref(pref);
-        if (![Ci.mozIPlacesAutoComplete.MATCH_ANYWHERE,
-              Ci.mozIPlacesAutoComplete.MATCH_BOUNDARY,
-              Ci.mozIPlacesAutoComplete.MATCH_BEGINNING].includes(val)) {
-          val = Ci.mozIPlacesAutoComplete.MATCH_BOUNDARY_ANYWHERE;
-        }
-        return val;
-      }
     }
     return this._readPref(pref);
   }
 
   /**
    * Used to keep some pref values linked.
    * TODO: remove autocomplete.enabled and rely only on suggest.* prefs once we
    * can drop legacy add-ons compatibility.
--- a/toolkit/components/places/SQLFunctions.cpp
+++ b/toolkit/components/places/SQLFunctions.cpp
@@ -442,76 +442,23 @@ namespace places {
   bool
   MatchAutoCompleteFunction::findOnBoundary(const nsDependentCSubstring &aToken,
                                             const nsACString &aSourceString)
   {
     return findInString(aToken, aSourceString, eFindOnBoundary);
   }
 
   /* static */
-  bool
-  MatchAutoCompleteFunction::findBeginning(const nsDependentCSubstring &aToken,
-                                           const nsACString &aSourceString)
-  {
-    MOZ_ASSERT(!aToken.IsEmpty(), "Don't search for an empty token!");
-
-    // We can't use StringBeginsWith here, unfortunately.  Although it will
-    // happily take a case-insensitive UTF8 comparator, it eventually calls
-    // nsACString::Equals, which checks that the two strings contain the same
-    // number of bytes before calling the comparator.  Two characters may be
-    // case-insensitively equal while taking up different numbers of bytes, so
-    // this is not what we want.
-
-    const_char_iterator tokenStart(aToken.BeginReading()),
-                        tokenEnd(aToken.EndReading()),
-                        sourceStart(aSourceString.BeginReading()),
-                        sourceEnd(aSourceString.EndReading());
-
-    bool dummy;
-    while (sourceStart < sourceEnd &&
-           CaseInsensitiveUTF8CharsEqual(sourceStart, tokenStart,
-                                         sourceEnd, tokenEnd,
-                                         &sourceStart, &tokenStart, &dummy)) {
-
-      // We found the token!
-      if (tokenStart >= tokenEnd) {
-        return true;
-      }
-    }
-
-    // We don't need to check CaseInsensitiveUTF8CharsEqual's error condition
-    // (stored in |dummy|), since the function will return false if it
-    // encounters an error.
-
-    return false;
-  }
-
-  /* static */
-  bool
-  MatchAutoCompleteFunction::findBeginningCaseSensitive(
-    const nsDependentCSubstring &aToken,
-    const nsACString &aSourceString)
-  {
-    MOZ_ASSERT(!aToken.IsEmpty(), "Don't search for an empty token!");
-
-    return StringBeginsWith(aSourceString, aToken);
-  }
-
-  /* static */
   MatchAutoCompleteFunction::searchFunctionPtr
   MatchAutoCompleteFunction::getSearchFunction(int32_t aBehavior)
   {
     switch (aBehavior) {
       case mozIPlacesAutoComplete::MATCH_ANYWHERE:
       case mozIPlacesAutoComplete::MATCH_ANYWHERE_UNMODIFIED:
         return findAnywhere;
-      case mozIPlacesAutoComplete::MATCH_BEGINNING:
-        return findBeginning;
-      case mozIPlacesAutoComplete::MATCH_BEGINNING_CASE_SENSITIVE:
-        return findBeginningCaseSensitive;
       case mozIPlacesAutoComplete::MATCH_BOUNDARY:
       default:
         return findOnBoundary;
     };
   }
 
   NS_IMPL_ISUPPORTS(
     MatchAutoCompleteFunction,
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.js
@@ -5,26 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 // Constants
 
 const MS_PER_DAY = 86400000; // 24 * 60 * 60 * 1000
 
-// Match type constants.
-// These indicate what type of search function we should be using.
-const {
-  MATCH_ANYWHERE,
-  MATCH_BOUNDARY_ANYWHERE,
-  MATCH_BOUNDARY,
-  MATCH_BEGINNING,
-  MATCH_BEGINNING_CASE_SENSITIVE,
-} = Ci.mozIPlacesAutoComplete;
-
 // AutoComplete query type constants.
 // Describes the various types of queries that we can process rows for.
 const QUERYTYPE_FILTERED            = 0;
 const QUERYTYPE_AUTOFILL_ORIGIN     = 1;
 const QUERYTYPE_AUTOFILL_URL        = 2;
 const QUERYTYPE_ADAPTIVE            = 3;
 
 // This separator is used as an RTL-friendly way to split the title and tags.
@@ -571,17 +561,17 @@ function Search(searchString, searchPara
                 autocompleteSearch, prohibitSearchSuggestions, previousResult) {
   // We want to store the original string for case sensitive searches.
   this._originalSearchString = searchString;
   this._trimmedOriginalSearchString = searchString.trim();
   let [prefix, suffix] = stripPrefix(this._trimmedOriginalSearchString);
   this._searchString = Services.textToSubURI.unEscapeURIForUI("UTF-8", suffix);
   this._strippedPrefix = prefix.toLowerCase();
 
-  this._matchBehavior = UrlbarPrefs.get("matchBehavior");
+  this._matchBehavior = Ci.mozIPlacesAutoComplete.MATCH_BOUNDARY;
   // Set the default behavior for this search.
   this._behavior = this._searchString ? UrlbarPrefs.get("defaultBehavior")
                                       : UrlbarPrefs.get("emptySearchDefaultBehavior");
 
   let params = new Set(searchParam.split(" "));
   this._enableActions = params.has("enable-actions");
   this._disablePrivateActions = params.has("disable-private-actions");
   this._inPrivateWindow = params.has("private-window");
@@ -977,24 +967,22 @@ Search.prototype = {
     }
 
     // Ideally we should wait until MATCH_BOUNDARY_ANYWHERE, but that query
     // may be really slow and we may end up showing old results for too long.
     this._cleanUpNonCurrentMatches(UrlbarUtils.MATCH_GROUP.GENERAL);
 
     this._matchAboutPages();
 
-    // If we do not have enough results, and our match type is
-    // MATCH_BOUNDARY_ANYWHERE, search again with MATCH_ANYWHERE to get more
-    // results.
+    // If we do not have enough matches search again with MATCH_ANYWHERE, to
+    // get more matches.
     let count = this._counts[UrlbarUtils.MATCH_GROUP.GENERAL] +
                 this._counts[UrlbarUtils.MATCH_GROUP.HEURISTIC];
-    if (this._matchBehavior == MATCH_BOUNDARY_ANYWHERE &&
-        count < UrlbarPrefs.get("maxRichResults")) {
-      this._matchBehavior = MATCH_ANYWHERE;
+    if (count < UrlbarPrefs.get("maxRichResults")) {
+      this._matchBehavior = Ci.mozIPlacesAutoComplete.MATCH_ANYWHERE;
       for (let [query, params] of [ this._adaptiveQuery,
                                     this._searchQuery ]) {
         await conn.executeCached(query, params, this._onResultRow.bind(this));
         if (!this.pending)
           return;
       }
     }
 
--- a/toolkit/components/places/mozIPlacesAutoComplete.idl
+++ b/toolkit/components/places/mozIPlacesAutoComplete.idl
@@ -14,16 +14,19 @@ interface nsIURI;
  * purposes.
  */
 [scriptable, uuid(61b6348a-09e1-4810-8057-f8cb3cec6ef8)]
 interface mozIPlacesAutoComplete : nsISupports
 {
   //////////////////////////////////////////////////////////////////////////////
   //// Matching Constants
 
+  // A few of these are not used in Firefox, but are still referenced in
+  // comm-central.
+
   /**
    * Match anywhere in each searchable term.
    */
   const long MATCH_ANYWHERE = 0;
 
   /**
    * Match first on word boundaries, and if we do not get enough results, then
    * match anywhere in each searchable term.
--- a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
+++ b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
@@ -314,23 +314,25 @@ var addBookmark = async function(aBookma
   await PlacesUtils.bookmarks.insert({
     parentGuid: PlacesUtils.bookmarks.unfiledGuid,
     title: aBookmarkObj.title || "A bookmark",
     url: aBookmarkObj.uri,
   });
 
   if (aBookmarkObj.keyword) {
     await PlacesUtils.keywords.insert({ keyword: aBookmarkObj.keyword,
-                                        url: aBookmarkObj.uri.spec ? aBookmarkObj.uri.spec : aBookmarkObj.uri,
+                                        url: aBookmarkObj.uri instanceof Ci.nsIURI ? aBookmarkObj.uri.spec : aBookmarkObj.uri,
                                         postData: aBookmarkObj.postData,
                                       });
   }
 
   if (aBookmarkObj.tags) {
-    PlacesUtils.tagging.tagURI(aBookmarkObj.uri, aBookmarkObj.tags);
+    let uri = aBookmarkObj.uri instanceof Ci.nsIURI ?
+      aBookmarkObj.uri : Services.io.newURI(aBookmarkObj.uri);
+    PlacesUtils.tagging.tagURI(uri, aBookmarkObj.tags);
   }
 };
 
 function addOpenPages(aUri, aCount = 1, aUserContextId = 0) {
   for (let i = 0; i < aCount; i++) {
     UrlbarProviderOpenTabs.registerOpenTab(aUri.spec, aUserContextId);
   }
 }
deleted file mode 100644
--- a/toolkit/components/places/tests/unifiedcomplete/test_match_beginning.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Test bug 451760 which allows matching only at the beginning of urls or
- * titles to simulate Firefox 2 functionality.
- */
-
-add_task(async function test_match_beginning() {
-  Services.prefs.setBoolPref("browser.urlbar.autoFill", false);
-
-  let uri1 = NetUtil.newURI("http://x.com/y");
-  let uri2 = NetUtil.newURI("https://y.com/x");
-  await PlacesTestUtils.addVisits([
-    { uri: uri1, title: "a b" },
-    { uri: uri2, title: "b a" },
-  ]);
-
-  info("Match at the beginning of titles");
-  Services.prefs.setIntPref("browser.urlbar.matchBehavior", 3);
-  await check_autocomplete({
-    search: "a",
-    matches: [ { uri: uri1, title: "a b" } ],
-  });
-
-  info("Match at the beginning of titles");
-  await check_autocomplete({
-    search: "b",
-    matches: [ { uri: uri2, title: "b a" } ],
-  });
-
-  info("Match at the beginning of urls");
-  await check_autocomplete({
-    search: "x",
-    matches: [ { uri: uri1, title: "a b" } ],
-  });
-
-  info("Match at the beginning of urls");
-  await check_autocomplete({
-    search: "y",
-    matches: [ { uri: uri2, title: "b a" } ],
-  });
-
-  info("Sanity check that matching anywhere finds more");
-  Services.prefs.setIntPref("browser.urlbar.matchBehavior", 1);
-  await check_autocomplete({
-    search: "a",
-    matches: [ { uri: uri1, title: "a b" },
-               { uri: uri2, title: "b a" } ],
-  });
-
-  await cleanup();
-});
--- a/toolkit/components/places/tests/unifiedcomplete/test_word_boundary_search.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_word_boundary_search.js
@@ -1,176 +1,197 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
- * Test bug 393678 to make sure matches against the url, title, tags are only
- * made on word boundaries instead of in the middle of words.
+ * Test to make sure matches against the url, title, tags are first made on word
+ * boundaries, instead of in the middle of words, and later are extended to the
+ * whole words. For this test it is critical to check sorting of the matches.
  *
  * Make sure we don't try matching one after a CamelCase because the upper-case
  * isn't really a word boundary. (bug 429498)
- *
- * Bug 429531 provides switching between "must match on word boundary" and "can
- * match," so leverage "must match" pref for checking word boundary logic and
- * make sure "can match" matches anywhere.
  */
 
 var katakana = ["\u30a8", "\u30c9"]; // E, Do
 var ideograph = ["\u4efb", "\u5929", "\u5802"]; // Nin Ten Do
 
 add_task(async function test_escape() {
   Services.prefs.setBoolPref("browser.urlbar.autoFill.searchEngines", false);
   Services.prefs.setBoolPref("browser.urlbar.autoFill", false);
 
-  let uri1 = NetUtil.newURI("http://matchme/");
-  let uri2 = NetUtil.newURI("http://dontmatchme/");
-  let uri3 = NetUtil.newURI("http://title/1");
-  let uri4 = NetUtil.newURI("http://title/2");
-  let uri5 = NetUtil.newURI("http://tag/1");
-  let uri6 = NetUtil.newURI("http://tag/2");
-  let uri7 = NetUtil.newURI("http://crazytitle/");
-  let uri8 = NetUtil.newURI("http://katakana/");
-  let uri9 = NetUtil.newURI("http://ideograph/");
-  let uri10 = NetUtil.newURI("http://camel/pleaseMatchMe/");
-
   await PlacesTestUtils.addVisits([
-    { uri: uri1, title: "title1" },
-    { uri: uri2, title: "title1" },
-    { uri: uri3, title: "matchme2" },
-    { uri: uri4, title: "dontmatchme3" },
-    { uri: uri5, title: "title1" },
-    { uri: uri6, title: "title1" },
-    { uri: uri7, title: "!@#$%^&*()_+{}|:<>?word" },
-    { uri: uri8, title: katakana.join("") },
-    { uri: uri9, title: ideograph.join("") },
-    { uri: uri10, title: "title1" },
+    { uri: "http://matchme/", title: "title1" },
+    { uri: "http://dontmatchme/", title: "title1" },
+    { uri: "http://title/1", title: "matchme2" },
+    { uri: "http://title/2", title: "dontmatchme3" },
+    { uri: "http://tag/1", title: "title1" },
+    { uri: "http://tag/2", title: "title1" },
+    { uri: "http://crazytitle/", title: "!@#$%^&*()_+{}|:<>?word" },
+    { uri: "http://katakana/", title: katakana.join("") },
+    { uri: "http://ideograph/", title: ideograph.join("") },
+    { uri: "http://camel/pleaseMatchMe/", title: "title1" },
   ]);
-  await addBookmark( { uri: uri5, title: "title1", tags: [ "matchme2" ] } );
-  await addBookmark( { uri: uri6, title: "title1", tags: [ "dontmatchme3" ] } );
-
-  // match only on word boundaries
-  Services.prefs.setIntPref("browser.urlbar.matchBehavior", 2);
+  await addBookmark( { uri: "http://tag/1", title: "title1", tags: [ "matchme2" ] } );
+  await addBookmark( { uri: "http://tag/2", title: "title1", tags: [ "dontmatchme3" ] } );
 
   info("Match 'match' at the beginning or after / or on a CamelCase");
   await check_autocomplete({
     search: "match",
-    matches: [ { uri: uri1, title: "title1" },
-               { uri: uri3, title: "matchme2" },
-               { uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "bookmark-tag" ] },
-               { uri: uri10, title: "title1" } ],
+    checkSorting: true,
+    matches: [
+      { uri: "http://tag/1", title: "title1", tags: [ "matchme2" ], style: [ "bookmark-tag" ] },
+      { uri: "http://camel/pleaseMatchMe/", title: "title1" },
+      { uri: "http://title/1", title: "matchme2" },
+      { uri: "http://matchme/", title: "title1" },
+      { uri: "http://tag/2", title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] },
+      { uri: "http://title/2", title: "dontmatchme3" },
+      { uri: "http://dontmatchme/", title: "title1" },
+    ],
   });
 
   info("Match 'dont' at the beginning or after /");
   await check_autocomplete({
     search: "dont",
-    matches: [ { uri: uri2, title: "title1" },
-               { uri: uri4, title: "dontmatchme3" },
-               { uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] } ],
+    checkSorting: true,
+    matches: [
+      { uri: "http://tag/2", title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] },
+      { uri: "http://title/2", title: "dontmatchme3" },
+      { uri: "http://dontmatchme/", title: "title1" },
+    ],
   });
 
   info("Match 'match' at the beginning or after / or on a CamelCase");
   await check_autocomplete({
     search: "2",
-    matches: [ { uri: uri3, title: "matchme2" },
-               { uri: uri4, title: "dontmatchme3" },
-               { uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "bookmark-tag" ] },
-               { uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] } ],
+    checkSorting: true,
+    matches: [
+      { uri: "http://tag/2", title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] },
+      { uri: "http://tag/1", title: "title1", tags: [ "matchme2" ], style: [ "bookmark-tag" ] },
+      { uri: "http://title/2", title: "dontmatchme3" },
+      { uri: "http://title/1", title: "matchme2" },
+    ],
   });
 
   info("Match 't' at the beginning or after /");
   await check_autocomplete({
     search: "t",
-    matches: [ { uri: uri1, title: "title1" },
-               { uri: uri2, title: "title1" },
-               { uri: uri3, title: "matchme2" },
-               { uri: uri4, title: "dontmatchme3" },
-               { uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "bookmark-tag" ] },
-               { uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] },
-               { uri: uri10, title: "title1" } ],
+    checkSorting: true,
+    matches: [
+      { uri: "http://tag/2", title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] },
+      { uri: "http://tag/1", title: "title1", tags: [ "matchme2" ], style: [ "bookmark-tag" ] },
+      { uri: "http://camel/pleaseMatchMe/", title: "title1" },
+      { uri: "http://title/2", title: "dontmatchme3" },
+      { uri: "http://title/1", title: "matchme2" },
+      { uri: "http://dontmatchme/", title: "title1" },
+      { uri: "http://matchme/", title: "title1" },
+      { uri: "http://katakana/", title: katakana.join("") },
+      { uri: "http://crazytitle/", title: "!@#$%^&*()_+{}|:<>?word" },
+    ],
   });
 
   info("Match 'word' after many consecutive word boundaries");
   await check_autocomplete({
     search: "word",
-    matches: [ { uri: uri7, title: "!@#$%^&*()_+{}|:<>?word" } ],
+    checkSorting: true,
+    matches: [
+      { uri: "http://crazytitle/", title: "!@#$%^&*()_+{}|:<>?word" },
+    ],
   });
 
   info("Match a word boundary '/' for everything");
   await check_autocomplete({
     search: "/",
-    matches: [ { uri: uri1, title: "title1" },
-               { uri: uri2, title: "title1" },
-               { uri: uri3, title: "matchme2" },
-               { uri: uri4, title: "dontmatchme3" },
-               { uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "bookmark-tag" ] },
-               { uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] },
-               { uri: uri7, title: "!@#$%^&*()_+{}|:<>?word" },
-               { uri: uri8, title: katakana.join("") },
-               { uri: uri9, title: ideograph.join("") },
-               { uri: uri10, title: "title1" } ],
+    checkSorting: true,
+    matches: [
+      { uri: "http://tag/2", title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] },
+      { uri: "http://tag/1", title: "title1", tags: [ "matchme2" ], style: [ "bookmark-tag" ] },
+      { uri: "http://camel/pleaseMatchMe/", title: "title1" },
+      { uri: "http://ideograph/", title: ideograph.join("") },
+      { uri: "http://katakana/", title: katakana.join("") },
+      { uri: "http://crazytitle/", title: "!@#$%^&*()_+{}|:<>?word" },
+      { uri: "http://title/2", title: "dontmatchme3" },
+      { uri: "http://title/1", title: "matchme2" },
+      { uri: "http://dontmatchme/", title: "title1" },
+      { uri: "http://matchme/", title: "title1" },
+    ],
   });
 
   info("Match word boundaries '()_+' that are among word boundaries");
   await check_autocomplete({
     search: "()_+",
-    matches: [ { uri: uri7, title: "!@#$%^&*()_+{}|:<>?word" } ],
+    checkSorting: true,
+    matches: [
+      { uri: "http://crazytitle/", title: "!@#$%^&*()_+{}|:<>?word" },
+    ],
   });
 
   info("Katakana characters form a string, so match the beginning");
   await check_autocomplete({
     search: katakana[0],
-    matches: [ { uri: uri8, title: katakana.join("") } ],
+    checkSorting: true,
+    matches: [
+      { uri: "http://katakana/", title: katakana.join("") },
+    ],
   });
 
 /*
-  do_print("Middle of a katakana word shouldn't be matched");
-  yield check_autocomplete({
+  info("Middle of a katakana word shouldn't be matched");
+  await check_autocomplete({
     search: katakana[1],
-    matches: [ ]
+    matches: [ ],
   });
 */
+
  info("Ideographs are treated as words so 'nin' is one word");
   await check_autocomplete({
     search: ideograph[0],
-    matches: [ { uri: uri9, title: ideograph.join("") } ],
+    checkSorting: true,
+    matches: [ { uri: "http://ideograph/", title: ideograph.join("") } ],
   });
 
  info("Ideographs are treated as words so 'ten' is another word");
   await check_autocomplete({
     search: ideograph[1],
-    matches: [ { uri: uri9, title: ideograph.join("") } ],
+    checkSorting: true,
+    matches: [ { uri: "http://ideograph/", title: ideograph.join("") } ],
   });
 
  info("Ideographs are treated as words so 'do' is yet another word");
   await check_autocomplete({
     search: ideograph[2],
-    matches: [ { uri: uri9, title: ideograph.join("") } ],
+    checkSorting: true,
+    matches: [ { uri: "http://ideograph/", title: ideograph.join("") } ],
   });
 
- info("Extra negative assert that we don't match in the middle");
+ info("Match in the middle. Should just be sorted by frecency.");
   await check_autocomplete({
     search: "ch",
-    matches: [ ],
+    checkSorting: true,
+    matches: [
+      { uri: "http://tag/2", title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] },
+      { uri: "http://tag/1", title: "title1", tags: [ "matchme2" ], style: [ "bookmark-tag" ] },
+      { uri: "http://camel/pleaseMatchMe/", title: "title1" },
+      { uri: "http://title/2", title: "dontmatchme3" },
+      { uri: "http://title/1", title: "matchme2" },
+      { uri: "http://dontmatchme/", title: "title1" },
+      { uri: "http://matchme/", title: "title1" },
+    ],
   });
 
- info("Don't match one character after a camel-case word boundary (bug 429498)");
+ // Also this test should just be sorted by frecency.
+ info("Don't match one character after a camel-case word boundary (bug 429498). Should just be sorted by frecency.");
   await check_autocomplete({
     search: "atch",
-    matches: [ ],
-  });
-
-  // match against word boundaries and anywhere
-  Services.prefs.setIntPref("browser.urlbar.matchBehavior", 1);
-
-  await check_autocomplete({
-    search: "tch",
-    matches: [ { uri: uri1, title: "title1" },
-               { uri: uri2, title: "title1" },
-               { uri: uri3, title: "matchme2" },
-               { uri: uri4, title: "dontmatchme3" },
-               { uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "bookmark-tag" ] },
-               { uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] },
-               { uri: uri10, title: "title1" } ],
+    checkSorting: true,
+    matches: [
+      { uri: "http://tag/2", title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] },
+      { uri: "http://tag/1", title: "title1", tags: [ "matchme2" ], style: [ "bookmark-tag" ] },
+      { uri: "http://camel/pleaseMatchMe/", title: "title1" },
+      { uri: "http://title/2", title: "dontmatchme3" },
+      { uri: "http://title/1", title: "matchme2" },
+      { uri: "http://dontmatchme/", title: "title1" },
+      { uri: "http://matchme/", title: "title1" },
+    ],
   });
 
   await cleanup();
 });
--- a/toolkit/components/places/tests/unifiedcomplete/xpcshell.ini
+++ b/toolkit/components/places/tests/unifiedcomplete/xpcshell.ini
@@ -35,17 +35,16 @@ support-files =
 [test_encoded_urls.js]
 [test_escape_self.js]
 [test_extension_matches.js]
 [test_history_autocomplete_tags.js]
 [test_ignore_protocol.js]
 [test_keyword_search.js]
 [test_keyword_search_actions.js]
 [test_keywords.js]
-[test_match_beginning.js]
 [test_multi_word_search.js]
 [test_PlacesSearchAutocompleteProvider.js]
 skip-if = appname == "thunderbird"
 [test_preloaded_sites.js]
 [test_query_url.js]
 [test_remote_tab_matches.js]
 skip-if = !sync
 [test_search_engine_alias.js]