Don't resolve standard classes if JSRESOLVE_ASSIGNING (NOT PART OF BUILD).

This commit is contained in:
brendan%mozilla.org 2001-08-17 10:40:15 +00:00
Родитель 6843e21c2b
Коммит b0e3e4ab62
1 изменённых файлов: 57 добавлений и 47 удалений

Просмотреть файл

@ -1887,22 +1887,27 @@ global_enumerate(JSContext *cx, JSObject *obj)
} }
static JSBool static JSBool
global_resolve(JSContext *cx, JSObject *obj, jsval id) global_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
JSObject **objp)
{ {
#ifdef LAZY_STANDARD_CLASSES #ifdef LAZY_STANDARD_CLASSES
if ((flags & JSRESOLVE_ASSIGNING) == 0) {
JSBool resolved; JSBool resolved;
if (!JS_ResolveStandardClass(cx, obj, id, &resolved)) if (!JS_ResolveStandardClass(cx, obj, id, &resolved))
return JS_FALSE; return JS_FALSE;
if (resolved) if (resolved) {
*objp = obj;
return JS_TRUE; return JS_TRUE;
}
}
#endif #endif
#if defined(SHELL_HACK) && defined(DEBUG) && defined(XP_UNIX) #if defined(SHELL_HACK) && defined(DEBUG) && defined(XP_UNIX)
{ if ((flags & (JSRESOLVE_QUALIFIED | JSRESOLVE_ASSIGNING)) == 0) {
/* /*
* Do this expensive hack only for unoptimized Unix builds, which are not * Do this expensive hack only for unoptimized Unix builds, which are
* used for benchmarking. * not used for benchmarking.
*/ */
char *path, *comp, *full; char *path, *comp, *full;
const char *name; const char *name;
@ -1934,8 +1939,11 @@ global_resolve(JSContext *cx, JSObject *obj, jsval id)
if (*comp != '\0') if (*comp != '\0')
free(full); free(full);
if (found) { if (found) {
fun = JS_DefineFunction(cx, obj, name, Exec, 0, JSPROP_ENUMERATE); fun = JS_DefineFunction(cx, obj, name, Exec, 0,
JSPROP_ENUMERATE);
ok = (fun != NULL); ok = (fun != NULL);
if (ok)
*objp = obj;
break; break;
} }
} }
@ -1948,9 +1956,11 @@ global_resolve(JSContext *cx, JSObject *obj, jsval id)
} }
static JSClass global_class = { static JSClass global_class = {
"global", 0, "global", JSCLASS_NEW_RESOLVE,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
global_enumerate, global_resolve, JS_ConvertStub, JS_FinalizeStub JS_PropertyStub, JS_PropertyStub,
global_enumerate, (JSResolveOp) global_resolve,
JS_ConvertStub, JS_FinalizeStub
}; };
int int