[gjs/wip/xulrunner-2-rebase2: 2/9] Adapt to JS_GetFrameThis API change



commit 78852adc741a459da199863e30594d4a9cabb3e6
Author: Colin Walters <walters verbum org>
Date:   Thu Oct 21 17:11:48 2010 -0400

    Adapt to JS_GetFrameThis API change
    
    See upstraem commit 38cbd4e02afc.  We can detect the difference
    by checking for JS_EndPC, which was introduced around the same
    time.

 configure.ac |    2 ++
 gjs/stack.c  |   12 ++++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 98fe77a..8c79ad7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -154,6 +154,8 @@ if `$PKG_CONFIG --exists $JS_PACKAGE '>=' 2`; then
               , [$JS_LIBS])
   AC_CHECK_LIB([mozjs], [JS_IsScriptFrame], AC_DEFINE([HAVE_JS_ISSCRIPTFRAME], [1], [Define if we have JS_IsScriptFrame]),
               , [$JS_LIBS])
+  AC_CHECK_LIB([mozjs], [JS_EndPC], AC_DEFINE([HAVE_JS_ENDPC], [1], [Define if we have JS_EndPC]),
+              , [$JS_LIBS])
 
 else
   AC_MSG_RESULT([no])
diff --git a/gjs/stack.c b/gjs/stack.c
index 686a335..cf25784 100644
--- a/gjs/stack.c
+++ b/gjs/stack.c
@@ -120,7 +120,19 @@ format_frame(JSContext* cx, JSStackFrame* fp,
                 call_props.array = NULL;
         }
 
+	/* commit 38cbd4e02afc */
+#ifdef HAVE_JS_ENDPC
+	{
+	  jsval thisval;
+	  if (JS_GetFrameThis(cx, fp, &thisval))
+	    this_obj = JSVAL_TO_OBJECT(thisval);
+	  else
+	    this_obj = NULL;
+	}
+#else
         this_obj = JS_GetFrameThis(cx, fp);
+#endif
+
     }
 
     /* print the frame number and function name */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]