summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-10-21 17:11:48 -0400
committerColin Walters <walters@verbum.org>2010-10-21 17:35:38 -0400
commitc23460de832e0c3fb1a9f9319f2ad1a4dd21d9b4 (patch)
treebdd9bc4e29cd7177106e8ddefac2182ffb301e10
parent63c1409c0ce6d6dbca5df0e9ace55511263d28a7 (diff)
downloadgjs-c23460de832e0c3fb1a9f9319f2ad1a4dd21d9b4.tar.gz
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.
-rw-r--r--configure.ac2
-rw-r--r--gjs/stack.c12
2 files changed, 14 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 59665617..330a0ed9 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 686a335e..cf257847 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 */