[Pkg-mozext-commits] [tabmixplus] 10/44: Remove Iterator() usage from our code (see comment 0 in bug 962494)

David Prévot taffit at moszumanska.debian.org
Wed Oct 15 02:09:59 UTC 2014


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

taffit pushed a commit to branch master
in repository tabmixplus.

commit da6f14692e40256834e4404026fc14b4cb66bf50
Author: onemen <tabmix.onemen at gmail.com>
Date:   Thu Oct 2 15:38:36 2014 +0300

    Remove Iterator() usage from our code (see comment 0 in bug 962494)
---
 chrome/content/extensions/extensions.js  |  4 ++--
 chrome/content/minit/tabView.js          |  3 ++-
 chrome/content/preferences/shortcuts.xml |  3 ++-
 chrome/content/tabmix.js                 |  3 ++-
 modules/DynamicRules.jsm                 | 15 +++++++++------
 modules/Services.jsm                     |  4 +++-
 modules/Shortcuts.jsm                    | 28 ++++++++++++++++++----------
 7 files changed, 38 insertions(+), 22 deletions(-)

diff --git a/chrome/content/extensions/extensions.js b/chrome/content/extensions/extensions.js
index 48da097..1060963 100644
--- a/chrome/content/extensions/extensions.js
+++ b/chrome/content/extensions/extensions.js
@@ -391,10 +391,10 @@ var TMP_extensionsCompatibility = {
         showTabListCurrent: /menuItem\.setAttribute\("label",\s*title\);/
       }
 
