Commits

ms2ger committed 740d925

Merge XPCPerThreadData.

  • Participants
  • Parent commits 1af539d

Comments (0)

Files changed (1)

 new file mode 100644
 --- /dev/null
 +++ b/js/xpconnect/src/XPCPerThreadData.h
-@@ -0,0 +1,199 @@
+@@ -0,0 +1,205 @@
 +/* This Source Code Form is subject to the terms of the Mozilla Public
 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
 +    // Get the instance of this object for the current thread
 +    static inline XPCPerThreadData *GetData(JSContext *cx)
 +    {
++        // Do a release-mode assert that we're not doing anything significant in
++        // XPConnect off the main thread. If you're an extension developer hitting
++        // this, you need to change your code. See bug 716167.
++        if (!NS_LIKELY(NS_IsMainThread() || NS_IsCycleCollectorThread()))
++            JS_Assert("NS_IsMainThread()", __FILE__, __LINE__);
++
 +        if (cx) {
 +            NS_ASSERTION(js::GetContextThread(cx), "Uh, JS context w/o a thread?");
 +            if (js::GetContextThread(cx) == sMainJSThread)
  
  #if defined(DEBUG_jband) || defined(DEBUG_jst) || defined(DEBUG_dbradley) || defined(DEBUG_shaver_no) || defined(DEBUG_timeless)
  #define DEBUG_xpc_hacker
-@@ -454,170 +455,16 @@ enum WrapperType {
+@@ -454,176 +455,16 @@ enum WrapperType {
  ****************************************************************************
  ***************************************************************************/
  
 -    // Get the instance of this object for the current thread
 -    static inline XPCPerThreadData* GetData(JSContext *cx)
 -    {
+-        // Do a release-mode assert that we're not doing anything significant in
+-        // XPConnect off the main thread. If you're an extension developer hitting
+-        // this, you need to change your code. See bug 716167.
+-        if (!NS_LIKELY(NS_IsMainThread() || NS_IsCycleCollectorThread()))
+-            JS_Assert("NS_IsMainThread()", __FILE__, __LINE__);
+-
 -        if (cx) {
 -            NS_ASSERTION(js::GetContextThread(cx), "Uh, JS context w/o a thread?");
 -