Bug 1685729 - Use correct notification name for region changes. r=Standard8
authorDão Gottwald <dao@mozilla.com>
Fri, 22 Jan 2021 15:08:38 +0000
changeset 564301 9755a79772b5b6f35f9b0df524cb222df0ec1fcf
parent 564300 a9d65ef97a30352d599f36ef0782e187d063517c
child 564302 1878295822f44ec2d5d20a694eba979321e64a6a
push id38134
push userapavel@mozilla.com
push dateFri, 22 Jan 2021 21:27:55 +0000
treeherdermozilla-central@5dc361e890c3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs1685729
milestone86.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 1685729 - Use correct notification name for region changes. r=Standard8 Sigh. Turns out the notification is called "browser-region", not "region-updated". "region-updated" is only added as extra data and basically redundant. (IMHO, the notification being called "browser-region-updated" and data being `null` would have been more in line with how notifications are normally set up.) Differential Revision: https://phabricator.services.mozilla.com/D102718
browser/components/newtab/lib/TopSitesFeed.jsm
--- a/browser/components/newtab/lib/TopSitesFeed.jsm
+++ b/browser/components/newtab/lib/TopSitesFeed.jsm
@@ -134,26 +134,26 @@ this.TopSitesFeed = class TopSitesFeed {
     PageThumbs.addExpirationFilter(this);
   }
 
   init() {
     // If the feed was previously disabled PREFS_INITIAL_VALUES was never received
     this._readDefaults({ isStartup: true });
     this._storage = this.store.dbStorage.getDbTable("sectionPrefs");
     Services.obs.addObserver(this, "browser-search-engine-modified");
-    Services.obs.addObserver(this, "region-updated");
+    Services.obs.addObserver(this, "browser-region");
     Services.prefs.addObserver(REMOTE_SETTING_DEFAULTS_PREF, this);
     Services.prefs.addObserver(DEFAULT_SITES_POLICY_PREF, this);
     Services.prefs.addObserver(DEFAULT_SITES_EXPERIMENTS_PREF_BRANCH, this);
   }
 
   uninit() {
     PageThumbs.removeExpirationFilter(this);
     Services.obs.removeObserver(this, "browser-search-engine-modified");
-    Services.obs.removeObserver(this, "region-updated");
+    Services.obs.removeObserver(this, "browser-region");
     Services.prefs.removeObserver(REMOTE_SETTING_DEFAULTS_PREF, this);
     Services.prefs.removeObserver(DEFAULT_SITES_POLICY_PREF, this);
     Services.prefs.removeObserver(DEFAULT_SITES_EXPERIMENTS_PREF_BRANCH, this);
   }
 
   observe(subj, topic, data) {
     switch (topic) {
       case "browser-search-engine-modified":
@@ -163,17 +163,17 @@ this.TopSitesFeed = class TopSitesFeed {
           data === "engine-default" &&
           this.store.getState().Prefs.values[FILTER_DEFAULT_SEARCH_PREF]
         ) {
           delete this._currentSearchHostname;
           this._currentSearchHostname = getShortURLForCurrentSearch();
           this.refresh({ broadcast: true });
         }
         break;
-      case "region-updated":
+      case "browser-region":
         this._readDefaults();
         break;
       case "nsPref:changed":
         if (
           data === REMOTE_SETTING_DEFAULTS_PREF ||
           data === DEFAULT_SITES_POLICY_PREF ||
           data.startsWith(DEFAULT_SITES_EXPERIMENTS_PREF_BRANCH)
         ) {