summaryrefslogtreecommitdiff
path: root/javascript/jsapi.h
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2012-10-28 15:37:55 +0000
committerVincent Sanders <vince@kyllikki.org>2012-10-28 15:37:55 +0000
commitb5313189058a15cf3a30709875fd4ced1d3a6927 (patch)
tree2a69b25d2a5ddc7a5646d5d1f6a9a2af17ffc213 /javascript/jsapi.h
parentac5ade2f561fe508294ba1725eef47ddfa9505d0 (diff)
downloadnetsurf-b5313189058a15cf3a30709875fd4ced1d3a6927.tar.gz
netsurf-b5313189058a15cf3a30709875fd4ced1d3a6927.tar.bz2
fix obtaining the "this" object
Diffstat (limited to 'javascript/jsapi.h')
-rw-r--r--javascript/jsapi.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/javascript/jsapi.h b/javascript/jsapi.h
index 93c0effdd..e7c10c139 100644
--- a/javascript/jsapi.h
+++ b/javascript/jsapi.h
@@ -29,19 +29,17 @@
#include "mozjs/jsapi.h"
#endif
-#include "render/html_internal.h"
-
#if JS_VERSION <= 180
#include <string.h>
-/* *CAUTION* these macros introduce and use jsthis and jsrval
+/* *CAUTION* these macros introduce and use jsapi_this and jsapi_rval
* parameters, native function code should not conflict with these
*/
/* five parameter jsapi native call */
#define JSAPI_NATIVE(name, cx, argc, vp) \
- jsapi_native_##name(cx, JSObject *jsthis, argc, vp, jsval *jsrval)
+ jsapi_native_##name(cx, JSObject *jsapi_this, argc, vp, jsval *jsapi_rval)
/* five parameter function descriptor */
#define JSAPI_FS(name, nargs, flags) \
@@ -51,14 +49,17 @@
#define JSAPI_FS_END JS_FS_END
/* return value */
-#define JSAPI_RVAL(cx, vp) JS_RVAL(cx, jsrval)
+#define JSAPI_RVAL(cx, vp) JS_RVAL(cx, jsapi_rval)
/* return value setter */
-#define JSAPI_SET_RVAL(cx, vp, v) JS_SET_RVAL(cx, jsrval, v)
+#define JSAPI_SET_RVAL(cx, vp, v) JS_SET_RVAL(cx, jsapi_rval, v)
/* arguments */
#define JSAPI_ARGV(cx, vp) (vp)
+/* The object instance in a native call */
+#define JSAPI_THIS_OBJECT(cx,vp) jsapi_this
+
/* proprty native calls */
#define JSAPI_PROPERTYGET(name, cx, obj, vp) \
jsapi_property_##name##_get(cx, obj, jsval id, vp)
@@ -93,8 +94,10 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
outchar = JS_GetStringBytes(injsstring); \
outlen = strlen(outchar)
+
#else /* #if JS_VERSION <= 180 */
+
/* three parameter jsapi native call */
#define JSAPI_NATIVE(name, cx, argc, vp) jsapi_native_##name(cx, argc, vp)
@@ -114,6 +117,9 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
/* arguments */
#define JSAPI_ARGV(cx, vp) JS_ARGV(cx,vp)
+/* The object instance in a native call */
+#define JSAPI_THIS_OBJECT(cx,vp) JS_THIS_OBJECT(cx,vp)
+
/* proprty native calls */
#define JSAPI_PROPERTYGET(name, cx, obj, vp) \
jsapi_property_##name##_get(cx, obj, jsid id, vp)