From 246d4cda5a78b596c9a37409bc660858ab4dbe01 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Sat, 29 Oct 2011 01:35:34 +0000
Subject: [PATCH] Add a pair of patches to allow request debugging.

---
 3rdp/build/jsapi.cpp-request-debug.patch | 31 ++++++++++++++++++++++++
 3rdp/build/jsapi.h-request-debug.patch   | 15 ++++++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 3rdp/build/jsapi.cpp-request-debug.patch
 create mode 100644 3rdp/build/jsapi.h-request-debug.patch

diff --git a/3rdp/build/jsapi.cpp-request-debug.patch b/3rdp/build/jsapi.cpp-request-debug.patch
new file mode 100644
index 0000000000..b2f35606db
--- /dev/null
+++ b/3rdp/build/jsapi.cpp-request-debug.patch
@@ -0,0 +1,31 @@
+--- js-1.8.5/js/src/jsapi.cpp.orig	2011-10-28 18:26:10.000000000 -0700
++++ js-1.8.5/js/src/jsapi.cpp	2011-10-28 18:33:03.000000000 -0700
+@@ -955,6 +955,28 @@
+ #endif
+ }
+ 
++JS_PUBLIC_API(jsrefcount)
++JS_RequestDepth(JSContext *cx)
++{
++#ifdef JS_THREADSAFE
++    JS_ASSERT(CURRENT_THREAD_IS_ME(cx->thread));
++    return JS_THREAD_DATA(cx)->requestDepth;
++#else
++    return false;
++#endif
++}
++
++JS_PUBLIC_API(jsrefcount)
++JS_SuspendDepth(JSContext *cx)
++{
++#ifdef JS_THREADSAFE
++    JS_ASSERT(CURRENT_THREAD_IS_ME(cx->thread));
++    return cx->thread->suspendCount;
++#else
++    return false;
++#endif
++}
++
+ JS_PUBLIC_API(void)
+ JS_Lock(JSRuntime *rt)
+ {
diff --git a/3rdp/build/jsapi.h-request-debug.patch b/3rdp/build/jsapi.h-request-debug.patch
new file mode 100644
index 0000000000..35efc20569
--- /dev/null
+++ b/3rdp/build/jsapi.h-request-debug.patch
@@ -0,0 +1,15 @@
+--- js-1.8.5/js/src/jsapi.h.orig	2011-10-28 18:26:04.000000000 -0700
++++ js-1.8.5/js/src/jsapi.h	2011-10-28 18:27:44.000000000 -0700
+@@ -758,6 +758,12 @@
+ extern JS_PUBLIC_API(JSBool)
+ JS_IsInRequest(JSContext *cx);
+ 
++extern JS_PUBLIC_API(jsrefcount)
++JS_RequestDepth(JSContext *cx);
++
++extern JS_PUBLIC_API(jsrefcount)
++JS_SuspendDepth(JSContext *cx);
++
+ #ifdef __cplusplus
+ JS_END_EXTERN_C
+ 
-- 
GitLab