ref: a2fcfd69fecf79bb76020b042af00070e1f26eab
parent: 4b68d5235174444a8bea0237b0276f88dd62fa61
author: Tor Andersson <tor.andersson@artifex.com>
date: Thu Apr 28 08:57:22 EDT 2016
Define built-in functions with the full name. Improves error messages and stack traces.
--- a/jsarray.c
+++ b/jsarray.c
@@ -686,33 +686,33 @@
{
js_pushobject(J, J->Array_prototype);
{
- jsB_propf(J, "toString", Ap_toString, 0);
- jsB_propf(J, "concat", Ap_concat, 0); /* 1 */
- jsB_propf(J, "join", Ap_join, 1);
- jsB_propf(J, "pop", Ap_pop, 0);
- jsB_propf(J, "push", Ap_push, 0); /* 1 */
- jsB_propf(J, "reverse", Ap_reverse, 0);
- jsB_propf(J, "shift", Ap_shift, 0);
- jsB_propf(J, "slice", Ap_slice, 2);
- jsB_propf(J, "sort", Ap_sort, 1);
- jsB_propf(J, "splice", Ap_splice, 0); /* 2 */
- jsB_propf(J, "unshift", Ap_unshift, 0); /* 1 */
+ jsB_propf(J, "Array.prototype.toString", Ap_toString, 0);
+ jsB_propf(J, "Array.prototype.concat", Ap_concat, 0); /* 1 */
+ jsB_propf(J, "Array.prototype.join", Ap_join, 1);
+ jsB_propf(J, "Array.prototype.pop", Ap_pop, 0);
+ jsB_propf(J, "Array.prototype.push", Ap_push, 0); /* 1 */
+ jsB_propf(J, "Array.prototype.reverse", Ap_reverse, 0);
+ jsB_propf(J, "Array.prototype.shift", Ap_shift, 0);
+ jsB_propf(J, "Array.prototype.slice", Ap_slice, 2);
+ jsB_propf(J, "Array.prototype.sort", Ap_sort, 1);
+ jsB_propf(J, "Array.prototype.splice", Ap_splice, 0); /* 2 */
+ jsB_propf(J, "Array.prototype.unshift", Ap_unshift, 0); /* 1 */
/* ES5 */
- jsB_propf(J, "indexOf", Ap_indexOf, 1);
- jsB_propf(J, "lastIndexOf", Ap_lastIndexOf, 1);
- jsB_propf(J, "every", Ap_every, 1);
- jsB_propf(J, "some", Ap_some, 1);
- jsB_propf(J, "forEach", Ap_forEach, 1);
- jsB_propf(J, "map", Ap_map, 1);
- jsB_propf(J, "filter", Ap_filter, 1);
- jsB_propf(J, "reduce", Ap_reduce, 1);
- jsB_propf(J, "reduceRight", Ap_reduceRight, 1);
+ jsB_propf(J, "Array.prototype.indexOf", Ap_indexOf, 1);
+ jsB_propf(J, "Array.prototype.lastIndexOf", Ap_lastIndexOf, 1);
+ jsB_propf(J, "Array.prototype.every", Ap_every, 1);
+ jsB_propf(J, "Array.prototype.some", Ap_some, 1);
+ jsB_propf(J, "Array.prototype.forEach", Ap_forEach, 1);
+ jsB_propf(J, "Array.prototype.map", Ap_map, 1);
+ jsB_propf(J, "Array.prototype.filter", Ap_filter, 1);
+ jsB_propf(J, "Array.prototype.reduce", Ap_reduce, 1);
+ jsB_propf(J, "Array.prototype.reduceRight", Ap_reduceRight, 1);
}
js_newcconstructor(J, jsB_new_Array, jsB_new_Array, "Array", 0); /* 1 */
{
/* ES5 */
- jsB_propf(J, "isArray", A_isArray, 1);
+ jsB_propf(J, "Array.isArray", A_isArray, 1);
}
js_defglobal(J, "Array", JS_DONTENUM);
}
--- a/jsboolean.c
+++ b/jsboolean.c
@@ -32,8 +32,8 @@
js_pushobject(J, J->Boolean_prototype);
{
- jsB_propf(J, "toString", Bp_toString, 0);
- jsB_propf(J, "valueOf", Bp_valueOf, 0);
+ jsB_propf(J, "Boolean.prototype.toString", Bp_toString, 0);
+ jsB_propf(J, "Boolean.prototype.valueOf", Bp_valueOf, 0);
}
js_newcconstructor(J, jsB_Boolean, jsB_new_Boolean, "Boolean", 1);
js_defglobal(J, "Boolean", JS_DONTENUM);
--- a/jsbuiltin.c
+++ b/jsbuiltin.c
@@ -12,8 +12,10 @@
void jsB_propf(js_State *J, const char *name, js_CFunction cfun, int n)
{
+ const char *pname = strrchr(name, '.');
+ pname = pname ? pname + 1 : name;
js_newcfunction(J, cfun, name, n);
- js_defproperty(J, -2, name, JS_DONTENUM);
+ js_defproperty(J, -2, pname, JS_DONTENUM);
}
void jsB_propn(js_State *J, const char *name, double number)
--- a/jsdate.c
+++ b/jsdate.c
@@ -744,61 +744,61 @@
js_pushobject(J, J->Date_prototype);
{
- jsB_propf(J, "valueOf", Dp_valueOf, 0);
- jsB_propf(J, "toString", Dp_toString, 0);
- jsB_propf(J, "toDateString", Dp_toDateString, 0);
- jsB_propf(J, "toTimeString", Dp_toTimeString, 0);
- jsB_propf(J, "toLocaleString", Dp_toString, 0);
- jsB_propf(J, "toLocaleDateString", Dp_toDateString, 0);
- jsB_propf(J, "toLocaleTimeString", Dp_toTimeString, 0);
- jsB_propf(J, "toUTCString", Dp_toUTCString, 0);
+ jsB_propf(J, "Date.prototype.valueOf", Dp_valueOf, 0);
+ jsB_propf(J, "Date.prototype.toString", Dp_toString, 0);
+ jsB_propf(J, "Date.prototype.toDateString", Dp_toDateString, 0);
+ jsB_propf(J, "Date.prototype.toTimeString", Dp_toTimeString, 0);
+ jsB_propf(J, "Date.prototype.toLocaleString", Dp_toString, 0);
+ jsB_propf(J, "Date.prototype.toLocaleDateString", Dp_toDateString, 0);
+ jsB_propf(J, "Date.prototype.toLocaleTimeString", Dp_toTimeString, 0);
+ jsB_propf(J, "Date.prototype.toUTCString", Dp_toUTCString, 0);
- jsB_propf(J, "getTime", Dp_valueOf, 0);
- jsB_propf(J, "getFullYear", Dp_getFullYear, 0);
- jsB_propf(J, "getUTCFullYear", Dp_getUTCFullYear, 0);
- jsB_propf(J, "getMonth", Dp_getMonth, 0);
- jsB_propf(J, "getUTCMonth", Dp_getUTCMonth, 0);
- jsB_propf(J, "getDate", Dp_getDate, 0);
- jsB_propf(J, "getUTCDate", Dp_getUTCDate, 0);
- jsB_propf(J, "getDay", Dp_getDay, 0);
- jsB_propf(J, "getUTCDay", Dp_getUTCDay, 0);
- jsB_propf(J, "getHours", Dp_getHours, 0);
- jsB_propf(J, "getUTCHours", Dp_getUTCHours, 0);
- jsB_propf(J, "getMinutes", Dp_getMinutes, 0);
- jsB_propf(J, "getUTCMinutes", Dp_getUTCMinutes, 0);
- jsB_propf(J, "getSeconds", Dp_getSeconds, 0);
- jsB_propf(J, "getUTCSeconds", Dp_getUTCSeconds, 0);
- jsB_propf(J, "getMilliseconds", Dp_getMilliseconds, 0);
- jsB_propf(J, "getUTCMilliseconds", Dp_getUTCMilliseconds, 0);
- jsB_propf(J, "getTimezoneOffset", Dp_getTimezoneOffset, 0);
+ jsB_propf(J, "Date.prototype.getTime", Dp_valueOf, 0);
+ jsB_propf(J, "Date.prototype.getFullYear", Dp_getFullYear, 0);
+ jsB_propf(J, "Date.prototype.getUTCFullYear", Dp_getUTCFullYear, 0);
+ jsB_propf(J, "Date.prototype.getMonth", Dp_getMonth, 0);
+ jsB_propf(J, "Date.prototype.getUTCMonth", Dp_getUTCMonth, 0);
+ jsB_propf(J, "Date.prototype.getDate", Dp_getDate, 0);
+ jsB_propf(J, "Date.prototype.getUTCDate", Dp_getUTCDate, 0);
+ jsB_propf(J, "Date.prototype.getDay", Dp_getDay, 0);
+ jsB_propf(J, "Date.prototype.getUTCDay", Dp_getUTCDay, 0);
+ jsB_propf(J, "Date.prototype.getHours", Dp_getHours, 0);
+ jsB_propf(J, "Date.prototype.getUTCHours", Dp_getUTCHours, 0);
+ jsB_propf(J, "Date.prototype.getMinutes", Dp_getMinutes, 0);
+ jsB_propf(J, "Date.prototype.getUTCMinutes", Dp_getUTCMinutes, 0);
+ jsB_propf(J, "Date.prototype.getSeconds", Dp_getSeconds, 0);
+ jsB_propf(J, "Date.prototype.getUTCSeconds", Dp_getUTCSeconds, 0);
+ jsB_propf(J, "Date.prototype.getMilliseconds", Dp_getMilliseconds, 0);
+ jsB_propf(J, "Date.prototype.getUTCMilliseconds", Dp_getUTCMilliseconds, 0);
+ jsB_propf(J, "Date.prototype.getTimezoneOffset", Dp_getTimezoneOffset, 0);
- jsB_propf(J, "setTime", Dp_setTime, 1);
- jsB_propf(J, "setMilliseconds", Dp_setMilliseconds, 1);
- jsB_propf(J, "setUTCMilliseconds", Dp_setUTCMilliseconds, 1);
- jsB_propf(J, "setSeconds", Dp_setSeconds, 2);
- jsB_propf(J, "setUTCSeconds", Dp_setUTCSeconds, 2);
- jsB_propf(J, "setMinutes", Dp_setMinutes, 3);
- jsB_propf(J, "setUTCMinutes", Dp_setUTCMinutes, 3);
- jsB_propf(J, "setHours", Dp_setHours, 4);
- jsB_propf(J, "setUTCHours", Dp_setUTCHours, 4);
- jsB_propf(J, "setDate", Dp_setDate, 1);
- jsB_propf(J, "setUTCDate", Dp_setUTCDate, 1);
- jsB_propf(J, "setMonth", Dp_setMonth, 2);
- jsB_propf(J, "setUTCMonth", Dp_setUTCMonth, 2);
- jsB_propf(J, "setFullYear", Dp_setFullYear, 3);
- jsB_propf(J, "setUTCFullYear", Dp_setUTCFullYear, 3);
+ jsB_propf(J, "Date.prototype.setTime", Dp_setTime, 1);
+ jsB_propf(J, "Date.prototype.setMilliseconds", Dp_setMilliseconds, 1);
+ jsB_propf(J, "Date.prototype.setUTCMilliseconds", Dp_setUTCMilliseconds, 1);
+ jsB_propf(J, "Date.prototype.setSeconds", Dp_setSeconds, 2);
+ jsB_propf(J, "Date.prototype.setUTCSeconds", Dp_setUTCSeconds, 2);
+ jsB_propf(J, "Date.prototype.setMinutes", Dp_setMinutes, 3);
+ jsB_propf(J, "Date.prototype.setUTCMinutes", Dp_setUTCMinutes, 3);
+ jsB_propf(J, "Date.prototype.setHours", Dp_setHours, 4);
+ jsB_propf(J, "Date.prototype.setUTCHours", Dp_setUTCHours, 4);
+ jsB_propf(J, "Date.prototype.setDate", Dp_setDate, 1);
+ jsB_propf(J, "Date.prototype.setUTCDate", Dp_setUTCDate, 1);
+ jsB_propf(J, "Date.prototype.setMonth", Dp_setMonth, 2);
+ jsB_propf(J, "Date.prototype.setUTCMonth", Dp_setUTCMonth, 2);
+ jsB_propf(J, "Date.prototype.setFullYear", Dp_setFullYear, 3);
+ jsB_propf(J, "Date.prototype.setUTCFullYear", Dp_setUTCFullYear, 3);
/* ES5 */
- jsB_propf(J, "toISOString", Dp_toISOString, 0);
- jsB_propf(J, "toJSON", Dp_toJSON, 1);
+ jsB_propf(J, "Date.prototype.toISOString", Dp_toISOString, 0);
+ jsB_propf(J, "Date.prototype.toJSON", Dp_toJSON, 1);
}
js_newcconstructor(J, jsB_Date, jsB_new_Date, "Date", 0); /* 1 */
{
- jsB_propf(J, "parse", D_parse, 1);
- jsB_propf(J, "UTC", D_UTC, 7);
+ jsB_propf(J, "Date.parse", D_parse, 1);
+ jsB_propf(J, "Date.UTC", D_UTC, 7);
/* ES5 */
- jsB_propf(J, "now", D_now, 0);
+ jsB_propf(J, "Date.now", D_now, 0);
}
js_defglobal(J, "Date", JS_DONTENUM);
}
--- a/jserror.c
+++ b/jserror.c
@@ -99,7 +99,7 @@
{
jsB_props(J, "name", "Error");
jsB_props(J, "message", "an error has occurred");
- jsB_propf(J, "toString", Ep_toString, 0);
+ jsB_propf(J, "Error.prototype.toString", Ep_toString, 0);
}
js_newcconstructor(J, jsB_Error, jsB_Error, "Error", 1);
js_defglobal(J, "Error", JS_DONTENUM);
--- a/jsfunction.c
+++ b/jsfunction.c
@@ -199,10 +199,10 @@
js_pushobject(J, J->Function_prototype);
{
- jsB_propf(J, "toString", Fp_toString, 2);
- jsB_propf(J, "apply", Fp_apply, 2);
- jsB_propf(J, "call", Fp_call, 1);
- jsB_propf(J, "bind", Fp_bind, 1);
+ jsB_propf(J, "Function.prototype.toString", Fp_toString, 2);
+ jsB_propf(J, "Function.prototype.apply", Fp_apply, 2);
+ jsB_propf(J, "Function.prototype.call", Fp_call, 1);
+ jsB_propf(J, "Function.prototype.bind", Fp_bind, 1);
}
js_newcconstructor(J, jsB_Function, jsB_Function, "Function", 1);
js_defglobal(J, "Function", JS_DONTENUM);
--- a/jsmath.c
+++ b/jsmath.c
@@ -143,24 +143,24 @@
jsB_propn(J, "SQRT1_2", 0.7071067811865476);
jsB_propn(J, "SQRT2", 1.4142135623730951);
- jsB_propf(J, "abs", Math_abs, 1);
- jsB_propf(J, "acos", Math_acos, 1);
- jsB_propf(J, "asin", Math_asin, 1);
- jsB_propf(J, "atan", Math_atan, 1);
- jsB_propf(J, "atan2", Math_atan2, 2);
- jsB_propf(J, "ceil", Math_ceil, 1);
- jsB_propf(J, "cos", Math_cos, 1);
- jsB_propf(J, "exp", Math_exp, 1);
- jsB_propf(J, "floor", Math_floor, 1);
- jsB_propf(J, "log", Math_log, 1);
- jsB_propf(J, "max", Math_max, 0); /* 2 */
- jsB_propf(J, "min", Math_min, 0); /* 2 */
- jsB_propf(J, "pow", Math_pow, 2);
- jsB_propf(J, "random", Math_random, 0);
- jsB_propf(J, "round", Math_round, 1);
- jsB_propf(J, "sin", Math_sin, 1);
- jsB_propf(J, "sqrt", Math_sqrt, 1);
- jsB_propf(J, "tan", Math_tan, 1);
+ jsB_propf(J, "Math.abs", Math_abs, 1);
+ jsB_propf(J, "Math.acos", Math_acos, 1);
+ jsB_propf(J, "Math.asin", Math_asin, 1);
+ jsB_propf(J, "Math.atan", Math_atan, 1);
+ jsB_propf(J, "Math.atan2", Math_atan2, 2);
+ jsB_propf(J, "Math.ceil", Math_ceil, 1);
+ jsB_propf(J, "Math.cos", Math_cos, 1);
+ jsB_propf(J, "Math.exp", Math_exp, 1);
+ jsB_propf(J, "Math.floor", Math_floor, 1);
+ jsB_propf(J, "Math.log", Math_log, 1);
+ jsB_propf(J, "Math.max", Math_max, 0); /* 2 */
+ jsB_propf(J, "Math.min", Math_min, 0); /* 2 */
+ jsB_propf(J, "Math.pow", Math_pow, 2);
+ jsB_propf(J, "Math.random", Math_random, 0);
+ jsB_propf(J, "Math.round", Math_round, 1);
+ jsB_propf(J, "Math.sin", Math_sin, 1);
+ jsB_propf(J, "Math.sqrt", Math_sqrt, 1);
+ jsB_propf(J, "Math.tan", Math_tan, 1);
}
js_defglobal(J, "Math", JS_DONTENUM);
}
--- a/jsnumber.c
+++ b/jsnumber.c
@@ -82,12 +82,12 @@
js_pushobject(J, J->Number_prototype);
{
- jsB_propf(J, "valueOf", Np_valueOf, 0);
- jsB_propf(J, "toString", Np_toString, 1);
- jsB_propf(J, "toLocaleString", Np_toString, 0);
- jsB_propf(J, "toFixed", Np_toFixed, 1);
- jsB_propf(J, "toExponential", Np_toExponential, 1);
- jsB_propf(J, "toPrecision", Np_toPrecision, 1);
+ jsB_propf(J, "Number.prototype.valueOf", Np_valueOf, 0);
+ jsB_propf(J, "Number.prototype.toString", Np_toString, 1);
+ jsB_propf(J, "Number.prototype.toLocaleString", Np_toString, 0);
+ jsB_propf(J, "Number.prototype.toFixed", Np_toFixed, 1);
+ jsB_propf(J, "Number.prototype.toExponential", Np_toExponential, 1);
+ jsB_propf(J, "Number.prototype.toPrecision", Np_toPrecision, 1);
}
js_newcconstructor(J, jsB_Number, jsB_new_Number, "Number", 0); /* 1 */
{
--- a/jsobject.c
+++ b/jsobject.c
@@ -418,29 +418,29 @@
{
js_pushobject(J, J->Object_prototype);
{
- jsB_propf(J, "toString", Op_toString, 0);
- jsB_propf(J, "toLocaleString", Op_toString, 0);
- jsB_propf(J, "valueOf", Op_valueOf, 0);
- jsB_propf(J, "hasOwnProperty", Op_hasOwnProperty, 1);
- jsB_propf(J, "isPrototypeOf", Op_isPrototypeOf, 1);
- jsB_propf(J, "propertyIsEnumerable", Op_propertyIsEnumerable, 1);
+ jsB_propf(J, "Object.prototype.toString", Op_toString, 0);
+ jsB_propf(J, "Object.prototype.toLocaleString", Op_toString, 0);
+ jsB_propf(J, "Object.prototype.valueOf", Op_valueOf, 0);
+ jsB_propf(J, "Object.prototype.hasOwnProperty", Op_hasOwnProperty, 1);
+ jsB_propf(J, "Object.prototype.isPrototypeOf", Op_isPrototypeOf, 1);
+ jsB_propf(J, "Object.prototype.propertyIsEnumerable", Op_propertyIsEnumerable, 1);
}
js_newcconstructor(J, jsB_Object, jsB_new_Object, "Object", 1);
{
/* ES5 */
- jsB_propf(J, "getPrototypeOf", O_getPrototypeOf, 1);
- jsB_propf(J, "getOwnPropertyDescriptor", O_getOwnPropertyDescriptor, 2);
- jsB_propf(J, "getOwnPropertyNames", O_getOwnPropertyNames, 1);
- jsB_propf(J, "create", O_create, 2);
- jsB_propf(J, "defineProperty", O_defineProperty, 3);
- jsB_propf(J, "defineProperties", O_defineProperties, 2);
- jsB_propf(J, "seal", O_seal, 1);
- jsB_propf(J, "freeze", O_freeze, 1);
- jsB_propf(J, "preventExtensions", O_preventExtensions, 1);
- jsB_propf(J, "isSealed", O_isSealed, 1);
- jsB_propf(J, "isFrozen", O_isFrozen, 1);
- jsB_propf(J, "isExtensible", O_isExtensible, 1);
- jsB_propf(J, "keys", O_keys, 1);
+ jsB_propf(J, "Object.getPrototypeOf", O_getPrototypeOf, 1);
+ jsB_propf(J, "Object.getOwnPropertyDescriptor", O_getOwnPropertyDescriptor, 2);
+ jsB_propf(J, "Object.getOwnPropertyNames", O_getOwnPropertyNames, 1);
+ jsB_propf(J, "Object.create", O_create, 2);
+ jsB_propf(J, "Object.defineProperty", O_defineProperty, 3);
+ jsB_propf(J, "Object.defineProperties", O_defineProperties, 2);
+ jsB_propf(J, "Object.seal", O_seal, 1);
+ jsB_propf(J, "Object.freeze", O_freeze, 1);
+ jsB_propf(J, "Object.preventExtensions", O_preventExtensions, 1);
+ jsB_propf(J, "Object.isSealed", O_isSealed, 1);
+ jsB_propf(J, "Object.isFrozen", O_isFrozen, 1);
+ jsB_propf(J, "Object.isExtensible", O_isExtensible, 1);
+ jsB_propf(J, "Object.keys", O_keys, 1);
}
js_defglobal(J, "Object", JS_DONTENUM);
}
--- a/json.c
+++ b/json.c
@@ -295,8 +295,8 @@
{
js_pushobject(J, jsV_newobject(J, JS_CJSON, J->Object_prototype));
{
- jsB_propf(J, "parse", JSON_parse, 2);
- jsB_propf(J, "stringify", JSON_stringify, 3);
+ jsB_propf(J, "JSON.parse", JSON_parse, 2);
+ jsB_propf(J, "JSON.stringify", JSON_stringify, 3);
}
js_defglobal(J, "JSON", JS_DONTENUM);
}
--- a/jsregexp.c
+++ b/jsregexp.c
@@ -185,9 +185,9 @@
{
js_pushobject(J, J->RegExp_prototype);
{
- jsB_propf(J, "toString", Rp_toString, 0);
- jsB_propf(J, "test", Rp_test, 0);
- jsB_propf(J, "exec", Rp_exec, 0);
+ jsB_propf(J, "RegExp.prototype.toString", Rp_toString, 0);
+ jsB_propf(J, "RegExp.prototype.test", Rp_test, 0);
+ jsB_propf(J, "RegExp.prototype.exec", Rp_exec, 0);
}
js_newcconstructor(J, jsB_RegExp, jsB_new_RegExp, "RegExp", 1);
js_defglobal(J, "RegExp", JS_DONTENUM);
--- a/jsstring.c
+++ b/jsstring.c
@@ -657,31 +657,31 @@
js_pushobject(J, J->String_prototype);
{
- jsB_propf(J, "toString", Sp_toString, 0);
- jsB_propf(J, "valueOf", Sp_valueOf, 0);
- jsB_propf(J, "charAt", Sp_charAt, 1);
- jsB_propf(J, "charCodeAt", Sp_charCodeAt, 1);
- jsB_propf(J, "concat", Sp_concat, 0); /* 1 */
- jsB_propf(J, "indexOf", Sp_indexOf, 1);
- jsB_propf(J, "lastIndexOf", Sp_lastIndexOf, 1);
- jsB_propf(J, "localeCompare", Sp_localeCompare, 1);
- jsB_propf(J, "match", Sp_match, 1);
- jsB_propf(J, "replace", Sp_replace, 2);
- jsB_propf(J, "search", Sp_search, 1);
- jsB_propf(J, "slice", Sp_slice, 2);
- jsB_propf(J, "split", Sp_split, 2);
- jsB_propf(J, "substring", Sp_substring, 2);
- jsB_propf(J, "toLowerCase", Sp_toLowerCase, 0);
- jsB_propf(J, "toLocaleLowerCase", Sp_toLowerCase, 0);
- jsB_propf(J, "toUpperCase", Sp_toUpperCase, 0);
- jsB_propf(J, "toLocaleUpperCase", Sp_toUpperCase, 0);
+ jsB_propf(J, "String.prototype.toString", Sp_toString, 0);
+ jsB_propf(J, "String.prototype.valueOf", Sp_valueOf, 0);
+ jsB_propf(J, "String.prototype.charAt", Sp_charAt, 1);
+ jsB_propf(J, "String.prototype.charCodeAt", Sp_charCodeAt, 1);
+ jsB_propf(J, "String.prototype.concat", Sp_concat, 0); /* 1 */
+ jsB_propf(J, "String.prototype.indexOf", Sp_indexOf, 1);
+ jsB_propf(J, "String.prototype.lastIndexOf", Sp_lastIndexOf, 1);
+ jsB_propf(J, "String.prototype.localeCompare", Sp_localeCompare, 1);
+ jsB_propf(J, "String.prototype.match", Sp_match, 1);
+ jsB_propf(J, "String.prototype.replace", Sp_replace, 2);
+ jsB_propf(J, "String.prototype.search", Sp_search, 1);
+ jsB_propf(J, "String.prototype.slice", Sp_slice, 2);
+ jsB_propf(J, "String.prototype.split", Sp_split, 2);
+ jsB_propf(J, "String.prototype.substring", Sp_substring, 2);
+ jsB_propf(J, "String.prototype.toLowerCase", Sp_toLowerCase, 0);
+ jsB_propf(J, "String.prototype.toLocaleLowerCase", Sp_toLowerCase, 0);
+ jsB_propf(J, "String.prototype.toUpperCase", Sp_toUpperCase, 0);
+ jsB_propf(J, "String.prototype.toLocaleUpperCase", Sp_toUpperCase, 0);
/* ES5 */
- jsB_propf(J, "trim", Sp_trim, 0);
+ jsB_propf(J, "String.prototype.trim", Sp_trim, 0);
}
js_newcconstructor(J, jsB_String, jsB_new_String, "String", 0); /* 1 */
{
- jsB_propf(J, "fromCharCode", S_fromCharCode, 0); /* 1 */
+ jsB_propf(J, "String.fromCharCode", S_fromCharCode, 0); /* 1 */
}
js_defglobal(J, "String", JS_DONTENUM);
}