ref: 7b37ef2b8ad907a3803c5dcc8b184f788f961b80
parent: d5b83c3bf2d15a5f037088e53a6ef5f4c67656e0
author: Tor Andersson <tor@ccxvii.net>
date: Fri Feb 7 08:48:24 EST 2014
Handle js_tostring on objects without toString or toValue methods. Don't throw a type error, just return "[object]" instead.
--- a/jsvalue.c
+++ b/jsvalue.c
@@ -93,7 +93,10 @@
return vv;
}
}
- js_typeerror(J, "cannot convert object to primitive");
+
+ vv.type = JS_TSTRING;
+ vv.u.string = "[object]";
+ return vv;
}
/* ToBoolean() on a value */