Index: mozilla/xpcom/glue/nsThreadUtils.cpp =================================================================== RCS file: /cvsroot/mozilla/xpcom/glue/nsThreadUtils.cpp,v retrieving revision 1.8 diff -u -p -r1.8 nsThreadUtils.cpp --- mozilla/xpcom/glue/nsThreadUtils.cpp 21 Feb 2008 12:47:26 -0000 1.8 +++ mozilla/xpcom/glue/nsThreadUtils.cpp 23 Jul 2008 09:09:00 -0000 @@ -187,24 +187,27 @@ NS_ProcessPendingEvents(nsIThread *threa } #endif // XPCOM_GLUE_AVOID_NSPR +inline PRBool +hasPendingEvents(nsIThread *thread) +{ + PRBool val; + return NS_SUCCEEDED(thread->HasPendingEvents(&val)) && val; +} + PRBool NS_HasPendingEvents(nsIThread *thread) { -#ifdef MOZILLA_INTERNAL_API - if (!thread) { + if (thread) { +#ifndef MOZILLA_INTERNAL_API + nsCOMPtr current; + NS_GetCurrentThread(getter_AddRefs(current)); + return hasPendingEvents(current); +#else thread = NS_GetCurrentThread(); NS_ENSURE_TRUE(thread, PR_FALSE); - } -#else - nsCOMPtr current; - if (!thread) { - NS_GetCurrentThread(getter_AddRefs(current)); - NS_ENSURE_TRUE(current, PR_FALSE); - thread = current.get(); - } #endif - PRBool val; - return NS_SUCCEEDED(thread->HasPendingEvents(&val)) && val; + } + return hasPendingEvents(thread); } PRBool