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



commit c23460de832e0c3fb1a9f9319f2ad1a4dd21d9b4
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 5966561..330a0ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -153,6 +153,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]