summaryrefslogtreecommitdiff
path: root/javascript
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2012-11-23 13:48:11 +0000
committerVincent Sanders <vince@netsurf-browser.org>2012-11-23 13:48:11 +0000
commitec43456e4bf0968bc68b437733199ad2af609c1e (patch)
tree491804c4247aeab02ad23293c9e7f2c37636f499 /javascript
parent8bccf1615876f7c0ddf62c05f1b9fbc78b011b94 (diff)
downloadnetsurf-ec43456e4bf0968bc68b437733199ad2af609c1e.tar.gz
netsurf-ec43456e4bf0968bc68b437733199ad2af609c1e.tar.bz2
use unshared type handler for all events on window
Diffstat (limited to 'javascript')
-rw-r--r--javascript/jsapi.h27
-rw-r--r--javascript/jsapi/location.bnd1
-rw-r--r--javascript/jsapi/window.bnd10
3 files changed, 32 insertions, 6 deletions
diff --git a/javascript/jsapi.h b/javascript/jsapi.h
index 718dd2021..6b0f1124d 100644
--- a/javascript/jsapi.h
+++ b/javascript/jsapi.h
@@ -74,9 +74,9 @@
/* native proprty definition */
#define JSAPI_PROP_GETTER(name, cx, obj, vp) \
- jsapi_property_##name##_get(cx, obj, jsval id, vp)
+ jsapi_property_##name##_get(cx, obj, jsval jsapi_id, vp)
#define JSAPI_PROP_SETTER(name, cx, obj, vp) \
- jsapi_property_##name##_set(cx, obj, jsval id, vp)
+ jsapi_property_##name##_set(cx, obj, jsval jsapi_id, vp)
/* native property return value */
#define JSAPI_PROP_RVAL(cx, vp) (vp)
@@ -84,6 +84,9 @@
/* native property getter return value */
#define JSAPI_PROP_SET_RVAL(cx, vp, v) (*(vp) = (v))
+/* native property ID value as a jsval */
+#define JSAPI_PROP_IDVAL(cx, vp) (*(vp) = jsapi_id)
+
/* native property specifier */
#define JSAPI_PS(name, fnname, tinyid, flags) \
{ name , tinyid , flags , jsapi_property_##fnname##_get , jsapi_property_##fnname##_set }
@@ -183,11 +186,14 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
/* The object instance in a native call */
#define JSAPI_THIS_OBJECT(cx,vp) jsapi_this
+
+
+
/* proprty native calls */
#define JSAPI_PROP_GETTER(name, cx, obj, vp) \
- jsapi_property_##name##_get(cx, obj, jsval id, vp)
+ jsapi_property_##name##_get(cx, obj, jsval jsapi_id, vp)
#define JSAPI_PROP_SETTER(name, cx, obj, vp) \
- jsapi_property_##name##_set(cx, obj, jsval id, vp)
+ jsapi_property_##name##_set(cx, obj, jsval jsapi_id, vp)
/* native property return value */
#define JSAPI_PROP_RVAL JS_RVAL
@@ -195,6 +201,9 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
/* native property return value setter */
#define JSAPI_PROP_SET_RVAL JS_SET_RVAL
+/* native property ID value as a jsval */
+#define JSAPI_PROP_IDVAL(cx, vp) (*(vp) = jsapi_id)
+
/* property specifier */
#define JSAPI_PS(name, fnname, tinyid, flags) \
{ name , tinyid , flags , jsapi_property_##fnname##_get , jsapi_property_##fnname##_set }
@@ -204,6 +213,9 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#define JSAPI_PS_END { NULL, 0, 0, NULL, NULL }
+
+
+
static inline JSObject *
JS_NewCompartmentAndGlobalObject(JSContext *cx,
JSClass *jsclass,
@@ -288,9 +300,9 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
/* proprty native calls */
#define JSAPI_PROP_GETTER(name, cx, obj, vp) \
- jsapi_property_##name##_get(cx, obj, jsid id, vp)
+ jsapi_property_##name##_get(cx, obj, jsid jsapi_id, vp)
#define JSAPI_PROP_SETTER(name, cx, obj, vp) \
- jsapi_property_##name##_set(cx, obj, jsid id, JSBool strict, vp)
+ jsapi_property_##name##_set(cx, obj, jsid jsapi_id, JSBool strict, vp)
/* native property return value */
#define JSAPI_PROP_RVAL JS_RVAL
@@ -298,6 +310,9 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
/* native property getter return value */
#define JSAPI_PROP_SET_RVAL JS_SET_RVAL
+/* native property ID value as a jsval */
+#define JSAPI_PROP_IDVAL(cx, vp) JS_IdToValue(cx, jsapi_id, vp)
+
/* property specifier */
#define JSAPI_PS(name, fnname, tinyid, flags) { \
name, \
diff --git a/javascript/jsapi/location.bnd b/javascript/jsapi/location.bnd
index a381db111..32e38da93 100644
--- a/javascript/jsapi/location.bnd
+++ b/javascript/jsapi/location.bnd
@@ -34,6 +34,7 @@ binding location {
private "struct browser_window *" bw;
private "nsurl *" url;
+
}
operation reload %{
diff --git a/javascript/jsapi/window.bnd b/javascript/jsapi/window.bnd
index dbc38a796..e439980b9 100644
--- a/javascript/jsapi/window.bnd
+++ b/javascript/jsapi/window.bnd
@@ -30,6 +30,8 @@ binding window {
internal "JSObject *" navigator;
internal "JSObject *" console;
internal "JSObject *" location;
+
+ property unshared type EventHandler;
}
api mark %{
@@ -197,3 +199,11 @@ getter window %{
getter self %{
jsret = obj;
%}
+
+getter EventHandler %{
+ JSLOG("propname:%s %s", propname, JS_GetTypeName(cx, JS_TypeOfValue(cx, propname_jsval)));
+%}
+
+setter EventHandler %{
+ JSLOG("propname:%s %s", propname, JS_GetTypeName(cx, JS_TypeOfValue(cx, propname_jsval)));
+%}