Reviewers: jasvir,

Description:
debugReference assumed that directConstructor could not return undefined

and was reading the name property on the result without checking.

Please review this at http://codereview.appspot.com/11869

Affected files:
  M     src/com/google/caja/cajita.js


Index: src/com/google/caja/cajita.js
===================================================================
--- src/com/google/caja/cajita.js       (revision 3156)
+++ src/com/google/caja/cajita.js       (working copy)
@@ -552,7 +552,8 @@
     switch (typeOf(obj)) {
       case 'object': {
         if (obj === null) { return '<null>'; }
-        return '[' + (directConstructor(obj).name || 'Object') + ']';
+        var constr = directConstructor(obj);
+        return '[' + ((constr && constr.name) || 'Object') + ']';
       }
       default: {
         return '(' + obj + ':' + typeOf(obj) + ')';


Reply via email to