зеркало из https://github.com/mozilla/gecko-dev.git
Bug 754044 - Simplify the logic surrounding the prewrap callback in jscompartment.cpp. r=mrbkap
This commit is contained in:
Родитель
85164d5541
Коммит
7d18d916cc
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче