Bug 1211726 - fix array with titles, r?gijs draft
authorSvetlana Orlik <sveta.orlik.code@gmail.com>
Thu, 22 Dec 2016 22:24:48 +0300
changeset 453345 4faa9a83ec3870040e7fc8e19a6df813d48b77ec
parent 453344 049175faa551cc48b9dfe0b81cbdb493158c3844
child 453346 dbb512dd51cdd3c969c6ae458d7c2b977228848d
push id39636
push userbmo:sveta.orlik.code@gmail.com
push dateFri, 23 Dec 2016 07:50:26 +0000
reviewersgijs
bugs1211726
milestone53.0a1
Bug 1211726 - fix array with titles, r?gijs MozReview-Commit-ID: 6uKFJooJCgM
toolkit/components/places/UnifiedComplete.js
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.js
@@ -3,26 +3,16 @@
  * 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/. */
 
 "use strict";
 
 // Constants
 
-//--------------------------------------------------------------------
-const TOP500_SITES = [
-  ["Google.com", "Enables users to search the world's information, including webpages, images, and videos."],
-  ["Youtube.com", "User-submitted videos with rating, comments, and contests."],
-  ["Facebook.com", "A social utility that connects people, to keep up with friends, upload photos, share links and..."],
-  ["Baidu.com", 'The leading Chinese language search engine, provides "simple and reliable" search'],
-  ["Wikipedia.org", "A free encyclopedia built collaboratively using wiki software."],
-];
-//--------------------------------------------------------------------
-
 const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
 
 // Match type constants.
 // These indicate what type of search function we should be using.
 const MATCH_ANYWHERE = Ci.mozIPlacesAutoComplete.MATCH_ANYWHERE;
 const MATCH_BOUNDARY_ANYWHERE = Ci.mozIPlacesAutoComplete.MATCH_BOUNDARY_ANYWHERE;
 const MATCH_BOUNDARY = Ci.mozIPlacesAutoComplete.MATCH_BOUNDARY;
 const MATCH_BEGINNING = Ci.mozIPlacesAutoComplete.MATCH_BEGINNING;
@@ -63,16 +53,24 @@ const QUERYTYPE_FILTERED            = 0;
 const QUERYTYPE_AUTOFILL_HOST       = 1;
 const QUERYTYPE_AUTOFILL_URL        = 2;
 
 // This separator is used as an RTL-friendly way to split the title and tags.
 // It can also be used by an nsIAutoCompleteResult consumer to re-split the
 // "comment" back into the title and the tag.
 const TITLE_TAGS_SEPARATOR = " \u2013 ";
 
+const TOP500_SITES = [
+  ["Google.com", "Google"],
+  ["Youtube.com", "YouTube"],
+  ["Facebook.com", "Facebook"],
+  ["Baidu.com", "百度一下,你就知道"],
+  ["Wikipedia.org", "Wikipedia"],
+];
+
 // Telemetry probes.
 const TELEMETRY_1ST_RESULT = "PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS";
 const TELEMETRY_6_FIRST_RESULTS = "PLACES_AUTOCOMPLETE_6_FIRST_RESULTS_TIME_MS";
 // The default frecency value used when inserting matches with unknown frecency.
 const FRECENCY_DEFAULT = 1000;
 
 // Remote matches are appended when local matches are below a given frecency
 // threshold (FRECENCY_DEFAULT) as soon as they arrive.  However we'll
@@ -1013,17 +1011,17 @@ Search.prototype = {
   }),
 
   *_matchTop500() {
     for (let [url, title] of TOP500_SITES) {
       if (url.toLowerCase().includes(this._searchString) ||
           title.toLowerCase().includes(this._searchString)) {
         let match = {
           value: url,
-          comment: url + " - " + title,  // More convenient look
+          comment: title,
           style: "bookmark",
           frecency: FRECENCY_DEFAULT + 1,
         };
         this._addMatch(match);
       };
     };
   },