Fix for bug 533401 (Names added through external DOM classinfo don't resolve on global object). r=jst, a=beltzner.

This commit is contained in:
Peter Van der Beken 2009-12-08 13:46:42 -08:00
parent 86306358a3
commit 7b1a7303e7

View File

@ -4325,14 +4325,6 @@ nsDOMClassInfo::PostCreatePrototype(JSContext * cx, JSObject * proto)
JS_ClearPendingException(cx);
}
static const nsIID *sSupportsIID = &NS_GET_IID(nsISupports);
// This is safe because...
if (mData->mProtoChainInterface == sSupportsIID ||
!mData->mProtoChainInterface) {
return NS_OK;
}
// This is called before any other location that requires
// sObjectClass, so compute it here. We assume that nobody has had a
// chance to monkey around with proto's prototype chain before this.
@ -4345,9 +4337,10 @@ nsDOMClassInfo::PostCreatePrototype(JSContext * cx, JSObject * proto)
NS_ASSERTION(::JS_GetPrototype(cx, proto) &&
JS_GET_CLASS(cx, ::JS_GetPrototype(cx, proto)) == sObjectClass,
"Hmm, somebody did something evil?");
#ifdef DEBUG
if (mData->mHasClassInterface) {
if (mData->mHasClassInterface && mData->mProtoChainInterface &&
mData->mProtoChainInterface != &NS_GET_IID(nsISupports)) {
nsCOMPtr<nsIInterfaceInfoManager>
iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));