Bug 1691478 - Fix detecting existing search shortcuts. r=mikedeboer
authorDão Gottwald <dao@mozilla.com>
Wed, 10 Feb 2021 17:19:29 +0000
changeset 566857 a71cb2eafb03c63d8357fc2f3dbaba4bf14561fb
parent 566856 4ffa8b3b68e8a87658c036f948b30b66c18a3d98
child 566858 f9f92a3d32a37c036705765d4bd095c7e6d40866
push id38191
push userbtara@mozilla.com
push dateThu, 11 Feb 2021 05:02:45 +0000
treeherdermozilla-central@5cbcb80f72bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer
bugs1691478
milestone87.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 1691478 - Fix detecting existing search shortcuts. r=mikedeboer Differential Revision: https://phabricator.services.mozilla.com/D104714
browser/components/newtab/lib/TopSitesFeed.jsm
--- a/browser/components/newtab/lib/TopSitesFeed.jsm
+++ b/browser/components/newtab/lib/TopSitesFeed.jsm
@@ -423,17 +423,17 @@ this.TopSitesFeed = class TopSitesFeed {
       );
 
       const tryToInsertSearchShortcut = async shortcut => {
         const nextAvailable = pinnedSites.indexOf(null);
         // Only add a search shortcut if the site isn't already pinned, we
         // haven't previously inserted it, there's space to pin it, and the
         // search engine is available in Firefox
         if (
-          !pinnedSites.find(s => s && s.hostname === shortcut.shortURL) &&
+          !pinnedSites.find(s => s && shortURL(s) === shortcut.shortURL) &&
           !prevInsertedShortcuts.includes(shortcut.shortURL) &&
           nextAvailable > -1 &&
           (await checkHasSearchEngine(shortcut.keyword))
         ) {
           const site = await this.topSiteToSearchTopSite({ url: shortcut.url });
           this._pinSiteAt(site, nextAvailable);
           pinnedSites[nextAvailable] = site;
           newInsertedShortcuts.push(shortcut.shortURL);