Index: src/js/string.js |
diff --git a/src/js/string.js b/src/js/string.js |
index 5180e3056fa55c374531eaf0545a99b109f0f321..b3bc3933cda29b04a3253f74d6949c85419f7231 100644 |
--- a/src/js/string.js |
+++ b/src/js/string.js |
@@ -36,6 +36,24 @@ |
}); |
//------------------------------------------------------------------- |
+ |
+// ECMA-262 section 15.5.4.2 |
+function StringToString() { |
+ if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) { |
+ throw MakeTypeError(kNotGeneric, 'String.prototype.toString'); |
+ } |
+ return %_ValueOf(this); |
+} |
+ |
+ |
+// ECMA-262 section 15.5.4.3 |
+function StringValueOf() { |
+ if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) { |
+ throw MakeTypeError(kNotGeneric, 'String.prototype.valueOf'); |
+ } |
+ return %_ValueOf(this); |
+} |
+ |
// ECMA-262, section 15.5.4.6 |
function StringConcat(other /* and more */) { // length == 1 |
@@ -738,6 +756,8 @@ |
// Set up the non-enumerable functions on the String prototype object. |
utils.InstallFunctions(GlobalString.prototype, DONT_ENUM, [ |
+ "valueOf", StringValueOf, |
+ "toString", StringToString, |
"codePointAt", StringCodePointAt, |
"concat", StringConcat, |
"endsWith", StringEndsWith, |