зеркало из https://github.com/mozilla/pjs.git
Back out patch for bug 245890 for now.
This commit is contained in:
Родитель
c450d627a0
Коммит
3376e7fb87
|
@ -2880,7 +2880,8 @@ JS_SetReservedSlot(JSContext *cx, JSObject *obj, uint32 index, jsval v)
|
|||
if (index >= limit && !ReservedSlotIndexOK(cx, obj, clasp, index, limit))
|
||||
return JS_FALSE;
|
||||
slot = JSSLOT_START(clasp) + index;
|
||||
return OBJ_SET_REQUIRED_SLOT(cx, obj, slot, v);
|
||||
OBJ_SET_REQUIRED_SLOT(cx, obj, slot, v);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
|
|
|
@ -3964,26 +3964,16 @@ js_GetRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot)
|
|||
return v;
|
||||
}
|
||||
|
||||
JSBool
|
||||
void
|
||||
js_SetRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot, jsval v)
|
||||
{
|
||||
JSScope *scope;
|
||||
uint32 nslots, rlimit, i;
|
||||
JSClass *clasp;
|
||||
jsval *newslots;
|
||||
|
||||
JS_LOCK_OBJ(cx, obj);
|
||||
scope = OBJ_SCOPE(obj);
|
||||
nslots = (uint32) obj->slots[-1];
|
||||
if (slot >= nslots) {
|
||||
if (scope->object != obj) {
|
||||
scope = js_GetMutableScope(cx, obj);
|
||||
if (!scope) {
|
||||
JS_UNLOCK_OBJ(cx, obj);
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
clasp = LOCKED_OBJ_GET_CLASS(obj);
|
||||
rlimit = JSSLOT_START(clasp) + JSCLASS_RESERVED_SLOTS(clasp);
|
||||
if (clasp->reserveSlots)
|
||||
|
@ -3996,20 +3986,18 @@ js_SetRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot, jsval v)
|
|||
JS_realloc(cx, obj->slots - 1, (nslots + 1) * sizeof(jsval));
|
||||
if (!newslots) {
|
||||
JS_UNLOCK_OBJ(cx, obj);
|
||||
return JS_FALSE;
|
||||
return;
|
||||
}
|
||||
for (i = 1 + newslots[0]; i <= rlimit; i++)
|
||||
newslots[i] = JSVAL_VOID;
|
||||
newslots[0] = scope->map.nslots = nslots;
|
||||
newslots[0] = nslots;
|
||||
if (OBJ_SCOPE(obj)->object == obj)
|
||||
obj->map->nslots = nslots;
|
||||
obj->slots = newslots + 1;
|
||||
|
||||
if (slot >= scope->map.freeslot)
|
||||
scope->map.freeslot = slot + 1;
|
||||
}
|
||||
|
||||
obj->slots[slot] = v;
|
||||
JS_UNLOCK_SCOPE(cx, scope);
|
||||
return JS_TRUE;
|
||||
JS_UNLOCK_OBJ(cx, obj);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -103,7 +103,7 @@ struct JSObjectMap {
|
|||
#define OBJ_SET_REQUIRED_SLOT(cx,obj,slot,v) \
|
||||
((obj)->map->ops->setRequiredSlot \
|
||||
? (obj)->map->ops->setRequiredSlot(cx, obj, slot, v) \
|
||||
: JS_TRUE)
|
||||
: (void)0)
|
||||
|
||||
/*
|
||||
* In the original JS engine design, obj->slots pointed to a vector of length
|
||||
|
@ -456,7 +456,7 @@ js_Clear(JSContext *cx, JSObject *obj);
|
|||
extern jsval
|
||||
js_GetRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot);
|
||||
|
||||
extern JSBool
|
||||
extern void
|
||||
js_SetRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot, jsval v);
|
||||
|
||||
JS_END_EXTERN_C
|
||||
|
|
|
@ -487,7 +487,7 @@ typedef jsval
|
|||
(* JS_DLL_CALLBACK JSGetRequiredSlotOp)(JSContext *cx, JSObject *obj,
|
||||
uint32 slot);
|
||||
|
||||
typedef JSBool
|
||||
typedef void
|
||||
(* JS_DLL_CALLBACK JSSetRequiredSlotOp)(JSContext *cx, JSObject *obj,
|
||||
uint32 slot, jsval v);
|
||||
|
||||
|
|
|
@ -1024,7 +1024,7 @@ jsj_wrapper_getRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot)
|
|||
return obj->slots[slot];
|
||||
}
|
||||
|
||||
JSBool JS_DLL_CALLBACK
|
||||
void JS_DLL_CALLBACK
|
||||
jsj_wrapper_setRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot, jsval v)
|
||||
{
|
||||
JS_ASSERT(slot < JSJ_SLOT_COUNT);
|
||||
|
@ -1032,7 +1032,6 @@ jsj_wrapper_setRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot, jsval v)
|
|||
JS_ASSERT(obj->map->nslots == JSJ_SLOT_COUNT);
|
||||
JS_ASSERT(obj->map->freeslot == JSJ_SLOT_COUNT);
|
||||
obj->slots[slot] = v;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSObjectOps JavaObject_ops = {
|
||||
|
|
|
@ -658,7 +658,7 @@ jsj_wrapper_destroyObjectMap(JSContext *cx, JSObjectMap *map);
|
|||
extern jsval JS_DLL_CALLBACK
|
||||
jsj_wrapper_getRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot);
|
||||
|
||||
extern JSBool JS_DLL_CALLBACK
|
||||
extern void JS_DLL_CALLBACK
|
||||
jsj_wrapper_setRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot, jsval v);
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
Загрузка…
Ссылка в новой задаче