diff --git a/xpcom/base/nsCOMPtr.cpp b/xpcom/base/nsCOMPtr.cpp index c95f17579e01..16dbed86038b 100644 --- a/xpcom/base/nsCOMPtr.cpp +++ b/xpcom/base/nsCOMPtr.cpp @@ -28,7 +28,12 @@ nsQueryInterface::operator()( const nsIID& aIID, void** answer ) const { nsresult status; if ( mRawPtr ) - status = mRawPtr->QueryInterface(aIID, answer); + { + status = mRawPtr->QueryInterface(aIID, answer); +#ifdef NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS + NS_WARN_IF_FALSE(NS_SUCCEEDED(status), "interface not found---were you expecting that?"); +#endif + } else status = NS_ERROR_NULL_POINTER; diff --git a/xpcom/base/nsCOMPtr.h b/xpcom/base/nsCOMPtr.h index bcd04aa09840..5f3487251bb6 100644 --- a/xpcom/base/nsCOMPtr.h +++ b/xpcom/base/nsCOMPtr.h @@ -98,7 +98,7 @@ #ifdef NS_DEBUG #define NSCAP_FEATURE_TEST_DONTQUERY_CASES #define NSCAP_FEATURE_DEBUG_PTR_TYPES - #define NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS +//#define NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS #endif /* @@ -185,7 +185,7 @@ class nsDerivedSafe : public T /* Compiler warnings and errors: nsDerivedSafe operator=() hides inherited operator=(). - If you see that, that means somebody checked in a (XP)COM interface class that declares an + If you see that, that means somebody checked in a [XP]COM interface class that declares an |operator=()|, and that's _bad_. So bad, in fact, that this declaration exists explicitly to stop people from doing it. */ @@ -835,13 +835,11 @@ class nsGetterAddRefs // nothing else to do } -#if 0 #ifdef NSCAP_FEATURE_TEST_DONTQUERY_CASES ~nsGetterAddRefs() { mTargetSmartPtr.Assert_NoQueryNeeded(); } -#endif #endif operator void**() diff --git a/xpcom/glue/nsCOMPtr.cpp b/xpcom/glue/nsCOMPtr.cpp index c95f17579e01..16dbed86038b 100644 --- a/xpcom/glue/nsCOMPtr.cpp +++ b/xpcom/glue/nsCOMPtr.cpp @@ -28,7 +28,12 @@ nsQueryInterface::operator()( const nsIID& aIID, void** answer ) const { nsresult status; if ( mRawPtr ) - status = mRawPtr->QueryInterface(aIID, answer); + { + status = mRawPtr->QueryInterface(aIID, answer); +#ifdef NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS + NS_WARN_IF_FALSE(NS_SUCCEEDED(status), "interface not found---were you expecting that?"); +#endif + } else status = NS_ERROR_NULL_POINTER; diff --git a/xpcom/glue/nsCOMPtr.h b/xpcom/glue/nsCOMPtr.h index bcd04aa09840..5f3487251bb6 100644 --- a/xpcom/glue/nsCOMPtr.h +++ b/xpcom/glue/nsCOMPtr.h @@ -98,7 +98,7 @@ #ifdef NS_DEBUG #define NSCAP_FEATURE_TEST_DONTQUERY_CASES #define NSCAP_FEATURE_DEBUG_PTR_TYPES - #define NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS +//#define NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS #endif /* @@ -185,7 +185,7 @@ class nsDerivedSafe : public T /* Compiler warnings and errors: nsDerivedSafe operator=() hides inherited operator=(). - If you see that, that means somebody checked in a (XP)COM interface class that declares an + If you see that, that means somebody checked in a [XP]COM interface class that declares an |operator=()|, and that's _bad_. So bad, in fact, that this declaration exists explicitly to stop people from doing it. */ @@ -835,13 +835,11 @@ class nsGetterAddRefs // nothing else to do } -#if 0 #ifdef NSCAP_FEATURE_TEST_DONTQUERY_CASES ~nsGetterAddRefs() { mTargetSmartPtr.Assert_NoQueryNeeded(); } -#endif #endif operator void**()