-      for (let [fnName, oldCode] in Iterator(func)) {
+      for (let fnName of Object.keys(func)) {
         if (typeof tileTabs[fnName] == "function") {
           Tabmix.changeCode(tileTabs, "tileTabs." + fnName)._replace(
-            oldCode, fnName == "styleTiledTabs" ? getLabel + newCode : newCode
+            func[fnName], fnName == "styleTiledTabs" ? getLabel + newCode : newCode
           ).toCode();
         }
       }
diff --git a/chrome/content/minit/tabView.js b/chrome/content/minit/tabView.js
index 7d5c12d..764b185 100644
--- a/chrome/content/minit/tabView.js
+++ b/chrome/content/minit/tabView.js
@@ -542,7 +542,8 @@
       return;
 
     let GroupItems = TabView._window.GroupItems;
-    for (let data in Iterator(this._groupItems, true)) {
+    for (let key of Object.keys(this._groupItems)) {
+      let data = this._groupItems[key];
       if (data.newItem) {
         if (GroupItems.groupItemStorageSanity(data)) {
           GroupItems.groupItem(data.id).pushAway(true);
diff --git a/chrome/content/preferences/shortcuts.xml b/chrome/content/preferences/shortcuts.xml
index 66fa1a0..cf40257 100644
--- a/chrome/content/preferences/shortcuts.xml
+++ b/chrome/content/preferences/shortcuts.xml
@@ -156,7 +156,8 @@
             let eKeyCode = event.keyCode;
             if (eKeyCode == 8)
               key.keycode = "VK_BACK";
-            else for (let [keycode, val] in Iterator(Ci.nsIDOMKeyEvent)) {
+            for (let keycode of Object.keys(Ci.nsIDOMKeyEvent)) {
+              let val = Ci.nsIDOMKeyEvent[keycode];
               if (val == eKeyCode) {
                 key.keycode = keycode.replace("DOM_","");
                 break;
diff --git a/chrome/content/tabmix.js b/chrome/content/tabmix.js
index 452f911..bc696ee 100644
--- a/chrome/content/tabmix.js
+++ b/chrome/content/tabmix.js
@@ -1197,7 +1197,8 @@ Tabmix.initialization = {
     if (!this.isValidWindow)
       return null;
     let result, currentPhase = this[aPhase].id;
-    for (let [name, phase] in Iterator(this)) {
+    for (let name of Object.keys(this)) {
+      let phase = this[name];
       if (phase.id > currentPhase)
         break;
       if (!phase.initialized) {
diff --git a/modules/DynamicRules.jsm b/modules/DynamicRules.jsm
index d64bb1a..66f0bd4 100644
--- a/modules/DynamicRules.jsm
+++ b/modules/DynamicRules.jsm
@@ -54,7 +54,7 @@ this.DynamicRules = {
     Services.obs.addObserver(this, "quit-application", false);
 
     this.createTemplates();
-    for (let rule in Iterator(this.cssTemplates, true))
+    for (let rule of Object.keys(this.cssTemplates))
       this.userChangedStyle(rule);
   },
 
@@ -151,7 +151,8 @@ this.DynamicRules = {
             space26 + 'rgba(254, 254, 254, 0.72) 4px, rgba(254, 254, 254, 0.72) 4px, #bottomColor)';
       bgImage.startEndhover = bgImage.bghover;
       let _selector = '.tabbrowser-tab#HOVER[tabmix_tabStyle~="#RULE-bg"] > .tab-stack > .tab-background >';
-      for (let [rule, style] in Iterator(styleRules)) {
+      for (let rule of Object.keys(styleRules)) {
+        let style = styleRules[rule];
         delete style.bg;
         let hover = rule == "currentTab" ? "" : ":hover";
         let ruleSelector = _selector.replace("#RULE", rule.replace("Tab", ""));
@@ -211,7 +212,8 @@ this.DynamicRules = {
       return;
     let templates = this.cssTemplates[name];
     let style = {};
-    for (let [rule, cssText] in Iterator(templates)) {
+    for (let rule of Object.keys(templates)) {
+      let cssText = templates[rule];
       if (rule == "text") {
         if (prefObj.text)
           style[rule] = cssText.replace(/#textColor/g, prefObj.textColor);
@@ -235,12 +237,13 @@ this.DynamicRules = {
     if (!enabled)
       return;
 
-    if (!this.styles[name])
+    let style = this.styles[name];
+    if (!style)
       return;
 
     let cssText = NAMESPACE;
-    for (let [name, rule] in Iterator(this.styles[name]))
-      cssText += "\n" +  rule;
+    for (let rule of Object.keys(style))
+      cssText += "\n" + style[rule];
     let styleSheet = Services.io.newURI(
       "data:text/css," + encodeURIComponent(cssText), null, null);
 
diff --git a/modules/Services.jsm b/modules/Services.jsm
index 0c98a19..bdf7381 100644
--- a/modules/Services.jsm
+++ b/modules/Services.jsm
@@ -161,8 +161,10 @@ let TabmixSvc = {
       switch (aTopic) {
         case "quit-application":
           TabmixPlacesUtils.onQuitApplication();
-          for (let [id, timer] in Iterator(TabmixSvc.console._timers))
+          for (let id of Object.keys(TabmixSvc.console._timers)) {
+            let timer = TabmixSvc.console._timers[id];
             timer.cancel();
+          }
           break;
         case "browser-delayed-startup-finished":
           try {
diff --git a/modules/Shortcuts.jsm b/modules/Shortcuts.jsm
index 33dcc66..db2867e 100644
--- a/modules/Shortcuts.jsm
+++ b/modules/Shortcuts.jsm
@@ -78,7 +78,8 @@ let Shortcuts = {
     labels.togglePinTab =
         aWindow.document.getElementById("context_pinTab").getAttribute("label") + "/" +
         aWindow.document.getElementById("context_unpinTab").getAttribute("label");
-    for (let [key, keyData] in Iterator(this.keys)) {
+    for (let key of Object.keys(this.keys)) {
+      let keyData = this.keys[key];
       keyData.value = keyData.default || "";
       if (key in labels)
         keyData.label = labels[key];
@@ -162,7 +163,8 @@ let Shortcuts = {
   onUnload: function TMP_SC_onUnload(aWindow) {
     aWindow.removeEventListener("unload", this, false);
     let document = aWindow.document;
-    for (let [key, keyData] in Iterator(this.keys)) {
+    for (let key of Object.keys(this.keys)) {
+      let keyData = this.keys[key];
       if (keyData.command && keyData.value) {
         let keyItem = document.getElementById(keyData.id || "key_tm_" + key);
         if (keyItem)
@@ -190,8 +192,8 @@ let Shortcuts = {
   /* ........ Window Key Handlers .............. */
 
   updateWindowKeys: function TMP_SC_updateWindowKeys(aWindow, aKeys) {
-    for (let [key, keyData] in Iterator(aKeys))
-      this._updateKey(aWindow, key, keyData);
+    for (let key of Object.keys(aKeys))
+      this._updateKey(aWindow, key, aKeys[key]);
 
     let keyset = aWindow.document.getElementById("mainKeyset");
     keyset.parentNode.insertBefore(keyset, keyset.nextSibling);
@@ -209,7 +211,7 @@ let Shortcuts = {
     if (keyItem) {
       if (!keyItem.parentNode)
         return;
-      for (let att in Iterator(keyAtt, true))
+      for (let att of Object.keys(keyAtt))
         keyItem.removeAttribute(att);
       // disabled shortcuts, like new tab and close tab, can mess the whole keyset
       // so we move those to a different node
@@ -231,7 +233,8 @@ let Shortcuts = {
       keyItem.addEventListener("command", this, true);
     }
 
-    for (let [att, val] in Iterator(keyAtt)) {
+    for (let att of Object.keys(keyAtt)) {
+      let val = keyAtt[att];
       if (val)
         keyItem.setAttribute(att, val);
     }
@@ -254,7 +257,8 @@ let Shortcuts = {
     let disableSessionKeys = this.permanentPrivateBrowsing ||
         !this.prefs.getBoolPref("sessions.manager");
     let changedKeys = {}, onOpen = aOptions.onOpen;
-    for (let [key, keyData] in Iterator(this.keys)) {
+    for (let key of Object.keys(this.keys)) {
+      let keyData = this.keys[key];
       let _default = keyData.default || "";
       let currentValue = onOpen ? _default : keyData.value;
       let newValue = shortcuts[key] || _default;
@@ -285,7 +289,8 @@ let Shortcuts = {
       shortcuts = {};
       updatePreference = true;
     }
-    for (let [key, val] in Iterator(shortcuts)) {
+    for (let key of Object.keys(shortcuts)) {
+      let val = shortcuts[key];
       // if key in preference is not valid key or its value is not valid
       // or its value equal to default, remove it from the preference
       let keyData = this.keys[key] || null;
@@ -418,8 +423,10 @@ let KeyConfig = {
     // keyConfig use index number for its ids
     let oldReloadId = "xxx_key29_Browser:Reload";
     this.keyIdsMap[oldReloadId] = "browserReload";
-    for (let [key, keyData] in Iterator(Shortcuts.keys))
+    for (let key of Object.keys(Shortcuts.keys)) {
+      let keyData = Shortcuts.keys[key];
       this.keyIdsMap[keyData.id || "key_tm_" + key] = key;
+    }
 
     this.prefs = Services.prefs.getBranch("keyconfig.main.");
     let shortcuts = Shortcuts._getShortcutsPref();
@@ -488,7 +495,8 @@ let KeyConfig = {
   },
 
   syncToKeyConfig: function(aChangedKeys, onChange) {
-    for (let [key, prefVal] in Iterator(aChangedKeys)) {
+    for (let key of Object.keys(aChangedKeys)) {
+      let prefVal = aChangedKeys[key];
       this.prefsChangedByTabmix = true;
       if (onChange)
         prefVal = prefVal.value;

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