You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by hs...@apache.org on 2012/02/07 07:49:50 UTC

svn commit: r1241361 - /shindig/trunk/features/src/main/javascript/features/actions/actions_container.js

Author: hsaputra
Date: Tue Feb  7 06:49:49 2012
New Revision: 1241361

URL: http://svn.apache.org/viewvc?rev=1241361&view=rev
Log:
Change the array for-in loop iteration bc it crawl to the prototype chain. Also add check for hasOwnProperty for iterating through urlToSite.

Modified:
    shindig/trunk/features/src/main/javascript/features/actions/actions_container.js

Modified: shindig/trunk/features/src/main/javascript/features/actions/actions_container.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/actions/actions_container.js?rev=1241361&r1=1241360&r2=1241361&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/actions/actions_container.js (original)
+++ shindig/trunk/features/src/main/javascript/features/actions/actions_container.js Tue Feb  7 06:49:49 2012
@@ -257,13 +257,18 @@
      */
     this.removeGadgetSite = function(siteId) {
       for (var url in this.urlToSite) {
-        var sites = this.urlToSite[url];
-        for (var i in sites) {
-          var site = sites[i];
-          if (site && site.getId() == siteId) {
-            sites.splice(i, 1);
-            if (sites.length == 0) {
-              delete this.urlToSite[url];
+        if(this.urlToSite.hasOwnProperty(url)) {
+          var sites = this.urlToSite[url];
+          if(!sites) {
+           continue;
+          }
+          for (var i = 0; i < sites.length; i++) {
+            var site = sites[i];
+            if (site && site.getId() == siteId) {
+              sites.splice(i, 1);
+              if (sites.length == 0) {
+                delete this.urlToSite[url];
+              }
             }
           }
         }