bug 583404 - backport of fix from David for JM branch.

This commit is contained in:
Igor Bukanov 2010-07-31 11:42:28 +02:00
Родитель 8bc740b0b7
Коммит f627d24fb9
1 изменённых файлов: 5 добавлений и 8 удалений

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

@ -5952,26 +5952,23 @@ js_TraceObject(JSTracer *trc, JSObject *obj)
void
js_ClearNative(JSContext *cx, JSObject *obj)
{
JSScope *scope;
uint32 i, n;
/*
* Clear our scope and the property cache of all obj's properties only if
* obj owns the scope (i.e., not if obj is sharing another object's scope).
* NB: we do not clear any reserved slots lying below JSSLOT_FREE(clasp).
*/
JS_LOCK_OBJ(cx, obj);
scope = obj->scope();
JSScope *scope = obj->scope();
if (!scope->isSharedEmpty()) {
/* Now that we're done using scope->lastProp/table, clear scope. */
scope->clear(cx);
/* Clear slot values and reset freeslot so we're consistent. */
i = obj->numSlots();
n = JSSLOT_FREE(obj->getClass());
while (--i >= n)
uint32 freeslot = JSSLOT_FREE(obj->getClass());
uint32 n = obj->numSlots();
for (uint32 i = freeslot; i < n; ++i)
obj->setSlot(i, UndefinedValue());
scope->freeslot = n;
scope->freeslot = freeslot;
}
JS_UNLOCK_OBJ(cx, obj);
}