Backed out changeset 7f536b6a56e9 (bug 1456565) for Linting failures on a CLOSED TREE
authorNoemi Erli <nerli@mozilla.com>
Fri, 27 Apr 2018 02:12:56 +0300
changeset 472002 524b315d2e190c4eb7ebbde768c27ecbc3df1f63
parent 472001 4e857676a1a54ca6d8f3acc9883c66f4c88176d9
child 472003 787d7f8d7a5d35675639e03cd8a59a1f91e88f00
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1456565
milestone61.0a1
backs out7f536b6a56e9a5bde853b6b6b18f1864a3cdeb92
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 7f536b6a56e9 (bug 1456565) for Linting failures on a CLOSED TREE
intl/l10n/Localization.jsm
intl/l10n/l10n.js
--- a/intl/l10n/Localization.jsm
+++ b/intl/l10n/Localization.jsm
@@ -22,27 +22,27 @@
 /* global console */
 
 const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm", {});
 const { L10nRegistry } = ChromeUtils.import("resource://gre/modules/L10nRegistry.jsm", {});
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm", {});
 const { AppConstants } = ChromeUtils.import("resource://gre/modules/AppConstants.jsm", {});
 
 /*
- * CachedAsyncIterable caches the elements yielded by an iterable.
+ * CachedIterable caches the elements yielded by an iterable.
  *
  * It can be used to iterate over an iterable many times without depleting the
  * iterable.
  */
-class CachedAsyncIterable {
+class CachedIterable {
   /**
-   * Create an `CachedAsyncIterable` instance.
+   * Create an `CachedIterable` instance.
    *
    * @param {Iterable} iterable
-   * @returns {CachedAsyncIterable}
+   * @returns {CachedIterable}
    */
   constructor(iterable) {
     if (Symbol.asyncIterator in Object(iterable)) {
       this.iterator = iterable[Symbol.asyncIterator]();
     } else if (Symbol.iterator in Object(iterable)) {
       this.iterator = iterable[Symbol.iterator]();
     } else {
       throw new TypeError("Argument must implement the iteration protocol.");
@@ -77,26 +77,21 @@ class CachedAsyncIterable {
         return seen[cur++];
       }
     };
   }
 
   /**
    * This method allows user to consume the next element from the iterator
    * into the cache.
-   *
-   * @param {number} count - number of elements to consume
    */
-  async touchNext(count = 1) {
+  touchNext() {
     const { seen, iterator } = this;
-    let idx = 0;
-    while (idx++ < count) {
-      if (seen.length === 0 || seen[seen.length - 1].done === false) {
-        seen.push(await iterator.next());
-      }
+    if (seen.length === 0 || seen[seen.length - 1].done === false) {
+      seen.push(iterator.next());
     }
   }
 }
 
 /**
  * The default localization strategy for Gecko. It comabines locales
  * available in L10nRegistry, with locales requested by the user to
  * generate the iterator over MessageContexts.
--- a/intl/l10n/l10n.js
+++ b/intl/l10n/l10n.js
@@ -41,17 +41,17 @@
       el => el.getAttribute("href")
     );
   }
 
   const resourceIds = getResourceLinks(document.head || document);
 
   document.l10n = new DOMLocalization(window, resourceIds);
 
-  // Trigger the first two contexts to be loaded eagerly.
-  document.l10n.ctxs.touchNext(2);
+  // trigger first context to be fetched eagerly
+  document.l10n.ctxs.touchNext();
 
   document.l10n.ready = documentReady().then(() => {
     document.l10n.registerObservers();
     document.l10n.connectRoot(document.documentElement);
     return document.l10n.translateRoots();
   });
 }