[INFER] Define static functions after defining the class for Number, String, bug 647537.

This commit is contained in:
Brian Hackett 2011-04-03 13:14:38 -07:00
parent f673128fdb
commit 1e01fd5422
2 changed files with 8 additions and 7 deletions

View File

@ -1083,14 +1083,15 @@ js_InitNumberClass(JSContext *cx, JSObject *obj)
/* XXX must do at least once per new thread, so do it per JSContext... */
FIX_FPU();
if (!JS_DefineFunctionsWithPrefix(cx, obj, number_functions, js_Number_str))
return NULL;
proto = js_InitClass(cx, obj, NULL, &js_NumberClass, Number, 1, type_NewNumber,
NULL, number_methods, NULL, NULL);
if (!proto || !(ctor = JS_GetConstructor(cx, proto)))
return NULL;
proto->setPrimitiveThis(Int32Value(0));
if (!JS_DefineFunctionsWithPrefix(cx, obj, number_functions, js_Number_str))
return NULL;
if (!JS_DefineConstDoubles(cx, ctor, number_constants))
return NULL;

View File

@ -3589,10 +3589,6 @@ js_InitStringClass(JSContext *cx, JSObject *obj)
{
JSObject *proto;
/* Define the escape, unescape functions in the global object. */
if (!JS_DefineFunctionsWithPrefix(cx, obj, string_functions, js_String_str))
return NULL;
proto = js_InitClass(cx, obj, NULL, &js_StringClass, js_String, 1,
type_NewString,
NULL, string_methods,
@ -3608,6 +3604,10 @@ js_InitStringClass(JSContext *cx, JSObject *obj)
return JS_FALSE;
}
/* Define the escape, unescape functions in the global object. */
if (!JS_DefineFunctionsWithPrefix(cx, obj, string_functions, js_String_str))
return NULL;
if (!cx->addTypePropertyId(proto->getType(), lengthId, TYPE_INT32))
return NULL;