tropo / PhonoSDK

Phono.com - The jQuery Phone API
http://phono.com
Other
131 stars 63 forks source link

Logging breaks IE 9 #31

Open tjsingleton opened 11 years ago

tjsingleton commented 11 years ago

I tracked down what was causing IE 9 to break for us. In Phono.util.loggyFuction there is an attempt to convert the arguments to a string. When an argument is IE's IXMLDOMElement, it throws a TypeError.

--- a/vendor/assets/javascripts/jquery.phono.js
+++ b/vendor/assets/javascripts/jquery.phono.js
@@ -945,7 +945,7 @@ var flensed={base_path:"//s.phono.com/deps/flensed/1.0/"};
     loggyFunction: function(objName, obj, funcName) {
         var original = obj[funcName];
         obj[funcName] = function() {
-
+          try {
             // Convert arguments to a real array
             var sep = "";
             var args = "";
@@ -953,9 +953,13 @@ var flensed={base_path:"//s.phono.com/deps/flensed/1.0/"};
                 args+= (sep + arguments[i]);
                 sep = ",";
             }
-            
+
             Phono.log.debug("[INVOKE] " + objName + "." + funcName + "(" + args  + ")");
-            return original.apply(obj, arguments);
+          } catch (e) {
+            Phono.log.debug("[INVOKE] " + objName + "." + funcName + "(I CAN'T CONVERT THESE ARGUMENTS TO A STRING)");
+          }
+
+          return original.apply(obj, arguments);
         }
     },
     padWithZeroes: function(num, len) {