Bug 754044 - Simplify the logic surrounding the prewrap callback in jscompartment.cpp. r=mrbkap

This commit is contained in:
Bobby Holley 2012-05-14 23:30:07 +02:00
Родитель 85164d5541
Коммит 7d18d916cc
1 изменённых файлов: 13 добавлений и 23 удалений

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

@ -187,33 +187,23 @@ JSCompartment::wrap(JSContext *cx, Value *vp)
if (obj->isStopIteration())
return js_FindClassObject(cx, NULL, JSProto_StopIteration, vp);
/* Don't unwrap an outer window proxy. */
if (!obj->getClass()->ext.innerObject) {
obj = UnwrapObject(&vp->toObject(), true, &flags);
vp->setObject(*obj);
if (obj->compartment() == this)
return true;
/* Unwrap the object, but don't unwrap outer windows. */
obj = UnwrapObject(&vp->toObject(), /* stopAtOuter = */ true, &flags);
if (cx->runtime->preWrapObjectCallback) {
obj = cx->runtime->preWrapObjectCallback(cx, global, obj, flags);
if (!obj)
return false;
}
vp->setObject(*obj);
if (obj->compartment() == this)
return true;
vp->setObject(*obj);
if (obj->compartment() == this)
return true;
} else {
if (cx->runtime->preWrapObjectCallback) {
obj = cx->runtime->preWrapObjectCallback(cx, global, obj, flags);
if (!obj)
return false;
}
JS_ASSERT(!obj->isWrapper() || obj->getClass()->ext.innerObject);
vp->setObject(*obj);
if (cx->runtime->preWrapObjectCallback) {
obj = cx->runtime->preWrapObjectCallback(cx, global, obj, flags);
if (!obj)
return false;
}
vp->setObject(*obj);
if (obj->compartment() == this)
return true;
#ifdef DEBUG
{
JSObject *outer = obj;