Fixing bug 305528. Make XPCWrappedNative::GetWrappedNativeOfJSObject() attempt to find a wrapper using obj's outer object if it can't find one using obj. r=shaver@mozilla.org, sr=brendan@mozilla.org

This commit is contained in:
jst%mozilla.jstenback.com 2005-08-25 04:30:31 +00:00
Родитель f4e065a67a
Коммит 6a012b0daa
1 изменённых файлов: 15 добавлений и 0 удалений

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

@ -1230,6 +1230,21 @@ return_tearoff:
}
}
// If we didn't find a wrapper using the given funobj and obj, try
// again with obj's outer object, if it's got one.
JSClass *clazz = JS_GET_CLASS(cx, obj);
if((clazz->flags & JSCLASS_IS_EXTENDED) &&
((JSExtendedClass*)clazz)->outerObject)
{
JSObject *outer = ((JSExtendedClass*)clazz)->outerObject(cx, obj);
if(outer && outer != obj)
return GetWrappedNativeOfJSObject(cx, outer, funobj, pobj2,
pTearOff);
}
return nsnull;
}