Bug 682758 - Stop repr() trying to call match() on an empty Array. r=mdas
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 01 Sep 2011 11:35:04 +1200
changeset 76360 2bf8e6118af4b84b321e39ba19fb23d2031c1240
parent 76359 05e7c10be3a2db79b1546754e4a2434815da30fa
child 76361 0c6cbf58eaa02b2650b6173fb1c9b4838b3f2af4
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersmdas
bugs682758
milestone9.0a1
Bug 682758 - Stop repr() trying to call match() on an empty Array. r=mdas
testing/mochitest/tests/SimpleTest/SimpleTest.js
--- a/testing/mochitest/tests/SimpleTest/SimpleTest.js
+++ b/testing/mochitest/tests/SimpleTest/SimpleTest.js
@@ -28,42 +28,39 @@ if (parent) {
 var ipcMode = false;
 if (parentRunner) {
     ipcMode = parentRunner.ipcMode;
 } else if (typeof SpecialPowers != 'undefined') {
     ipcMode = SpecialPowers.hasContentProcesses();
 }
 
 /* Helper functions pulled out of various MochiKit modules */
-var reprRegistry = [];
-
 if (typeof(repr) == 'undefined') {
     function repr(o) {
         if (typeof(o) == "undefined") {
             return "undefined";
         } else if (o === null) {
             return "null";
         }
         try {
             if (typeof(o.__repr__) == 'function') {
                 return o.__repr__();
             } else if (typeof(o.repr) == 'function' && o.repr != arguments.callee) {
                 return o.repr();
             }
-            return reprRegistry.match(o);
+       } catch (e) {
+       }
+       try {
+            if (typeof(o.NAME) == 'string' && (
+                    o.toString == Function.prototype.toString ||
+                    o.toString == Object.prototype.toString
+                )) {
+                return o.NAME;
+            }
         } catch (e) {
-            try {
-                if (typeof(o.NAME) == 'string' && (
-                        o.toString == Function.prototype.toString ||
-                        o.toString == Object.prototype.toString
-                    )) {
-                    return o.NAME;
-                }
-            } catch (e) {
-            }
         }
         try {
             var ostring = (o + "");
         } catch (e) {
             return "[" + typeof(o) + "]";
         }
         if (typeof(o) == "function") {
             o = ostring.replace(/^\s+/, "");