summaryrefslogtreecommitdiffstats
path: root/abs/extra-testing/xulrunner/nsThreadUtils.patch
blob: 69609c03f35f6440c8b96ff385a525661ae19f59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--- xulrunner-1.9.0.4.orig/xpcom/glue/nsThreadUtils.cpp
+++ xulrunner-1.9.0.4/xpcom/glue/nsThreadUtils.cpp
@@ -187,24 +187,27 @@
 }
 #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) {
+#ifndef MOZILLA_INTERNAL_API
+    nsCOMPtr<nsIThread> current;
+    NS_GetCurrentThread(getter_AddRefs(current));
+    return hasPendingEvents(current);
+#else
     thread = NS_GetCurrentThread();
     NS_ENSURE_TRUE(thread, PR_FALSE);
-  }
-#else
-  nsCOMPtr<nsIThread> 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