Backed out changeset fa1babb9fbda (bug 1630983) for causing newtab failures in TopSitesFeed.jsm
authorMihai Alexandru Michis <malexandru@mozilla.com>
Fri, 22 May 2020 21:05:09 +0300
changeset 531662 3b2e18ed6a65a1a23f457d99173124c48ca24fcc
parent 531661 9d72065152194d20ccdfca72dabc434931a5c369
child 531663 7a0d743a562801191a8c70028164047ab0b6557d
push id37441
push userapavel@mozilla.com
push dateFri, 22 May 2020 21:38:53 +0000
treeherdermozilla-central@d6abd35b54ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1630983
milestone78.0a1
backs outfa1babb9fbdabbfe550000788aa58020e43d9374
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
Backed out changeset fa1babb9fbda (bug 1630983) for causing newtab failures in TopSitesFeed.jsm CLOSED TREE
browser/components/newtab/lib/TopSitesFeed.jsm
browser/components/newtab/test/browser/browser_topsites_section.js
--- a/browser/components/newtab/lib/TopSitesFeed.jsm
+++ b/browser/components/newtab/lib/TopSitesFeed.jsm
@@ -79,18 +79,16 @@ const FILTER_DEFAULT_SEARCH_PREF = "impr
 const SEARCH_FILTERS = [
   "google",
   "search.yahoo",
   "yahoo",
   "bing",
   "ask",
   "duckduckgo",
 ];
-const AMAZON_SEARCH_TILE_OVERRIDE_PREF =
-  "browser.newtabpage.amazonSearchTileOverride.url";
 
 function getShortURLForCurrentSearch() {
   const url = shortURL({ url: Services.search.defaultEngine.searchForm });
   return url;
 }
 
 this.TopSitesFeed = class TopSitesFeed {
   constructor() {
@@ -119,41 +117,34 @@ this.TopSitesFeed = class TopSitesFeed {
   init() {
     // If the feed was previously disabled PREFS_INITIAL_VALUES was never received
     this.refreshDefaults(
       this.store.getState().Prefs.values[DEFAULT_SITES_PREF]
     );
     this._storage = this.store.dbStorage.getDbTable("sectionPrefs");
     this.refresh({ broadcast: true });
     Services.obs.addObserver(this, "browser-search-engine-modified");
-    Services.prefs.addObserver(AMAZON_SEARCH_TILE_OVERRIDE_PREF, this);
   }
 
   uninit() {
     PageThumbs.removeExpirationFilter(this);
     Services.obs.removeObserver(this, "browser-search-engine-modified");
-    Services.prefs.removeObserver(AMAZON_SEARCH_TILE_OVERRIDE_PREF, this);
   }
 
   observe(subj, topic, data) {
     // We should update the current top sites if the search engine has been changed since
     // the search engine that gets filtered out of top sites has changed.
     if (
       topic === "browser-search-engine-modified" &&
       data === "engine-default" &&
       this.store.getState().Prefs.values[FILTER_DEFAULT_SEARCH_PREF]
     ) {
       delete this._currentSearchHostname;
       this._currentSearchHostname = getShortURLForCurrentSearch();
       this.refresh({ broadcast: true });
-    } else if (
-      topic === "nsPref:changed" &&
-      data === AMAZON_SEARCH_TILE_OVERRIDE_PREF
-    ) {
-      this.refresh({ broadcast: true });
     }
   }
 
   _dedupeKey(site) {
     return site && site.hostname;
   }
 
   refreshDefaults(sites) {
@@ -400,21 +391,16 @@ this.TopSitesFeed = class TopSitesFeed {
     // Remove adult sites if we need to
     const checkedAdult = this.store.getState().Prefs.values.filterAdult
       ? filterAdult(dedupedUnpinned)
       : dedupedUnpinned;
 
     // Insert the original pinned sites into the deduped frecent and defaults
     const withPinned = insertPinned(checkedAdult, pinned).slice(0, numItems);
 
-    const amazonSearchTileOverrideURL = Services.prefs.getStringPref(
-      AMAZON_SEARCH_TILE_OVERRIDE_PREF,
-      ""
-    );
-
     // Now, get a tippy top icon, a rich icon, or screenshot for every item
     for (const link of withPinned) {
       if (link) {
         // If there is a custom screenshot this is the only image we display
         if (link.customScreenshotURL) {
           this._fetchScreenshot(link, link.customScreenshotURL);
         } else if (link.searchTopSite && !link.isDefault) {
           this._tippyTopProvider.processSite(link);
@@ -422,24 +408,16 @@ this.TopSitesFeed = class TopSitesFeed {
           this._fetchIcon(link);
         }
 
         // Remove internal properties that might be updated after dispatch
         delete link.__sharedCache;
 
         // Indicate that these links should get a frecency bonus when clicked
         link.typedBonus = true;
-
-        if (amazonSearchTileOverrideURL) {
-          if (link.searchTopSite && link.label === "@amazon") {
-            delete link.searchTopSite;
-            delete link.label;
-            link.url = amazonSearchTileOverrideURL;
-          }
-        }
       }
     }
 
     return withPinned;
   }
 
   /**
    * Refresh the top sites data for content.
--- a/browser/components/newtab/test/browser/browser_topsites_section.js
+++ b/browser/components/newtab/test/browser/browser_topsites_section.js
@@ -194,26 +194,8 @@ test_newtab({
       "We clicked a search topsite the focus should be in location bar"
     );
     ok(
       gURLBar.value.includes(searchTopSiteTag),
       "Should contain the tag of the search topsite clicked"
     );
   },
 });
-
-test_newtab({
-  async before() {
-    await setDefaultTopSites();
-    Services.prefs.setStringPref(
-      "browser.newtabpage.amazonSearchTileOverride.url",
-      "https://imaginarydomain.org/"
-    );
-  },
-  test: async function test_search_topsite_override() {
-    // Stub, expand in bug 1637219.
-  },
-  after() {
-    Services.prefs.clearUserPref(
-      "browser.newtabpage.amazonSearchTileOverride.url"
-    );
-  },
-});