mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 823348 - Do a better job of lying about the holder and make assertions fatal. r=mrbkap
I noticed this nonfatal assertion firing, unrelated to my patches. Leaking the holder is not so great. Let's fix this for real.
This commit is contained in:
parent
d0a9794947
commit
ddece7045a
@ -321,11 +321,11 @@ WrapperFactory::Rewrap(JSContext *cx, JSObject *existing, JSObject *obj,
|
||||
JSObject *wrappedProto, JSObject *parent,
|
||||
unsigned flags)
|
||||
{
|
||||
NS_ASSERTION(!IsWrapper(obj) ||
|
||||
GetProxyHandler(obj) == &XrayWaiver ||
|
||||
js::GetObjectClass(obj)->ext.innerObject,
|
||||
"wrapped object passed to rewrap");
|
||||
NS_ASSERTION(JS_GetClass(obj) != &XrayUtils::HolderClass, "trying to wrap a holder");
|
||||
MOZ_ASSERT(!IsWrapper(obj) ||
|
||||
GetProxyHandler(obj) == &XrayWaiver ||
|
||||
js::GetObjectClass(obj)->ext.innerObject,
|
||||
"wrapped object passed to rewrap");
|
||||
MOZ_ASSERT(JS_GetClass(obj) != &XrayUtils::HolderClass, "trying to wrap a holder");
|
||||
|
||||
JSCompartment *origin = js::GetObjectCompartment(obj);
|
||||
JSCompartment *target = js::GetContextCompartment(cx);
|
||||
|
@ -1399,8 +1399,10 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, JSObject *wrappe
|
||||
if (!Traits::singleton.resolveOwnProperty(cx, *this, wrapper, holder, id, desc, flags))
|
||||
return false;
|
||||
|
||||
if (desc->obj)
|
||||
if (desc->obj) {
|
||||
desc->obj = wrapper;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!JS_GetPropertyDescriptorById(cx, holder, id, 0, desc))
|
||||
return false;
|
||||
@ -1428,11 +1430,15 @@ XrayWrapper<Base, Traits>::getPropertyDescriptor(JSContext *cx, JSObject *wrappe
|
||||
desc->value.setObject(*JS_GetFunctionObject(toString));
|
||||
}
|
||||
|
||||
if (!JS_DefinePropertyById(cx, holder, id, desc->value, desc->getter,
|
||||
desc->setter, desc->attrs) ||
|
||||
!JS_GetPropertyDescriptorById(cx, holder, id, flags, desc))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(desc->obj);
|
||||
desc->obj = wrapper;
|
||||
|
||||
return JS_DefinePropertyById(cx, holder, id, desc->value, desc->getter, desc->setter,
|
||||
desc->attrs) &&
|
||||
JS_GetPropertyDescriptorById(cx, holder, id, flags, desc);
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename Base, typename Traits>
|
||||
@ -1472,8 +1478,10 @@ XrayWrapper<Base, Traits>::getOwnPropertyDescriptor(JSContext *cx, JSObject *wra
|
||||
if (!Traits::singleton.resolveOwnProperty(cx, *this, wrapper, holder, id, desc, flags))
|
||||
return false;
|
||||
|
||||
if (desc->obj)
|
||||
if (desc->obj) {
|
||||
desc->obj = wrapper;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!JS_GetPropertyDescriptorById(cx, holder, id, flags, desc))
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user