This patch addresses issue #629. Previously, wrapJSO would clobber the jso's existing toString method (if any) due to it indiscriminately copying fields in from the prototype. This patch addresses the problem by specifically saving off the jso's toString field.
Found by: aglaforge
Review by: mmendez
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@480 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Cast.java b/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Cast.java
index fc9bcdb..df904e6 100644
--- a/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Cast.java
+++ b/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Cast.java
@@ -149,9 +149,12 @@
// jso's typeId is undefined, because (undefined < positive int).
if (jso && !(jso.@java.lang.Object::typeId >= _.@java.lang.Object::typeId)) {
+ // don't clobber toString
+ var oldToString = jso.toString;
for (var i in _) {
jso[i] = _[i];
}
+ jso.toString = oldToString;
}
return jso;
}-*/;