[Pkg-mozext-commits] [tabmixplus] 07/10: Remove Array.forEach generics usage, follow up bug 1228975

David Prévot taffit at moszumanska.debian.org
Tue Dec 29 19:03:19 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag 0.4.2.1pre.151226a1
in repository tabmixplus.

commit 0e17dba0715b2b4bf5398e1cf936222acbe78bdc
Author: onemen <tabmix.onemen at gmail.com>
Date:   Thu Dec 24 15:30:28 2015 +0200

    Remove Array.forEach generics usage, follow up bug 1228975
---
 chrome/content/minit/tabView.js                           | 9 +++------
 chrome/content/places/places.js                           | 8 ++++----
 chrome/content/preferences/preferences.js                 | 4 ++--
 chrome/content/preferences/subdialogs/pref-appearance.js  | 5 +++--
 chrome/content/preferences/subdialogs/pref-appearance.xml | 2 +-
 chrome/content/session/session.js                         | 8 ++++----
 chrome/content/tab/tab.js                                 | 7 +++++--
 chrome/content/tabmix.js                                  | 2 +-
 8 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/chrome/content/minit/tabView.js b/chrome/content/minit/tabView.js
index 0e28047..83b327c 100644
--- a/chrome/content/minit/tabView.js
+++ b/chrome/content/minit/tabView.js
@@ -158,11 +158,8 @@
       'this.',
       'UI.', {flags: "g", silent: true}
     )._replace(
-      'items = TabItems.getItems();',
-      'items = gBrowser.tabs;'
-    )._replace(
       /items\.forEach\(function\s*\(item\)\s*{/,
-      'Array.forEach(items, function(tab) { \
+      'Array.prototype.forEach.call(gBrowser.tabs, function(tab) { \
        if (tab.pinned) return;\
        let item = tab._tabViewTabItem;'
     )._replace(
@@ -457,7 +454,7 @@
 
         // update tabs data
         let groupID = newGroupsData.activeGroupId;
-        Array.forEach(gBrowser.tabs, function(tab) {
+        for (let tab of gBrowser.tabs) {
           if (tab.pinned || tab.hidden || tab.closing || blankTabs.indexOf(tab) > -1)
             return;
           let data = {groupID: groupID};
@@ -465,7 +462,7 @@
           TabmixSvc.ss.setTabValue(tab, "tabview-tab", data);
           if (this.enableBackup)
             this.setLiteral(this.getNodeForTab(tab), "tabview-tab", data);
-        }, TabmixSessionManager);
+        }
       }
       return;
     }
diff --git a/chrome/content/places/places.js b/chrome/content/places/places.js
index 41ef7a2..ff54930 100644
--- a/chrome/content/places/places.js
+++ b/chrome/content/places/places.js
@@ -405,9 +405,9 @@ var TMP_Places = {
     this._titlefrombookmark = aPrefValue;
 
     if (aPrefValue) {
-      Array.forEach(gBrowser.tabs, function(tab) {
+      for (let tab of gBrowser.tabs) {
         this.setTabTitle(tab);
-      }, this);
+      }
       this.startObserver();
     } else {
       let tabs = gBrowser.tabContainer.getElementsByAttribute("tabmix_bookmarkId", "*");
@@ -443,7 +443,7 @@ var TMP_Places = {
       [aItemId, aUrl] = [[aItemId], [aUrl]];
 
     let getIndex = url => aUrl.indexOf(url) + 1;
-    Array.forEach(gBrowser.tabs, function(tab) {
+    for (let tab of gBrowser.tabs) {
       let url = tab.linkedBrowser.currentURI.spec;
       if (this.isUserRenameTab(tab, url))
         return;
@@ -452,7 +452,7 @@ var TMP_Places = {
         tab.setAttribute("tabmix_bookmarkId", aItemId[index - 1]);
         this.setTabTitle(tab, url);
       }
-    }, this);
+    }
     this.afterTabTitleChanged();
   },
 
diff --git a/chrome/content/preferences/preferences.js b/chrome/content/preferences/preferences.js
index 3012c58..35e5ed0 100644
--- a/chrome/content/preferences/preferences.js
+++ b/chrome/content/preferences/preferences.js
@@ -187,11 +187,11 @@ var gPrefWindow = { // jshint ignore:line
     var broadcasters = $(paneID + ":Broadcaster");
     if (!broadcasters)
       return;
-    Array.forEach(broadcasters.childNodes, function(broadcaster) {
+    for (let broadcaster of broadcasters.childNodes) {
       let preference = $(broadcaster.id.replace("obs", "pref"));
       if (preference)
         this.updateBroadcaster(preference, broadcaster);
-    }, this);
+    }
   },
 
   updateBroadcaster: function(aPreference, aBroadcaster) {
diff --git a/chrome/content/preferences/subdialogs/pref-appearance.js b/chrome/content/preferences/subdialogs/pref-appearance.js
index c41d2e1..9029a16 100644
--- a/chrome/content/preferences/subdialogs/pref-appearance.js
+++ b/chrome/content/preferences/subdialogs/pref-appearance.js
@@ -29,9 +29,10 @@ var tabstyles = { // jshint ignore:line
   },
 
   cancel: function() {
-    Array.forEach($("stylespanels").childNodes, function(panel) {
+    let panels = $("stylespanels").childNodes;
+    for (let panel of panels) {
       $(panel.id)._ondialogcancel();
-    });
+    }
     this.save();
   },
 
diff --git a/chrome/content/preferences/subdialogs/pref-appearance.xml b/chrome/content/preferences/subdialogs/pref-appearance.xml
index d62c42e..c9ff372 100644
--- a/chrome/content/preferences/subdialogs/pref-appearance.xml
+++ b/chrome/content/preferences/subdialogs/pref-appearance.xml
@@ -237,7 +237,7 @@
 
       <constructor>
         <![CDATA[
-          Array.forEach(["red","green","blue", "opacity"], function(id) {
+          ["red","green","blue", "opacity"].forEach(function(id) {
             this._RGB.push(document.getAnonymousElementByAttribute(this, "anonid", id));
           }, this);
 
diff --git a/chrome/content/session/session.js b/chrome/content/session/session.js
index 388e8d6..b281bcb 100644
--- a/chrome/content/session/session.js
+++ b/chrome/content/session/session.js
@@ -2542,9 +2542,9 @@ var TabmixSessionManager = { // jshint ignore:line
     if (tabview) {
       if (aBackup) {
         // update all tabs when we enter/exit panorama
-        Array.forEach(gBrowser.tabs, function SM_saveTabViewData_forEach(tab) {
+        for (let tab of gBrowser.tabs) {
           this.saveTabviewTab(this.getNodeForTab(tab), tab);
-        }, this);
+        }
       } else {
         // force Tabview to save when we save all window data
         // we will collect the data from SessionStore
@@ -3383,9 +3383,9 @@ var TabmixSessionManager = { // jshint ignore:line
     // when resuming at startup: add additionally requested pages to the end
     if (caller == "firstwindowopen" && loadOnStartup.length) {
       let lastPlace = gBrowser.tabs.length - 1;
-      Array.forEach(loadOnStartup, function(aTab) {
+      for (let aTab of loadOnStartup) {
         gBrowser.moveTabTo(aTab, lastPlace);
-      });
+      }
     }
 
     TMP_ClosedTabs.setButtonDisableState();
diff --git a/chrome/content/tab/tab.js b/chrome/content/tab/tab.js
index 385ae06..7990338 100644
--- a/chrome/content/tab/tab.js
+++ b/chrome/content/tab/tab.js
@@ -1944,8 +1944,11 @@ var gTMPprefObserver = {
      *  changed unloaded or unread preference we need to set the proper tab
      *  style for each tab
      */
-    if (styleName == "unloaded" || styleName == "unread")
-      Array.forEach(gBrowser.tabs, tab => Tabmix.setTabStyle(tab));
+    if (styleName == "unloaded" || styleName == "unread") {
+      for (let tab of gBrowser.tabs) {
+        Tabmix.setTabStyle(tab);
+      }
+    }
 
     let isBold = function(attrib) {
       attrib = attrib.split(" ");
diff --git a/chrome/content/tabmix.js b/chrome/content/tabmix.js
index eb9745b..64de9aa 100644
--- a/chrome/content/tabmix.js
+++ b/chrome/content/tabmix.js
@@ -1060,7 +1060,7 @@ var TMP_eventListener = {
     var isLastWindow = Tabmix.numberOfWindows() === 0;
     // we close tabmix dialog windows on exit
     if (isLastWindow) {
-      Array.forEach(["tabmixopt-filetype", "tabmixopt-appearance", "tabmixopt"], function(aID) {
+      ["tabmixopt-filetype", "tabmixopt-appearance", "tabmixopt"].forEach(function(aID) {
         var win = Services.wm.getMostRecentWindow("mozilla:" + aID);
         if (win) {
           if (aID != "tabmixopt")

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git



More information about the Pkg-mozext-commits mailing list