mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 989183 - Check for nsXBLJSClass. r=bz
This commit is contained in:
parent
ff8c36d435
commit
02270e76f1
@ -114,6 +114,12 @@ nsXBLJSClass::nsXBLJSClass(const nsAFlatCString& aClassName,
|
||||
finalize = XBLFinalize;
|
||||
}
|
||||
|
||||
bool
|
||||
nsXBLJSClass::IsXBLJSClass(const JSClass* aClass)
|
||||
{
|
||||
return aClass->finalize == XBLFinalize;
|
||||
}
|
||||
|
||||
nsrefcnt
|
||||
nsXBLJSClass::Destroy()
|
||||
{
|
||||
@ -988,7 +994,7 @@ nsXBLBinding::DoInitJSClass(JSContext *cx,
|
||||
if (!::JS_LookupPropertyWithFlags(cx, global, className.get(), 0, &val))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (val.isObject()) {
|
||||
if (val.isObject() && nsXBLJSClass::IsXBLJSClass(JS_GetClass(&val.toObject()))) {
|
||||
*aNew = false;
|
||||
proto = &val.toObject();
|
||||
} else {
|
||||
|
@ -161,6 +161,8 @@ public:
|
||||
nsrefcnt AddRef() { return Hold(); }
|
||||
nsrefcnt Release() { return Drop(); }
|
||||
|
||||
static bool IsXBLJSClass(const JSClass* aClass);
|
||||
|
||||
// Downcast from a pointer to const JSClass to a pointer to non-const
|
||||
// nsXBLJSClass.
|
||||
//
|
||||
@ -173,6 +175,7 @@ public:
|
||||
static nsXBLJSClass*
|
||||
fromJSClass(const JSClass* c)
|
||||
{
|
||||
MOZ_ASSERT(IsXBLJSClass(c));
|
||||
nsXBLJSClass* x = const_cast<nsXBLJSClass*>(static_cast<const nsXBLJSClass*>(c));
|
||||
MOZ_ASSERT(nsXBLService::getClass(x->mKey) == x);
|
||||
return x;
|
||||
|
Loading…
Reference in New Issue
Block a user