Gets rid of RegExp. from StacktraceCreator to make Jscompiler happy

Change-Id: I7ee944b1e876b4cf9eced5c1c86b6ab7b9698f37
diff --git a/user/src/com/google/gwt/core/client/impl/StackTraceCreator.java b/user/src/com/google/gwt/core/client/impl/StackTraceCreator.java
index 91fba43..2087943 100644
--- a/user/src/com/google/gwt/core/client/impl/StackTraceCreator.java
+++ b/user/src/com/google/gwt/core/client/impl/StackTraceCreator.java
@@ -454,7 +454,8 @@
 
   static native String extractFunctionName(String fnName) /*-{
     var fnRE = /function(?:\s+([\w$]+))?\s*\(/;
-    return (fnRE.test(fnName) && RegExp.$1) || @StackTraceCreator::ANONYMOUS;
+    var match = fnRE.exec(fnName);
+    return (match && match[1]) || @StackTraceCreator::ANONYMOUS;
   }-*/;
 
   private static native <T> T splice(T arr, int length) /*-{
diff --git a/user/test/com/google/gwt/core/client/impl/StackTraceCreatorCollectorTest.java b/user/test/com/google/gwt/core/client/impl/StackTraceCreatorCollectorTest.java
index ef00a61..c912264 100644
--- a/user/test/com/google/gwt/core/client/impl/StackTraceCreatorCollectorTest.java
+++ b/user/test/com/google/gwt/core/client/impl/StackTraceCreatorCollectorTest.java
@@ -42,6 +42,8 @@
     assertEquals("foo", extractFunctionName("function foo(){}"));
     assertEquals("foo", extractFunctionName("function foo (){}"));
     assertEquals("foo", extractFunctionName("  function foo (){}"));
+    // In an unlikely case if somebody overrides fn.toString
+    assertEquals("anonymous", extractFunctionName("abc"));
   }
 
   public void testChromeExtractName() {