Bug 1438613 - Remove explicit observer unregistering from Fluent. r=mossop
authorZibi Braniecki <zbraniecki@mozilla.com>
Thu, 15 Feb 2018 11:06:52 -0800
changeset 766776 9d275eddaf34be73799b1909272299e6609e94ca
parent 766775 6bdeea20331f82fadd61cfd4cb6cbfb954986872
child 766777 2222a3f4ae1b0ab8bea4ae6e656a77e6be083742
push id102399
push userbmo:mratcliffe@mozilla.com
push dateTue, 13 Mar 2018 10:12:19 +0000
reviewersmossop
bugs1438613
milestone60.0a1
Bug 1438613 - Remove explicit observer unregistering from Fluent. r=mossop MozReview-Commit-ID: 3SavwzU9ZQD
intl/l10n/Localization.jsm
intl/l10n/l10n.js
--- a/intl/l10n/Localization.jsm
+++ b/intl/l10n/Localization.jsm
@@ -242,23 +242,16 @@ class Localization {
   /**
    * Register weak observers on events that will trigger cache invalidation
    */
   registerObservers() {
     Services.obs.addObserver(this, "intl:app-locales-changed", true);
   }
 
   /**
-   * Unregister observers on events that will trigger cache invalidation
-   */
-  unregisterObservers() {
-    Services.obs.removeObserver(this, "intl:app-locales-changed");
-  }
-
-  /**
    * Default observer handler method.
    *
    * @param {String} subject
    * @param {String} topic
    * @param {Object} data
    */
   observe(subject, topic, data) {
     switch (topic) {
--- a/intl/l10n/l10n.js
+++ b/intl/l10n/l10n.js
@@ -55,15 +55,12 @@
 
   document.l10n = new DOMLocalization(window, resourceIds);
 
   // trigger first context to be fetched eagerly
   document.l10n.ctxs.touchNext();
 
   document.l10n.ready = documentReady(() => {
     document.l10n.registerObservers();
-    window.addEventListener("unload", () => {
-      document.l10n.unregisterObservers();
-    });
     document.l10n.connectRoot(document.documentElement);
     return document.l10n.translateRoots();
   });
 }