[gnome-shell] Don't declare global variables



commit 15ec185be50475e2f57de4940e84d7767da4814e
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Thu Feb 24 18:17:05 2011 +0100

    Don't declare global variables
    
    Fix a typo in panel.js, and ensure that all variables used in
    functions are scoped to the block (using let), to avoid polluting
    the global namespace.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=643210

 js/ui/environment.js        |    2 +-
 js/ui/panel.js              |    2 +-
 js/ui/workspaceThumbnail.js |    4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/environment.js b/js/ui/environment.js
index d6405b3..e832262 100644
--- a/js/ui/environment.js
+++ b/js/ui/environment.js
@@ -17,7 +17,7 @@ function _patchContainerClass(containerClass) {
     // This one is a straightforward mapping of the C method
     containerClass.prototype.child_set = function(actor, props) {
         let meta = this.get_child_meta(actor);
-        for (prop in props)
+        for (let prop in props)
             meta[prop] = props[prop];
     };
 
diff --git a/js/ui/panel.js b/js/ui/panel.js
index a38bf9a..d1bf3fd 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -410,7 +410,7 @@ AppMenuButton.prototype = {
         let [minSize, naturalSize] = this._iconBox.get_preferred_height(forWidth);
         alloc.min_size = minSize;
         alloc.natural_size = naturalSize;
-        [minSizfe, naturalSize] = this._label.actor.get_preferred_height(forWidth);
+        [minSize, naturalSize] = this._label.actor.get_preferred_height(forWidth);
         if (minSize > alloc.min_size)
             alloc.min_size = minSize;
         if (naturalSize > alloc.natural_size)
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index 06dec6f..d3acd3a 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -424,7 +424,7 @@ ThumbnailsBox.prototype = {
         this._indicatorY = 0; // only used when _animatingIndicator is true
 
         this._stateCounts = {};
-        for (key in ThumbnailState)
+        for (let key in ThumbnailState)
             this._stateCounts[ThumbnailState[key]] = 0;
 
         this._thumbnails = [];
@@ -441,7 +441,7 @@ ThumbnailsBox.prototype = {
         this._stateUpdateQueued = false;
 
         this._stateCounts = {};
-        for (key in ThumbnailState)
+        for (let key in ThumbnailState)
             this._stateCounts[ThumbnailState[key]] = 0;
 
         // The "porthole" is the portion of the screen that we show in the workspaces



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]