mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 754044 - Simplify the logic surrounding the prewrap callback in jscompartment.cpp. r=mrbkap
This commit is contained in:
parent
34a529a141
commit
d4db4d398f
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user