You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2010/09/08 06:56:30 UTC

svn commit: r993603 - in /shindig/trunk/features/src/main/javascript/features: core.config/config.js core.io/io.js core.json/json.js osapi/batch.js osapi/osapi.js rpc/fe.transport.js rpc/ifpc.transport.js rpc/rpc.js

Author: lindner
Date: Wed Sep  8 04:56:30 2010
New Revision: 993603

URL: http://svn.apache.org/viewvc?rev=993603&view=rev
Log:
fixes found using firefox strict mode

Modified:
    shindig/trunk/features/src/main/javascript/features/core.config/config.js
    shindig/trunk/features/src/main/javascript/features/core.io/io.js
    shindig/trunk/features/src/main/javascript/features/core.json/json.js
    shindig/trunk/features/src/main/javascript/features/osapi/batch.js
    shindig/trunk/features/src/main/javascript/features/osapi/osapi.js
    shindig/trunk/features/src/main/javascript/features/rpc/fe.transport.js
    shindig/trunk/features/src/main/javascript/features/rpc/ifpc.transport.js
    shindig/trunk/features/src/main/javascript/features/rpc/rpc.js

Modified: shindig/trunk/features/src/main/javascript/features/core.config/config.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/core.config/config.js?rev=993603&r1=993602&r2=993603&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/core.config/config.js (original)
+++ shindig/trunk/features/src/main/javascript/features/core.config/config.js Wed Sep  8 04:56:30 2010
@@ -184,6 +184,7 @@ gadgets.config = function() {
             return true;
           }
         }
+        return false;
       };
     },
 

Modified: shindig/trunk/features/src/main/javascript/features/core.io/io.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/core.io/io.js?rev=993603&r1=993602&r2=993603&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/core.io/io.js (original)
+++ shindig/trunk/features/src/main/javascript/features/core.io/io.js Wed Sep  8 04:56:30 2010
@@ -51,16 +51,18 @@ gadgets.io = function() {
         shindig.xhrwrapper &&
         shindig.xhrwrapper.createXHR) {
       return shindig.xhrwrapper.createXHR();
-    } else if (window.ActiveXObject) {
+    } else if (typeof ActiveXObject != 'undefined') {
       x = new ActiveXObject("Msxml2.XMLHTTP");
       if (!x) {
         x = new ActiveXObject("Microsoft.XMLHTTP");
       }
       return x;
     }
-    else if (window.XMLHttpRequest) {
+    // The second construct is for the benefit of jsunit...
+    else if (typeof XMLHttpRequest != 'undefined' || window.XMLHttpRequest) {
       return new window.XMLHttpRequest();
     }
+    else throw("no xhr available");
   }
 
   /**
@@ -196,7 +198,7 @@ gadgets.io = function() {
           break;
         case "DOM":
           var dom;
-          if (window.ActiveXObject) {
+          if (typeof ActiveXObject != 'undefined') {
             dom = new ActiveXObject("Microsoft.XMLDOM");
             dom.async = false;
             dom.validateOnParse = false;

Modified: shindig/trunk/features/src/main/javascript/features/core.json/json.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/core.json/json.js?rev=993603&r1=993602&r2=993603&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/core.json/json.js (original)
+++ shindig/trunk/features/src/main/javascript/features/core.json/json.js Wed Sep  8 04:56:30 2010
@@ -175,6 +175,7 @@ if (window.JSON && window.JSON.parse && 
         // Join all of the member texts together and wrap them in braces.
         return '{' + a.join(',') + '}';
       }
+      return "undefined";
     }
   
     return {

Modified: shindig/trunk/features/src/main/javascript/features/osapi/batch.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/osapi/batch.js?rev=993603&r1=993602&r2=993603&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/osapi/batch.js (original)
+++ shindig/trunk/features/src/main/javascript/features/osapi/batch.js Wed Sep  8 04:56:30 2010
@@ -52,8 +52,8 @@
     var add = function(key, request) {
       if (request && key) {
         keyedRequests.push({"key" : key, "request" : request});
-        return that;
       }
+      return that;
     };
 
     /**

Modified: shindig/trunk/features/src/main/javascript/features/osapi/osapi.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/osapi/osapi.js?rev=993603&r1=993602&r2=993603&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/osapi/osapi.js (original)
+++ shindig/trunk/features/src/main/javascript/features/osapi/osapi.js Wed Sep  8 04:56:30 2010
@@ -23,6 +23,7 @@
    * @param {Object.<string,Object>} transport The transport used to execute a call for the method
    */
   osapi._registerMethod = function (method, transport) {
+    var has___ = typeof ___ !== 'undefined';
 
     // Skip registration of local newBatch implementation.
     if (method == "newBatch") {
@@ -42,8 +43,8 @@
       var batch = osapi.newBatch();
       var boundCall = {};
       boundCall.execute = function(callback) {
-        var feralCallback = window.___ ? ___.untame(callback) : callback;
-        var that = window.___ ? ___.USELESS : this;
+        var feralCallback = has___ ? ___.untame(callback) : callback;
+        var that = has___ ? ___.USELESS : this;
         batch.add(method, this);
         batch.execute(function(batchResult) {
           if (batchResult.error) {
@@ -53,7 +54,7 @@
           }
         });
       }
-      if (window.___) {
+      if (has___) {
           ___.markInnocent(boundCall.execute, 'execute');
       }
       // TODO: This shouldnt really be necessary. The spec should be clear enough about
@@ -69,7 +70,7 @@
 
       return boundCall;
     };
-    if (window.___ && window.___.markInnocent) {
+    if (has___ && typeof ___.markInnocent !== 'undefined') {
       ___.markInnocent(apiMethod, method);
     }
 

Modified: shindig/trunk/features/src/main/javascript/features/rpc/fe.transport.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/rpc/fe.transport.js?rev=993603&r1=993602&r2=993603&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/rpc/fe.transport.js (original)
+++ shindig/trunk/features/src/main/javascript/features/rpc/fe.transport.js Wed Sep  8 04:56:30 2010
@@ -65,7 +65,7 @@ gadgets.rpctx.frameElement = function() 
 
           // Conduct the RPC call.
           fe[FE_G2C_CHANNEL](gadgets.json.stringify(rpc));
-          return;
+          return true;
         }
       } else {
         // Call from container to gadget[targetId].
@@ -76,12 +76,12 @@ gadgets.rpctx.frameElement = function() 
 
           // Conduct the RPC call.
           frame[FE_G2C_CHANNEL][FE_C2G_CHANNEL](gadgets.json.stringify(rpc));
-          return;
+          return true;
         }
       }
     } catch (e) {
     }
-    return true;
+    return false;
   }
 
   return {
@@ -128,7 +128,7 @@ gadgets.rpctx.frameElement = function() 
     },
 
     call: function(targetId, from, rpc) {
-      callFrameElement(targetId, from, rpc);
+      return callFrameElement(targetId, from, rpc);
     } 
 
   };

Modified: shindig/trunk/features/src/main/javascript/features/rpc/ifpc.transport.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/rpc/ifpc.transport.js?rev=993603&r1=993602&r2=993603&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/rpc/ifpc.transport.js (original)
+++ shindig/trunk/features/src/main/javascript/features/rpc/ifpc.transport.js Wed Sep  8 04:56:30 2010
@@ -130,7 +130,7 @@ gadgets.rpctx.ifpc = function() {
 
       if (!relay) {
         gadgets.warn('No relay file assigned for IFPC');
-        return;
+        return false;
       }
 
       // The RPC mechanism supports two formats for IFPC (legacy and current).

Modified: shindig/trunk/features/src/main/javascript/features/rpc/rpc.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js?rev=993603&r1=993602&r2=993603&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/rpc/rpc.js (original)
+++ shindig/trunk/features/src/main/javascript/features/rpc/rpc.js Wed Sep  8 04:56:30 2010
@@ -951,7 +951,7 @@ gadgets.rpc = function() {
     _createRelayIframe: function(token, data) {
       var relay = gadgets.rpc.getRelayUrl('..');
       if (!relay) {
-        return;
+        return null;
       }
       
       // Format: #targetId & sourceId & authToken & data