Bug 786008 - Add a debug check to make sure that QueryInterface implementations always handle nsISupports; r=ehsan

This commit is contained in:
Luqman Aden 2012-08-28 12:33:47 -04:00
parent 6e58310da8
commit 35d92e4b27

View File

@ -30,6 +30,8 @@
#include "nsCycleCollector.h"
#include "nsCycleCollectorUtils.h"
#include "mozilla/Assertions.h"
////////////////////////////////////////////////////////////////////////////////
// Macros to help detect thread-safety:
@ -666,7 +668,11 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
foundInterface = 0; \
nsresult status; \
if ( !foundInterface ) \
status = NS_NOINTERFACE; \
{ \
/* nsISupports should be handled by this point. If not, fail. */ \
MOZ_ASSERT(!aIID.Equals(NS_GET_IID(nsISupports))); \
status = NS_NOINTERFACE; \
} \
else \
{ \
NS_ADDREF(foundInterface); \