[Pkg-mozext-commits] [tabmixplus] 06/10: Remove Array.slice 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 429b1a02de7e2f7182eb1504e4376cc20f7bf3d2
Author: onemen <tabmix.onemen at gmail.com>
Date:   Thu Dec 24 15:03:21 2015 +0200

    Remove Array.slice generics usage, follow up bug 1228975
---
 chrome/content/click/click.js             | 2 +-
 chrome/content/minit/minit.js             | 2 +-
 chrome/content/minit/tablib.js            | 2 +-
 chrome/content/places/places.js           | 4 ++--
 chrome/content/preferences/preferences.js | 5 +++--
 chrome/content/tab/tab.js                 | 6 +++---
 chrome/content/tabmix.js                  | 2 +-
 modules/AsyncUtils.jsm                    | 2 +-
 modules/MergeWindows.jsm                  | 4 ++--
 modules/Shortcuts.jsm                     | 4 +++-
 10 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/chrome/content/click/click.js b/chrome/content/click/click.js
index c0e8878..8e7cc47 100644
--- a/chrome/content/click/click.js
+++ b/chrome/content/click/click.js
@@ -997,7 +997,7 @@ var TabmixAllTabs = {
     var popup = event.target;
     popup.removeEventListener("popupshown", this, false);
     let scrollBox = document.getAnonymousElementByAttribute(popup, "class", "popup-internal-box");
-    let items = Array.slice(popup.childNodes);
+    let items = Array.prototype.slice.call(popup.childNodes);
     let element = items.indexOf(this._selectedItem) < popup.childElementCount / 2 ? popup.firstChild : popup.lastChild;
     scrollBox.ensureElementIsVisible(element);
     scrollBox.ensureElementIsVisible(this._selectedItem);
diff --git a/chrome/content/minit/minit.js b/chrome/content/minit/minit.js
index 680cc59..98069de 100644
--- a/chrome/content/minit/minit.js
+++ b/chrome/content/minit/minit.js
@@ -65,7 +65,7 @@ var TMP_tabDNDObserver = {
       '\n\
         this.removeAttribute("movingBackgroundTab");\n\
         let tabs = this.getElementsByAttribute("dragged", "*");\n\
-        Array.slice(tabs).forEach(tab => tab.removeAttribute("dragged"));\n\
+        Array.prototype.slice.call(tabs).forEach(tab => tab.removeAttribute("dragged"));\n\
       $1$2'
     ).toCode();
 
diff --git a/chrome/content/minit/tablib.js b/chrome/content/minit/tablib.js
index b4eb821..8904b86 100644
--- a/chrome/content/minit/tablib.js
+++ b/chrome/content/minit/tablib.js
@@ -34,7 +34,7 @@ var tablib = { // eslint-disable-line
     Tabmix.changeCode(obj, name)._replace(
       '{',
       '$&\n' +
-      '  let args = Array.slice(arguments);\n' +
+      '  let args = Array.prototype.slice.call(arguments);\n' +
       '  if (!Tabmix.isVersion(360))\n' +
       '    args.unshift(this);\n' +
       '  var tabmixResult = tablib._loadURIWithFlags.apply(null, args);\n' +
diff --git a/chrome/content/places/places.js b/chrome/content/places/places.js
index 842f116..41ef7a2 100644
--- a/chrome/content/places/places.js
+++ b/chrome/content/places/places.js
@@ -411,7 +411,7 @@ var TMP_Places = {
       this.startObserver();
     } else {
       let tabs = gBrowser.tabContainer.getElementsByAttribute("tabmix_bookmarkId", "*");
-      Array.slice(tabs).forEach(function(tab) {
+      Array.prototype.slice.call(tabs).forEach(function(tab) {
         if (tab.hasAttribute("pending"))
           this.setTabTitle(tab);
         else
@@ -464,7 +464,7 @@ var TMP_Places = {
     const ID = "tabmix_bookmarkId";
     let batch = Array.isArray(aItemId);
     let tabs = gBrowser.tabContainer.getElementsByAttribute(ID, batch ? "*" : aItemId);
-    Array.slice(tabs).forEach(function(tab) {
+    Array.prototype.slice.call(tabs).forEach(function(tab) {
       if (!batch ||
           aItemId.indexOf(parseInt(tab.getAttribute(ID))) > -1) {
         tab.removeAttribute(ID);
diff --git a/chrome/content/preferences/preferences.js b/chrome/content/preferences/preferences.js
index cb88ce1..3012c58 100644
--- a/chrome/content/preferences/preferences.js
+++ b/chrome/content/preferences/preferences.js
@@ -73,9 +73,10 @@ var gPrefWindow = { // jshint ignore:line
     let style = window.getComputedStyle(content, "");
     let contentWidth = parseInt(style.width) + parseInt(style.marginRight) +
                        parseInt(style.marginLeft);
-    Array.slice(aPaneElement.getElementsByTagName("tabbox")).forEach(function(tabbox) {
+    let tabboxes = aPaneElement.getElementsByTagName("tabbox");
+    for (let tabbox of tabboxes) {
       diff = Math.max(diff, tabbox.boxObject.width - contentWidth);
-    });
+    }
     window.innerWidth += diff;
   },
 
diff --git a/chrome/content/tab/tab.js b/chrome/content/tab/tab.js
index 7ef9b02..385ae06 100644
--- a/chrome/content/tab/tab.js
+++ b/chrome/content/tab/tab.js
@@ -2107,7 +2107,7 @@ var gTMPprefObserver = {
       }
 
       let tabsToolbar = $("TabsToolbar");
-      let toolBar = Array.slice(tabsToolbar.childNodes);
+      let toolBar = Array.prototype.slice.call(tabsToolbar.childNodes);
       let buttonPosition = toolBar.indexOf(newTabButton);
       let tabsPosition = toolBar.indexOf(gBrowser.tabContainer);
       let scrollBox = $("tabmixScrollBox");
@@ -2274,10 +2274,10 @@ var gTMPprefObserver = {
 
     let setContext = function(command) {
       let items = document.getElementsByAttribute("command", "Browser:" + command);
-      Array.slice(items).forEach(function(item) {
+      for (let item of items) {
         if (item.localName == "toolbarbutton")
           Tabmix.setItem(item, "context", show ? "autoreload_popup" : null);
-      });
+      }
     };
     setContext("ReloadOrDuplicate");
     setContext("Stop");
diff --git a/chrome/content/tabmix.js b/chrome/content/tabmix.js
index 0cda856..eb9745b 100644
--- a/chrome/content/tabmix.js
+++ b/chrome/content/tabmix.js
@@ -1197,7 +1197,7 @@ Tabmix.initialization = {
         phase.initialized = true;
         try {
           let obj = getObj(phase.obj);
-          result = obj[key].apply(obj, Array.slice(arguments, 1));
+          result = obj[key].apply(obj, Array.prototype.slice.call(arguments, 1));
         } catch (ex) {
           Tabmix.assert(ex, phase.obj + "." + key + " failed");
         }
diff --git a/modules/AsyncUtils.jsm b/modules/AsyncUtils.jsm
index 8b03f79..73538d1 100644
--- a/modules/AsyncUtils.jsm
+++ b/modules/AsyncUtils.jsm
@@ -29,7 +29,7 @@ this.AsyncUtils = {
   promisify: function(thisArg, fn, index) {
     return function() {
       let deferred = new Deferred();
-      let args = Array.slice(arguments);
+      let args = Array.prototype.slice.call(arguments);
       if (typeof index == "undefined")
         index = args.length;
       args.splice(index, 0, deferred.callback);
diff --git a/modules/MergeWindows.jsm b/modules/MergeWindows.jsm
index 2af5397..edf1b79 100644
--- a/modules/MergeWindows.jsm
+++ b/modules/MergeWindows.jsm
@@ -47,7 +47,7 @@ this.MergeWindows = {
       options.normalWindowsCount = normalWindowsCount;
       this.mergeMultipleWindows(aWindow, windows, options);
     } else {
-      let tabsToMove = Array.slice(options.tabsSelected ? selectedTabs : tabbrowser.tabs);
+      let tabsToMove = Array.prototype.slice.call(options.tabsSelected ? selectedTabs : tabbrowser.tabs);
       this.mergeTwoWindows(windows[0], aWindow, tabsToMove, options);
     }
   },
@@ -112,7 +112,7 @@ this.MergeWindows = {
   concatTabsAndMerge: function(aTargetWindow, aWindows) {
     let tabsToMove = [];
     for (let i = 0; i < aWindows.length; i++)
-      tabsToMove = tabsToMove.concat(Array.slice(aWindows[i].gBrowser.tabs));
+      tabsToMove = tabsToMove.concat(Array.prototype.slice.call(aWindows[i].gBrowser.tabs));
     this.swapTabs(aTargetWindow, tabsToMove);
   },
 
diff --git a/modules/Shortcuts.jsm b/modules/Shortcuts.jsm
index c65a343..c4d16a1 100644
--- a/modules/Shortcuts.jsm
+++ b/modules/Shortcuts.jsm
@@ -88,7 +88,9 @@ this.Shortcuts = {
       let box = aWindow.document.createElement("vbox");
       box.setAttribute("shortcutsLabels", true);
       container.appendChild(box);
-      Array.slice(box.attributes).forEach(a => labels[a.name] = a.value);
+      for (let att of box.attributes) {
+        labels[att.name] = att.value;
+      }
       container.removeChild(box);
     }
     labels.togglePinTab =

-- 
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