Fix for bug 533401 (Names added through external DOM classinfo don't resolve on global object). r=jst, a=blocking192.
authorPeter Van der Beken <peterv@propagandism.org>
Tue, 08 Dec 2009 13:46:42 -0800
changeset 33357 f3f8b87e11e90ed014c31ab8b7ab57fcdc052b58
parent 33356 5e9329cfac704e841b8f8ee6ea1e690a7d87b814
child 33358 0b5a1d59f5f6e11d017bd37fe55db98a82160d5c
push id910
push userpvanderbeken@mozilla.com
push dateSun, 13 Dec 2009 19:47:52 +0000
reviewersjst, blocking192
bugs533401
milestone1.9.2b6pre
Fix for bug 533401 (Names added through external DOM classinfo don't resolve on global object). r=jst, a=blocking192.
dom/base/nsDOMClassInfo.cpp
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -4246,39 +4246,32 @@ nsDOMClassInfo::PostCreatePrototype(JSCo
     count++;
   }
 
   if (!sXPConnect->DefineDOMQuickStubs(cx, proto, flags,
                                        count, mData->mInterfaces)) {
     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.
   if (!sObjectClass) {
     FindObjectClass(proto);
     NS_ASSERTION(sObjectClass && !strcmp(sObjectClass->name, "Object"),
                  "Incorrect object class!");
   }
 
   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));
 
     if (iim) {
       nsCOMPtr<nsIInterfaceInfo> if_info;
       iim->GetInfoForIID(mData->mProtoChainInterface,
                          getter_AddRefs(if_info));