Bug 1518786 - Remove translations from the pending queue if there is a caller that is waiting on the specific translations. r=zbraniecki
authorJared Wein <jwein@mozilla.com>
Wed, 16 Jan 2019 20:54:36 +0000
changeset 514138 cfbd8823f3c5b9cfea52d1a519f0b0d2a4aa2345
parent 514137 2677d2e45ead735f352edc4ef3d46c4ce9d2e9ce
child 514139 d4b7dbc0379f7166366dea5fcd45200ffc065c25
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerszbraniecki
bugs1518786
milestone66.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 1518786 - Remove translations from the pending queue if there is a caller that is waiting on the specific translations. r=zbraniecki Differential Revision: https://phabricator.services.mozilla.com/D16588
intl/l10n/DOMLocalization.jsm
--- a/intl/l10n/DOMLocalization.jsm
+++ b/intl/l10n/DOMLocalization.jsm
@@ -750,16 +750,22 @@ class DOMLocalization extends Localizati
    * @param   {Array<Element>} elements - List of elements to be translated
    * @returns {Promise}
    */
   async translateElements(elements) {
     if (!elements.length) {
       return undefined;
     }
 
+    // Remove elements from the pending list since
+    // their translations will get applied below.
+    for (let element of elements) {
+      this.pendingElements.delete(element);
+    }
+
     const keys = elements.map(this.getKeysForElement);
     const translations = await this.formatMessages(keys);
     return this.applyTranslations(elements, translations);
   }
 
   /**
    * Applies translations onto elements.
    *