Bug 1399191 - Use an arrow function to avoid an undefined this value when calling namedTimer. r=markh
authorThom Chiovoloni <tchiovoloni@mozilla.com>
Tue, 12 Sep 2017 10:12:37 -0700
changeset 429940 b8cb090f952bc1e9837222586d205c00fd53a78f
parent 429939 5b700335fc30f2faf8aa12c9e38bc05e6c1e5e22
child 429941 2a131a0c2d11563c36a513599a138c0e6a2ab277
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs1399191
milestone57.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 1399191 - Use an arrow function to avoid an undefined this value when calling namedTimer. r=markh MozReview-Commit-ID: 2VwzGtAIYz7
services/sync/tps/extensions/tps/resource/tps.jsm
--- a/services/sync/tps/extensions/tps/resource/tps.jsm
+++ b/services/sync/tps/extensions/tps/resource/tps.jsm
@@ -321,28 +321,27 @@ var TPS = {
     for (let tab of tabs) {
       Logger.logInfo("executing action " + action.toUpperCase() +
                      " on tab " + JSON.stringify(tab));
       switch (action) {
         case ACTION_ADD:
           // When adding tabs, we keep track of how many tabs we're adding,
           // and wait until we've received that many onload events from our
           // new tabs before continuing
-          let that = this;
           let taburi = tab.uri;
-          BrowserTabs.Add(tab.uri, function() {
-            that._tabsFinished++;
+          BrowserTabs.Add(tab.uri, () => {
+            this._tabsFinished++;
             Logger.logInfo("tab for " + taburi + " finished loading");
-            if (that._tabsFinished == that._tabsAdded) {
+            if (this._tabsFinished == this._tabsAdded) {
               Logger.logInfo("all tabs loaded, continuing...");
 
               // Wait some time before continuing to be sure tabs can be synced,
               // otherwise we can get 'error locating tab' (bug 1383832).
-              CommonUtils.namedTimer(function() {
-                that.FinishAsyncOperation();
+              CommonUtils.namedTimer(() => {
+                this.FinishAsyncOperation();
               }, 2500, this, "postTabsOpening");
             }
           });
           break;
         case ACTION_VERIFY:
           Logger.AssertTrue(typeof(tab.profile) != "undefined",
             "profile must be defined when verifying tabs");
           Logger.AssertTrue(