~ubuntu-branches/ubuntu/utopic/gxine/utopic-proposed

« back to all changes in this revision

Viewing changes to debian/patches/debian-changes

  • Committer: Package Import Robot
  • Author(s): Steve Langasek
  • Date: 2014-05-07 21:34:55 UTC
  • mfrom: (2.1.17 sid)
  • Revision ID: package-import@ubuntu.com-20140507213455-qnu5diwyyj8bkaap
Tags: 0.5.907-3ubuntu1
* Merge from Debian unstable, remaining changes:
  - debian/rules, debian/control: use dh-autoreconf at build time.
  - debian/control: Add Xb-Npp-xxx, Xb-Npp-Description and Xb-Npp-File
    fields.
  - src/script_engine.c: fix a remaining memory leak issue associated with
    using JS_EncodeString(), which somehow didn't get fixed upstream
  - debian/gxineplugin.links: Add a link to xulrunner-addons/plugins
    directory.
  - mime.default: Add dvd, vcd, svcd tags.
* Dropped changes, no longer needed:
  - debian/gxine.install: no need to diverge from Debian since we no longer
    ship a wrapper
* All other changes dropped, as they have been included upstream or in
  Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Origin: upstream, other, *
2
2
Description: Applied patches. See Vcs-* headers in debian/control.
3
3
 
4
 
--- gxine-0.5.905.orig/mime.default
5
 
+++ gxine-0.5.905/mime.default
 
4
Index: trunk/mime.default
 
5
===================================================================
 
6
Index: trunk/src/script_engine.c
 
7
===================================================================
 
8
Index: trunk/src/engine.c
 
9
===================================================================
 
10
Index: trunk/src/key_events.c
 
11
===================================================================
 
12
Index: trunk/src/Makefile.am
 
13
===================================================================
 
14
Index: trunk/src/console_output.h
 
15
===================================================================
 
16
Index: trunk/src/main.c
 
17
===================================================================
 
18
Index: trunk/src/Makefile.in
 
19
===================================================================
 
20
--- gxine-0.5.907.orig/mime.default
 
21
+++ gxine-0.5.907/mime.default
6
22
@@ -75,3 +75,6 @@ video/x-ms-wvx
7
23
 video/x-msvideo
8
24
 video/x-ogg
10
26
+x-content/video-dvd
11
27
+x-content/video-svcd
12
28
+x-content/video-vcd
13
 
--- gxine-0.5.905.orig/m4/_js.m4
14
 
+++ gxine-0.5.905/m4/_js.m4
15
 
@@ -41,6 +41,8 @@ AC_DEFUN([GXINE_PATH_SPIDERMONKEY],
16
 
                [AS_HELP_STRING([--with-spidermonkey],[prefix where libjs/libsmjs is installed (optional)])],
17
 
                [JS_CFLAGS="-I$withval"], [])
18
 
 
19
 
+    AC_ARG_ENABLE([mozjs185],
20
 
+        [AS_HELP_STRING([--disable-mozjs185],[don't look for system libmozjs185])])
21
 
     AC_ARG_ENABLE([mozjs],
22
 
        [AS_HELP_STRING([--disable-mozjs],[don't look for Mozilla libmozjs])])
23
 
     AC_ARG_ENABLE([ffjs],
24
 
@@ -51,11 +53,20 @@ AC_DEFUN([GXINE_PATH_SPIDERMONKEY],
25
 
     if test x"$JS_CFLAGS" = x; then
26
 
       AC_MSG_NOTICE([looking for the Spidermonkey Javascript library in various places.])
27
 
 
28
 
-      # Try libmozjs (xulrunner)
29
 
+      JSLIB=mozjs185
30
 
+      AC_MSG_NOTICE([trying mozjs via pkgconfig mozjs185])
31
 
+      PKG_CHECK_MODULES([JS],[mozjs185],[],[:])
32
 
 
33
 
-      HAVE_JS=xulrunner
34
 
-      AC_MSG_NOTICE([trying mozjs via pkgconfig xulrunner-js])
35
 
-      PKG_CHECK_MODULES([JS],[xulrunner-js],[],[:])
36
 
+      if test x"$JS_CFLAGS" = x; then
37
 
+        JSLIB=mozjs
38
 
+      fi
39
 
+
40
 
+      # Try libmozjs (xulrunner)
41
 
+      if test x"$JS_CFLAGS" = x; then
42
 
+        HAVE_JS=xulrunner
43
 
+        AC_MSG_NOTICE([trying mozjs via pkgconfig xulrunner-js])
44
 
+        PKG_CHECK_MODULES([JS],[xulrunner-js],[],[:])
45
 
+      fi
46
 
 
47
 
       # Try Mozilla
48
 
 
49
 
@@ -118,6 +129,7 @@ AC_DEFUN([GXINE_PATH_SPIDERMONKEY],
50
 
                          echo moz
51
 
                          ;;
52
 
                   esac`"
53
 
+         JSLIB="${JS_LIBS}js"
54
 
         JS_LIBS="`spidermonkey_locate_lib([$JS_LIBS])`js"
55
 
         AC_DEFINE(HAVE_LIBSMJS, 1, [Define if you have jsapi.h])
56
 
        ],
57
 
@@ -125,6 +137,43 @@ AC_DEFUN([GXINE_PATH_SPIDERMONKEY],
58
 
        [#define XP_UNIX])
59
 
       CFLAGS="$saved_CFLAGS"
60
 
     fi
61
 
+
62
 
+    SAVED_LIBS="$LIBS"
63
 
+    LIBS="$JS_LIBS $LIBS"
64
 
+    SAVED_CFLAGS="$CFLAGS"
65
 
+    CFLAGS="$JS_CFLAGS $CFLAGS"
66
 
+    AC_CHECK_LIB([$JSLIB], [JS_NewCompartmentAndGlobalObject],
67
 
+      AC_DEFINE([HAVE_COMPARTMENTS], [1], [Define whether we have compartments]))
68
 
+
69
 
+    AC_CHECK_LIB([$JSLIB], [JS_GetStringBytes],
70
 
+      AC_DEFINE([HAVE_JS_GET_STRING_BYTES], [1], [Define whether we have JS_GetStringBytes]))
71
 
+
72
 
+    AC_CHECK_LIB([$JSLIB], [JS_NewDouble],
73
 
+      AC_DEFINE([HAVE_JS_NEW_DOUBLE], [1], [Define whether we have JS_NewDouble]))
74
 
+
75
 
+    AC_CHECK_LIB([$JSLIB], [JS_StrictPropertyStub],
76
 
+      AC_DEFINE([HAVE_JS_STRICT_PROPERTY_OP], [1], [Define whether we have the JSStrictPropertyOp prototype]))
77
 
+
78
 
+    AC_COMPILE_IFELSE(
79
 
+      [AC_LANG_PROGRAM(
80
 
+        [[#include <jsapi.h>]],
81
 
+        [[jsval v; jsdouble *d = JSVAL_TO_DOUBLE(v);]]
82
 
+      )],
83
 
+      AC_DEFINE([JSVAL_TO_DOUBLE_RETURNS_POINTER], [1], [Define whether the JSVAL_TO_DOUBLE function or macro returns a pointer to jsdouble])
84
 
+    )
85
 
+
86
 
+    CFLAGS="$JS_CFLAGS -Werror -Wno-attributes"
87
 
+    AC_COMPILE_IFELSE(
88
 
+      [AC_LANG_PROGRAM(
89
 
+        [[#include <jsapi.h>
90
 
+          static JSBool op(JSContext* cx, JSObject* obj, jsid id, jsval* vp) {}]],
91
 
+        [[JSPropertyOp func = op;]]
92
 
+      )],
93
 
+      AC_DEFINE([JS_PROPERTY_OP_HAS_ID_AS_JSID], [1], [Define whether the type of id in the prototype for JSPropertyOp is a jsid])
94
 
+    )
95
 
+    LIBS="$SAVED_LIBS"
96
 
+    CFLAGS="$SAVED_CFLAGS"
97
 
+
98
 
     AC_SUBST(JS_CFLAGS)
99
 
     AC_SUBST(JS_LIBS)
100
 
    ])
101
 
--- gxine-0.5.905.orig/src/script_engine.c
102
 
+++ gxine-0.5.905/src/script_engine.c
103
 
@@ -34,7 +34,6 @@
104
 
 #include <stdarg.h>
105
 
 
106
 
 #include <gdk/gdkkeysyms.h>
107
 
-#include <jsstr.h>
108
 
 
109
 
 #include "script_engine.h"
110
 
 #include "ui.h"
111
 
@@ -53,6 +52,7 @@
112
 
 #include "snapshot.h"
113
 
 #include "engine.h"
114
 
 #include "history.h"
115
 
+
116
 
 /*
117
 
 #define LOG
118
 
 */
119
 
@@ -194,7 +194,10 @@ gchar *se_result_str (se_t *se)
120
 
     return NULL;
121
 
 
122
 
   se->str = JS_ValueToString (se->cx, se->rval);
123
 
-  return JS_GetStringBytes (se->str);
124
 
+  char *encoded = SE_JS_ENCODE_STRING(se->cx, se->str);
125
 
+  char *res = strdup(encoded);
126
 
+  SE_JS_FREE_ENCODED_STRING(se->cx, encoded);
127
 
+  return res;
128
 
 }
129
 
 
130
 
 int se_result_int (se_t *se, JSInt32 *num)
131
 
@@ -253,8 +256,7 @@ se_js_string_val (JSContext *cx, const c
132
 
  * methods
133
 
  */
134
 
 
135
 
-static JSBool controls_exit (JSContext *cx, JSObject *obj, uintN argc,
136
 
-                            jsval *argv, jsval *rval)
137
 
+static JSBool controls_exit (JSContext *cx, uintN argc, jsval *vp)
138
 
 {
139
 
   gchar *fname;
140
 
 
141
 
@@ -299,8 +301,7 @@ static JSBool controls_exit (JSContext *
142
 
   exit (0);
143
 
 }
144
 
 
145
 
-static JSBool show_js_console (JSContext *cx, JSObject *obj, uintN argc,
146
 
-                              jsval *argv, jsval *rval)
147
 
+static JSBool show_js_console (JSContext *cx, uintN argc, jsval *vp)
148
 
 {
149
 
   se_log_fncall_checkinit ("show_js_console");
150
 
   if (GTK_WIDGET_VISIBLE (se_window))
151
 
@@ -311,85 +312,93 @@ static JSBool show_js_console (JSContext
152
 
     se_prop_set_int (gse, js_icon_obj, "v", 0);
153
 
   }
154
 
 
155
 
-  *rval = JSVAL_VOID;
156
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
157
 
   return JS_TRUE;
158
 
 }
159
 
 
160
 
 static JSBool
161
 
-js_callback (JSContext *cx, JSObject *obj,
162
 
-            uintN argc, jsval *argv, jsval *rval)
163
 
+js_callback (JSContext *cx, uintN argc, jsval *vp)
164
 
 {
165
 
+  jsval *argv = JS_ARGV (cx, vp);
166
 
   se_t *se = (se_t *) JS_GetContextPrivate (cx);
167
 
   se_log_fncall ("callback");
168
 
   se_argc_check_range (1, 2, "callback");
169
 
   se_arg_is_string (0, "callback");
170
 
   if (argc > 1)
171
 
     se_arg_is_object (1, "callback");
172
 
-  engine_queue_push (JS_GetStringBytes (JS_ValueToString (cx, argv[0])),
173
 
-                    JS_GetPrivate (cx, argc > 1 ? JSVAL_TO_OBJECT (argv[1])
174
 
-                                                : se->global),
175
 
-                    NULL, NULL, NULL, _("JS callback"));
176
 
-  *rval = JSVAL_VOID;
177
 
+  char *str = SE_JS_ENCODE_STRING (cx, JS_ValueToString (cx, argv[0]));
178
 
+  engine_queue_push (str,
179
 
+                    JS_GetPrivate (cx, argc > 1 ? JSVAL_TO_OBJECT (argv[1])
180
 
+                                                : se->global),
181
 
+                    NULL, NULL, NULL, _("JS callback"));
182
 
+  SE_JS_FREE_ENCODED_STRING (cx, str);
183
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
184
 
   return JS_TRUE;
185
 
 }
186
 
 
187
 
 static JSBool
188
 
-js_xine_cfg_get (JSContext *cx, JSObject *obj,
189
 
-                uintN argc, jsval *argv, jsval *rval)
190
 
+js_xine_cfg_get (JSContext *cx, uintN argc, jsval *vp)
191
 
 {
192
 
+  jsval *argv = JS_ARGV (cx, vp);
193
 
   se_log_fncall ("xine_cfg_get");
194
 
   se_argc_check (1, "xine_cfg_get");
195
 
   se_arg_is_string (0, "xine_cfg_get");
196
 
 
197
 
   xine_cfg_entry_t entry;
198
 
-  char *cfg = JS_GetStringBytes (JS_ValueToString (cx, argv[0]));
199
 
+  char *cfg = SE_JS_ENCODE_STRING (cx, JS_ValueToString (cx, argv[0]));
200
 
   if (!xine_config_lookup_entry (xine, cfg, &entry))
201
 
   {
202
 
-    *rval = JSVAL_NULL;
203
 
+    JS_SET_RVAL (cx, vp, JSVAL_NULL);
204
 
+    SE_JS_FREE_ENCODED_STRING (cx, cfg);
205
 
     return JS_TRUE;
206
 
   }
207
 
 
208
 
+  SE_JS_FREE_ENCODED_STRING(cx, cfg);
209
 
+
210
 
   switch (entry.type)
211
 
   {
212
 
   case XINE_CONFIG_TYPE_RANGE:
213
 
   case XINE_CONFIG_TYPE_NUM:
214
 
-    *rval = INT_TO_JSVAL (entry.num_value);
215
 
+    JS_SET_RVAL (cx, vp, INT_TO_JSVAL (entry.num_value));
216
 
     return JS_TRUE;
217
 
 
218
 
   case XINE_CONFIG_TYPE_BOOL:
219
 
-    *rval = BOOLEAN_TO_JSVAL (entry.num_value);
220
 
+    JS_SET_RVAL (cx, vp, BOOLEAN_TO_JSVAL (entry.num_value));
221
 
     return JS_TRUE;
222
 
 
223
 
   case XINE_CONFIG_TYPE_STRING:
224
 
-    *rval = se_js_string_val (cx, entry.str_value ? : entry.str_default);
225
 
+    JS_SET_RVAL (cx, vp, se_js_string_val (cx, entry.str_value ? : entry.str_default));
226
 
     return JS_TRUE;
227
 
 
228
 
   case XINE_CONFIG_TYPE_ENUM:
229
 
-    *rval = se_js_string_val (cx, entry.enum_values[entry.num_value]);
230
 
+    JS_SET_RVAL (cx, vp, se_js_string_val (cx, entry.enum_values[entry.num_value]));
231
 
     return JS_TRUE;
232
 
 
233
 
   default:
234
 
-    *rval = JSVAL_NULL;
235
 
+    JS_SET_RVAL (cx, vp, JSVAL_NULL);
236
 
     return JS_TRUE;
237
 
   }
238
 
 }
239
 
 
240
 
 static JSBool
241
 
-js_xine_cfg_set (JSContext *cx, JSObject *obj,
242
 
-                uintN argc, jsval *argv, jsval *rval)
243
 
+js_xine_cfg_set (JSContext *cx, uintN argc, jsval *vp)
244
 
 {
245
 
+  jsval *argv = JS_ARGV (cx, vp);
246
 
   se_log_fncall ("xine_cfg_set");
247
 
   se_argc_check (2, "xine_cfg_set");
248
 
   se_arg_is_string (0, "xine_cfg_set");
249
 
 
250
 
   xine_cfg_entry_t entry;
251
 
-  char *cfg = JS_GetStringBytes (JS_ValueToString (cx, argv[0]));
252
 
+  char *cfg = SE_JS_ENCODE_STRING (cx, JS_ValueToString(cx, argv[0]));
253
 
   if (!xine_config_lookup_entry (xine, cfg, &entry))
254
 
   {
255
 
-    *rval = JSVAL_VOID;
256
 
+    JS_SET_RVAL (cx, vp, JSVAL_VOID);
257
 
+    SE_JS_FREE_ENCODED_STRING (cx, cfg);
258
 
     return JS_TRUE;
259
 
   }
260
 
 
261
 
+  SE_JS_FREE_ENCODED_STRING (cx, cfg);
262
 
+
263
 
   int32 num;
264
 
   switch (entry.type)
265
 
   {
266
 
@@ -413,28 +422,34 @@ js_xine_cfg_set (JSContext *cx, JSObject
267
 
 
268
 
   case XINE_CONFIG_TYPE_STRING:
269
 
     se_arg_is_string (1, "xine_cfg_set");
270
 
-    entry.str_value = JS_GetStringBytes (JS_ValueToString (cx, argv[1]));
271
 
+    entry.str_value = SE_JS_ENCODE_STRING (cx, JS_ValueToString (cx, argv[1]));
272
 
     break;
273
 
 
274
 
   case XINE_CONFIG_TYPE_ENUM:
275
 
     se_arg_is_string (1, "xine_cfg_set");
276
 
-    char *v = JS_GetStringBytes (JS_ValueToString (cx, argv[1]));
277
 
+    char *v = SE_JS_ENCODE_STRING (cx, JS_ValueToString (cx, argv[1]));
278
 
     int i;
279
 
     for (i = 0; entry.enum_values[i]; ++i)
280
 
-      if (!strcmp (v, entry.enum_values[i]))
281
 
+      if (!strcmp (v, entry.enum_values[i])) {
282
 
+        SE_JS_FREE_ENCODED_STRING (cx, v);
283
 
        break;
284
 
+      }
285
 
     if (entry.enum_values[i])
286
 
       entry.num_value = i;
287
 
+    SE_JS_FREE_ENCODED_STRING (cx, v);
288
 
     break;
289
 
 
290
 
   default:
291
 
-    *rval = JSVAL_VOID;
292
 
+    JS_SET_RVAL (cx, vp, JSVAL_VOID);
293
 
     return JS_TRUE;
294
 
   }
295
 
 
296
 
   preferences_update_entry (&entry);
297
 
 
298
 
-  *rval = JSVAL_VOID;
299
 
+  if (entry.type == XINE_CONFIG_TYPE_STRING)
300
 
+    SE_JS_FREE_ENCODED_STRING (cx, entry.str_value);
301
 
+
302
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
303
 
   return JS_TRUE;
304
 
 }
305
 
 
306
 
@@ -476,8 +491,7 @@ static char *show_help_int (se_t *se, se
307
 
   return help;
308
 
 }
309
 
 
310
 
-static JSBool show_help (JSContext *cx, JSObject *obj, uintN argc,
311
 
-                         jsval *argv, jsval *rval)
312
 
+static JSBool show_help (JSContext *cx, uintN argc, jsval *vp)
313
 
 {
314
 
   static char *const group_id[] = {
315
 
     NULL,
316
 
@@ -530,7 +544,7 @@ static JSBool show_help (JSContext *cx,
317
 
    * int get_time ();
318
 
    * int get_length ();
319
 
    */
320
 
-  *rval = JSVAL_VOID;
321
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
322
 
   return JS_TRUE;
323
 
 }
324
 
 
325
 
@@ -652,8 +666,9 @@ static jsval get_prop_jsval (se_t *se, s
326
 
 
327
 
   case SE_TYPE_DOUBLE:
328
 
     {
329
 
-      jsdouble *d = JS_NewDouble (se->cx, get_prop_double (se, o, p));
330
 
-      return DOUBLE_TO_JSVAL (d);
331
 
+      jsval rval;
332
 
+      SE_JS_NEW_NUMBER_VAL (se->cx, get_prop_double (se, o, p), rval);
333
 
+      return rval;
334
 
     }
335
 
 
336
 
   case SE_TYPE_BOOL:
337
 
@@ -692,7 +707,7 @@ static void set_prop_jsval (se_t *se, se
338
 
 
339
 
   case SE_TYPE_DOUBLE:
340
 
     if (JSVAL_IS_NUMBER(*v))
341
 
-      se_prop_set_double (se, o, p->id, *JSVAL_TO_DOUBLE(*v));
342
 
+      se_prop_set_double (se, o, p->id, SE_JSVAL_TO_DOUBLE(*v));
343
 
     else
344
 
       se->print_cb (se->print_cb_data, _("\n%s.%s: value must be numeric\n"),
345
 
                    o->id, p->id);
346
 
@@ -709,8 +724,9 @@ static void set_prop_jsval (se_t *se, se
347
 
   case SE_TYPE_STRING:
348
 
     {
349
 
       JSString *str = JSVAL_TO_STRING(*v);
350
 
-      char     *string = JS_GetStringBytes (str);
351
 
+      char     *string = SE_JS_ENCODE_STRING (se->cx, str);
352
 
       se_prop_set (se, o, p->id, string);
353
 
+      SE_JS_FREE_ENCODED_STRING (se->cx, str);
354
 
     }
355
 
     return;
356
 
 
357
 
@@ -725,17 +741,17 @@ static void set_prop_jsval (se_t *se, se
358
 
  * function to create and maintain js objects
359
 
  */
360
 
 
361
 
-static JSBool
362
 
-generic_JSGetProperty (JSContext *cx, JSObject *obj, jsval id, jsval *vp)
363
 
+SE_JS_PROPERTY_GETTER_DECLARE (generic_JSGetProperty)
364
 
 {
365
 
+  SE_JS_PROPERTY_GETTER_INIT_VARIABLES (id_val);
366
 
   se_t   *se = (se_t *) JS_GetContextPrivate(cx);
367
 
   se_log_fncall ("generic get property");
368
 
   se_o_t *o = JS_GetPrivate (cx, obj);
369
 
 
370
 
-  if (JSVAL_IS_STRING (id))
371
 
+  if (JSVAL_IS_STRING (id_val))
372
 
   {
373
 
-    JSString *str = JS_ValueToString (cx, id);
374
 
-    char     *prop = str ? JS_GetStringBytes (str) : "";
375
 
+    JSString *str = JS_ValueToString (cx, id_val);
376
 
+    char     *prop = str ? SE_JS_ENCODE_STRING (cx, str) : "";
377
 
     GList    *n;
378
 
 
379
 
     logprintf ("script_engine: looking for generic property '%s' in '%s'\n",
380
 
@@ -749,6 +765,9 @@ generic_JSGetProperty (JSContext *cx, JS
381
 
       if (!strcasecmp (p->id, prop))
382
 
       {
383
 
        *vp = get_prop_jsval (se, o, p);
384
 
+        if (str)
385
 
+          SE_JS_FREE_ENCODED_STRING (cx, prop);
386
 
+
387
 
        return JS_TRUE;
388
 
       }
389
 
     }
390
 
@@ -760,18 +779,25 @@ generic_JSGetProperty (JSContext *cx, JS
391
 
       se_o_t *p = (se_o_t *) n->data;
392
 
       if (!strcasecmp (p->id, prop))
393
 
       {
394
 
-       static jsval prop = 0;
395
 
-       if (!prop)
396
 
-         prop = se_js_string_val (cx, ".");
397
 
-       if (!generic_JSGetProperty (cx, p->obj, prop, vp))
398
 
+       jsval prop_val = se_js_string_val (cx, ".");
399
 
+        if (!SE_JS_CALL_PROPERTY_GETTER_WITH_JSVAL (generic_JSGetProperty, cx, p->obj, prop_val, vp))
400
 
          *vp = OBJECT_TO_JSVAL (p->obj);
401
 
+        if (str)
402
 
+          SE_JS_FREE_ENCODED_STRING (cx, prop);
403
 
+
404
 
        return JS_TRUE;
405
 
       }
406
 
     }
407
 
 
408
 
-    if (*prop && o->parent)
409
 
-      return generic_JSGetProperty (cx, o->parent->obj, id, vp);
410
 
+    if (*prop && o->parent) {
411
 
+      JSBool ret = generic_JSGetProperty (cx, o->parent->obj, id, vp);
412
 
+      if (str)
413
 
+        SE_JS_FREE_ENCODED_STRING (cx, prop);
414
 
+      return ret;
415
 
+    }
416
 
 
417
 
+    if (str)
418
 
+      SE_JS_FREE_ENCODED_STRING (cx, prop);
419
 
     return JS_TRUE;
420
 
   }
421
 
 
422
 
@@ -780,9 +806,9 @@ generic_JSGetProperty (JSContext *cx, JS
423
 
   return JS_FALSE;
424
 
 }
425
 
 
426
 
-static JSBool
427
 
-generic_JSSetProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
428
 
+SE_JS_PROPERTY_SETTER_DECLARE(generic_JSSetProperty)
429
 
 {
430
 
+  SE_JS_PROPERTY_SETTER_INIT_VARIABLES (id_val);
431
 
   se_t   *se = (se_t *) JS_GetContextPrivate(cx);
432
 
   se_o_t *o;
433
 
 
434
 
@@ -790,10 +816,10 @@ generic_JSSetProperty(JSContext *cx, JSO
435
 
 
436
 
   o = JS_GetPrivate (cx, obj);
437
 
 
438
 
-  if (JSVAL_IS_STRING (id))
439
 
+  if (JSVAL_IS_STRING (id_val))
440
 
   {
441
 
-    JSString *str = JS_ValueToString (cx, id);
442
 
-    char     *prop = JS_GetStringBytes (str);
443
 
+    JSString *str = JS_ValueToString (cx, id_val);
444
 
+    char     *prop = SE_JS_ENCODE_STRING (cx, str);
445
 
     GList    *n;
446
 
 
447
 
     logprintf ("script_engine: looking for generic property '%s' in '%s'\n",
448
 
@@ -808,6 +834,7 @@ generic_JSSetProperty(JSContext *cx, JSO
449
 
       {
450
 
        if (!p->constant)
451
 
          set_prop_jsval (se, o, p, vp);
452
 
+        SE_JS_FREE_ENCODED_STRING (cx, prop);
453
 
        return JS_TRUE;
454
 
       }
455
 
     }
456
 
@@ -819,15 +846,21 @@ generic_JSSetProperty(JSContext *cx, JSO
457
 
       se_o_t *p = (se_o_t *) n->data;
458
 
       if (!strcasecmp (p->id, prop))
459
 
       {
460
 
-       if (!generic_JSSetProperty (cx, p->obj, STRING_TO_JSVAL("."), vp))
461
 
+        jsval prop_val = STRING_TO_JSVAL(".");
462
 
+        if (!SE_JS_CALL_PROPERTY_SETTER_WITH_JSVAL (generic_JSSetProperty, cx, p->obj, prop_val, vp))
463
 
          *vp = OBJECT_TO_JSVAL (p->obj);
464
 
+        SE_JS_FREE_ENCODED_STRING (cx, prop);
465
 
        return JS_TRUE;
466
 
       }
467
 
     }
468
 
 
469
 
-    if (*prop && o->parent)
470
 
-      return generic_JSSetProperty (cx, o->parent->obj, id, vp);
471
 
+    if (*prop && o->parent) {
472
 
+      JSBool ret = SE_JS_CALL_PROPERTY_SETTER_WITH_JSVAL (generic_JSSetProperty, cx, o->parent->obj, id_val, vp);
473
 
+      SE_JS_FREE_ENCODED_STRING (cx, prop);
474
 
+      return ret;
475
 
+    }
476
 
 
477
 
+    SE_JS_FREE_ENCODED_STRING (cx, prop);
478
 
     return JS_TRUE;
479
 
   }
480
 
 
481
 
@@ -841,14 +874,35 @@ static void generic_JSDestructor (JSCont
482
 
   se_log_fncall ("generic destructor");
483
 
 }
484
 
 
485
 
+#ifdef JSFUN_CONSTRUCTOR
486
 
+static JSBool generic_Constructor (JSContext* cx, uintN argc, jsval* vp)
487
 
+{
488
 
+  JSObject* obj = JS_NewObjectForConstructor (cx, vp);
489
 
+  if (!obj) {
490
 
+    JS_ReportError (cx, "Failed to create 'this' object");
491
 
+    return JS_FALSE;
492
 
+  }
493
 
+
494
 
+  JS_SET_RVAL (cx, vp, OBJECT_TO_JSVAL (obj));
495
 
+  return JS_TRUE;
496
 
+}
497
 
+#endif
498
 
+
499
 
 static JSClass generic_JSClass =
500
 
   {
501
 
     "view", JSCLASS_HAS_PRIVATE,
502
 
     JS_PropertyStub, JS_PropertyStub,
503
 
     generic_JSGetProperty, generic_JSSetProperty,
504
 
     JS_EnumerateStub, JS_ResolveStub,
505
 
+#ifndef JSFUN_CONSTRUCTOR
506
 
     JS_ConvertStub, generic_JSDestructor
507
 
   };
508
 
+#else
509
 
+    JS_ConvertStub, generic_JSDestructor,
510
 
+    NULL, NULL, NULL, generic_Constructor,
511
 
+    NULL, NULL, NULL, NULL
512
 
+  };
513
 
+#endif
514
 
 
515
 
 se_o_t *se_create_object (se_t *se, se_o_t *parent /* may be NULL */,
516
 
                          const gchar *name, void *user_data,
517
 
@@ -1542,7 +1596,7 @@ se_t *se_new (void)
518
 
 {
519
 
   se_t    *se;
520
 
   static JSClass global_class = {
521
 
-    "global", JSCLASS_HAS_PRIVATE,
522
 
+    "global", JSCLASS_HAS_PRIVATE | JSCLASS_GLOBAL_FLAGS,
523
 
     JS_PropertyStub,JS_PropertyStub,JS_PropertyStub,JS_PropertyStub,
524
 
     JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
525
 
   };
526
 
@@ -1564,7 +1618,13 @@ se_t *se_new (void)
527
 
   se = malloc (sizeof (se_t));
528
 
 
529
 
   se->cx       = JS_NewContext (rt, 0x1000);
530
 
+#ifdef HAVE_COMPARTMENTS
531
 
+  se->global   = JS_NewCompartmentAndGlobalObject (se->cx, &global_class, NULL);
532
 
+  /* Select the compartment our global object is in */
533
 
+  JS_EnterCrossCompartmentCall (se->cx, se->global);
534
 
+#else
535
 
   se->global   = JS_NewObject (se->cx, &global_class, NULL, NULL);
536
 
+#endif
537
 
 
538
 
   pthread_mutexattr_t attr;
539
 
   pthread_mutexattr_init (&attr);
540
 
@@ -1596,12 +1656,12 @@ se_t *se_new (void)
541
 
 
542
 
   {
543
 
     static const se_f_def_t defs[] = {
544
 
-      { "exit", controls_exit, 0, 0, SE_GROUP_ENGINE, NULL, NULL },
545
 
-      { "js_console_show", show_js_console, 0, 0, SE_GROUP_DIALOGUE, NULL, NULL },
546
 
-      { "help", show_help, 0, 0, SE_GROUP_HIDDEN, NULL, NULL },
547
 
-      { "callback", js_callback, 0, 0, SE_GROUP_ENGINE, N_("Javascript"), NULL },
548
 
-      { "xine_cfg_get", js_xine_cfg_get, 0, 0, SE_GROUP_PROPERTIES, NULL, NULL },
549
 
-      { "xine_cfg_set", js_xine_cfg_set, 0, 0, SE_GROUP_PROPERTIES, NULL, NULL },
550
 
+      { "exit", controls_exit, 0, JSFUN_FAST_NATIVE, SE_GROUP_ENGINE, NULL, NULL },
551
 
+      { "js_console_show", show_js_console, 0, JSFUN_FAST_NATIVE, SE_GROUP_DIALOGUE, NULL, NULL },
552
 
+      { "help", show_help, 0, JSFUN_FAST_NATIVE, SE_GROUP_HIDDEN, NULL, NULL },
553
 
+      { "callback", js_callback, 0, JSFUN_FAST_NATIVE, SE_GROUP_ENGINE, N_("Javascript"), NULL },
554
 
+      { "xine_cfg_get", js_xine_cfg_get, 0, JSFUN_FAST_NATIVE, SE_GROUP_PROPERTIES, NULL, NULL },
555
 
+      { "xine_cfg_set", js_xine_cfg_set, 0, JSFUN_FAST_NATIVE, SE_GROUP_PROPERTIES, NULL, NULL },
556
 
       { NULL }
557
 
     };
558
 
     se_defuns (se, se->g, defs);
559
 
--- gxine-0.5.905.orig/src/ui.c
560
 
+++ gxine-0.5.905/src/ui.c
561
 
@@ -490,14 +490,14 @@ static void set_fs_toolbar_top (int v)
562
 
 
563
 
 #ifdef WITH_DEPRECATED
564
 
 
565
 
-static JSBool js_fs_toolbar_show (JSContext *cx, JSObject *obj, uintN argc,
566
 
-                                 jsval *argv, jsval *rval)
567
 
+static JSBool js_fs_toolbar_show (JSContext *cx, uintN argc, jsval *vp)
568
 
 {
569
 
   JSBool show;
570
 
 
571
 
   se_log_fncall_deprecated ("toolbar_show");
572
 
   se_argc_check_max (1, "toolbar_show");
573
 
 
574
 
+  jsval *argv = JS_ARGV (cx, vp);
575
 
   if (argc == 1)
576
 
   {
577
 
     se_arg_is_int_or_bool (0, "toolbar_show");
578
 
@@ -508,19 +508,20 @@ static JSBool js_fs_toolbar_show (JSCont
579
 
 
580
 
   window_fs_toolbar_show (show);
581
 
 
582
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
583
 
   return JS_TRUE;
584
 
 }
585
 
 
586
 
 #ifdef WITH_OBSOLETE
587
 
 
588
 
-static JSBool js_fs_toolbar_position (JSContext *cx, JSObject *obj, uintN argc,
589
 
-                                     jsval *argv, jsval *rval)
590
 
+static JSBool js_fs_toolbar_position (JSContext *cx, uintN argc, jsval *vp)
591
 
 {
592
 
   JSBool top;
593
 
 
594
 
   se_log_fncall_obsolete ("set_toolbar_position");
595
 
   se_argc_check_max (1, "set_toolbar_position");
596
 
 
597
 
+  jsval *argv = JS_ARGV (cx, vp);
598
 
   if (argc == 1)
599
 
   {
600
 
     se_arg_is_int_or_bool (0, "set_toolbar_position");
601
 
@@ -532,6 +533,7 @@ static JSBool js_fs_toolbar_position (JS
602
 
   set_fs_toolbar_top
603
 
     (gtk_radio_action_get_current_value (action_items.fs_toolbar_pos->data));
604
 
 
605
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
606
 
   return JS_TRUE;
607
 
 }
608
 
 
609
 
@@ -549,23 +551,21 @@ static int ui_lookup_js_obj (const JSObj
610
 
   abort (); /* can't happen */
611
 
 }
612
 
 
613
 
-static JSBool js_control_revert (JSContext *cx, JSObject *obj, uintN argc,
614
 
-                                jsval *argv, jsval *rval)
615
 
+static JSBool js_control_revert (JSContext *cx, uintN argc, jsval *vp)
616
 
 {
617
 
   se_log_fncall ("<control>.revert");
618
 
   se_argc_check (0, "<control>.revert");
619
 
-  ui_revert_control_adjustment (ui_lookup_js_obj (obj));
620
 
-  *rval = JSVAL_VOID;
621
 
+  ui_revert_control_adjustment (ui_lookup_js_obj (JS_THIS_OBJECT (cx, vp)));
622
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
623
 
   return JS_TRUE;
624
 
 }
625
 
 
626
 
-static JSBool js_control_reset (JSContext *cx, JSObject *obj, uintN argc,
627
 
-                               jsval *argv, jsval *rval)
628
 
+static JSBool js_control_reset (JSContext *cx, uintN argc, jsval *vp)
629
 
 {
630
 
   se_log_fncall ("<control>.reset");
631
 
   se_argc_check (0, "<control>.reset");
632
 
-  ui_clear_control_adjustment (ui_lookup_js_obj (obj));
633
 
-  *rval = JSVAL_VOID;
634
 
+  ui_clear_control_adjustment (ui_lookup_js_obj (JS_THIS_OBJECT (cx, vp)));
635
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
636
 
   return JS_TRUE;
637
 
 }
638
 
 
639
 
@@ -654,13 +654,12 @@ static int ui_prop_set_bool (void *data,
640
 
   return ui_prop_set_internal (data, !!value.i);
641
 
 }
642
 
 
643
 
-static JSBool ui_prop_toggle_bool (JSContext *cx, JSObject *obj,
644
 
-                                  uintN argc, jsval *argv, jsval *rval)
645
 
+static JSBool ui_prop_toggle_bool (JSContext *cx, uintN argc, jsval *vp)
646
 
 {
647
 
   se_t *se = (se_t *) JS_GetContextPrivate(cx);
648
 
-  se_o_t *o = JS_GetPrivate (cx, obj);
649
 
+  se_o_t *o = JS_GetPrivate (cx, JS_THIS_OBJECT (cx, vp));
650
 
   JSBool v = !se_prop_get_bool (se, o, "v");
651
 
-  *rval = BOOLEAN_TO_JSVAL (v);
652
 
+  JS_SET_RVAL (cx, vp, BOOLEAN_TO_JSVAL (v));
653
 
   se_prop_set_bool (se, o, "v", v);
654
 
   return JS_TRUE;
655
 
 }
656
 
@@ -699,7 +698,7 @@ void ui_create_properties (const ui_prop
657
 
       se_prop_create_int (gse, obj, "max", prop[i].max, TRUE);
658
 
       break;
659
 
     case SE_TYPE_BOOL:
660
 
-      se_defun (gse, obj, "toggle", ui_prop_toggle_bool, 0, 0,
661
 
+      se_defun (gse, obj, "toggle", ui_prop_toggle_bool, 0, JSFUN_FAST_NATIVE,
662
 
                SE_GROUP_HIDDEN, NULL, NULL);
663
 
       break;
664
 
     default:; /* we don't handle string and float */
665
 
@@ -1044,10 +1043,10 @@ void ui_init (void)
666
 
 
667
 
 #ifdef WITH_DEPRECATED
668
 
   static const se_f_def_t defs[] = {
669
 
-    { "toolbar_show", js_fs_toolbar_show, 0, 0,
670
 
+    { "toolbar_show", js_fs_toolbar_show, 0, JSFUN_FAST_NATIVE,
671
 
       SE_GROUP_HIDDEN, N_("[bool]"), NULL },
672
 
 #ifdef WITH_OBSOLETE
673
 
-    { "set_toolbar_position", js_fs_toolbar_position, 0, 0,
674
 
+    { "set_toolbar_position", js_fs_toolbar_position, 0, JSFUN_FAST_NATIVE,
675
 
       SE_GROUP_HIDDEN, N_("bool"), N_("at top if true") },
676
 
 #endif
677
 
     { NULL }
678
 
@@ -1091,8 +1090,8 @@ void ui_init (void)
679
 
     if (ranges[i].setting)
680
 
     {
681
 
       static const se_f_def_t defs[] = {
682
 
-       { "revert", js_control_revert, 0, 0, SE_GROUP_HIDDEN, NULL, NULL },
683
 
-       { "reset", js_control_reset, 0, 0, SE_GROUP_HIDDEN, NULL, NULL },
684
 
+       { "revert", js_control_revert, 0, JSFUN_FAST_NATIVE, SE_GROUP_HIDDEN, NULL, NULL },
685
 
+       { "reset", js_control_reset, 0, JSFUN_FAST_NATIVE, SE_GROUP_HIDDEN, NULL, NULL },
686
 
        { NULL }
687
 
       };
688
 
       jsobjs[i] =
689
 
--- gxine-0.5.905.orig/src/player.c
690
 
+++ gxine-0.5.905/src/player.c
691
 
@@ -302,6 +302,7 @@ void player_stop (void)
692
 
   play_thread = 0;
693
 
   if (thread)
694
 
     pthread_cancel (thread);
695
 
+  gtk_video_in_spu_button (gtv, 0);
696
 
   xine_stop (stream);
697
 
 }
698
 
 
699
 
@@ -405,37 +406,36 @@ static void update_postproc_chain (const
700
 
 }
701
 
 
702
 
 static JSBool set_postproc_chain (const char *func, const char *pref,
703
 
-                                 JSContext *cx, JSObject *obj,
704
 
-                                 uintN argc, jsval *argv, jsval *rval)
705
 
+                                 JSContext *cx, uintN argc, jsval *vp)
706
 
 {
707
 
+  jsval *argv = JS_ARGV (cx, vp);
708
 
   se_log_fncall (func);
709
 
   se_argc_check (1, func);
710
 
   se_arg_is_string (0, func);
711
 
-  update_postproc_chain (pref,
712
 
-                        JS_GetStringBytes (JS_ValueToString (cx, argv[0])));
713
 
+  char *value = SE_JS_ENCODE_STRING (cx, JS_ValueToString (cx, argv[0]));
714
 
+  update_postproc_chain (pref, value);
715
 
+  SE_JS_FREE_ENCODED_STRING(cx, value);
716
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
717
 
   return JS_TRUE;
718
 
 }
719
 
 
720
 
 
721
 
-static JSBool set_vo_postproc_chain (JSContext *cx, JSObject *obj,
722
 
-                                    uintN argc, jsval *argv, jsval *rval)
723
 
+static JSBool set_vo_postproc_chain (JSContext *cx, uintN argc, jsval *vp)
724
 
 {
725
 
   return set_postproc_chain ("vo_postproc.set_chain", "gui.post_plugins.video",
726
 
-                            cx, obj, argc, argv, rval);
727
 
+                            cx, argc, vp);
728
 
 }
729
 
 
730
 
-static JSBool set_deint_postproc_chain (JSContext *cx, JSObject *obj,
731
 
-                                       uintN argc, jsval *argv, jsval *rval)
732
 
+static JSBool set_deint_postproc_chain (JSContext *cx, uintN argc, jsval *vp)
733
 
 {
734
 
   return set_postproc_chain ("vo_deinterlace.set_chain", "gui.post_plugins.deinterlace",
735
 
-                            cx, obj, argc, argv, rval);
736
 
+                            cx, argc, vp);
737
 
 }
738
 
 
739
 
-static JSBool set_ao_postproc_chain (JSContext *cx, JSObject *obj,
740
 
-                                    uintN argc, jsval *argv, jsval *rval)
741
 
+static JSBool set_ao_postproc_chain (JSContext *cx, uintN argc, jsval *vp)
742
 
 {
743
 
   return set_postproc_chain ("ao_postproc.set_chain", "gui.post_plugins.audio",
744
 
-                            cx, obj, argc, argv, rval);
745
 
+                            cx, argc, vp);
746
 
 }
747
 
 
748
 
 static int listen_postproc_chain (void *pref, se_t *se, se_o_t *obj,
749
 
@@ -445,89 +445,82 @@ static int listen_postproc_chain (void *
750
 
   return 0;
751
 
 }
752
 
 
753
 
-static JSBool get_time (JSContext *cx, JSObject *obj, uintN argc,
754
 
-                    jsval *argv, jsval *rval)
755
 
+static JSBool get_time (JSContext *cx, uintN argc, jsval *vp)
756
 
 {
757
 
   int   pos, pos_time, len;
758
 
   se_log_fncall ("get_time");
759
 
   xine_get_pos_length (stream, &pos, &pos_time, &len);
760
 
-  *rval = INT_TO_JSVAL (pos_time);
761
 
+  JS_SET_RVAL (cx, vp, INT_TO_JSVAL (pos_time));
762
 
   return JS_TRUE;
763
 
 }
764
 
 
765
 
-static JSBool get_pos (JSContext *cx, JSObject *obj, uintN argc,
766
 
-                      jsval *argv, jsval *rval)
767
 
+static JSBool get_pos (JSContext *cx, uintN argc, jsval *vp)
768
 
 {
769
 
   int pos, pos_time, len;
770
 
   se_log_fncall ("get_pos");
771
 
   xine_get_pos_length (stream, &pos, &pos_time, &len);
772
 
 
773
 
-  jsdouble *pos_percent = JS_NewDouble (cx, pos / 655.35);
774
 
-  *rval = DOUBLE_TO_JSVAL (pos_percent);
775
 
+  jsval rval = JS_RVAL (cx, vp);
776
 
+  SE_JS_NEW_NUMBER_VAL (cx, pos / 655.35, rval);
777
 
   return JS_TRUE;
778
 
 }
779
 
 
780
 
-static JSBool has_time (JSContext *cx, JSObject *obj, uintN argc,
781
 
-                       jsval *argv, jsval *rval)
782
 
+static JSBool has_time (JSContext *cx, uintN argc, jsval *vp)
783
 
 {
784
 
   int pos, pos_time, len;
785
 
   se_log_fncall ("has_time");
786
 
   xine_get_pos_length (stream, &pos, &pos_time, &len);
787
 
-  *rval = BOOLEAN_TO_JSVAL (len != 0);
788
 
+  JS_SET_RVAL (cx, vp, BOOLEAN_TO_JSVAL (len != 0));
789
 
   return JS_TRUE;
790
 
 }
791
 
 
792
 
 #ifdef WITH_OBSOLETE
793
 
 
794
 
-static JSBool js_get_speed (JSContext *cx, JSObject *obj, uintN argc,
795
 
-                           jsval *argv, jsval *rval)
796
 
+static JSBool js_get_speed (JSContext *cx, uintN argc, jsval *vp)
797
 
 {
798
 
   se_prop_read_t speed;
799
 
   se_log_fncall_obsolete ("get_speed");
800
 
   get_speed (NULL, &speed);
801
 
-  *rval = INT_TO_JSVAL (speed.i);
802
 
+  JS_SET_RVAL (cx, vp, INT_TO_JSVAL (speed.i));
803
 
   return JS_TRUE;
804
 
 }
805
 
 
806
 
-static JSBool js_get_volume (JSContext *cx, JSObject *obj, uintN argc,
807
 
-                           jsval *argv, jsval *rval)
808
 
+static JSBool js_get_volume (JSContext *cx, uintN argc, jsval *vp)
809
 
 {
810
 
   /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
811
 
   int   volume;
812
 
   se_log_fncall_obsolete ("get_volume");
813
 
   volume = xine_get_param (stream, XINE_PARAM_AUDIO_VOLUME);
814
 
-  *rval = INT_TO_JSVAL (volume);
815
 
+  JS_SET_RVAL (cx, vp, INT_TO_JSVAL (volume));
816
 
   return JS_TRUE;
817
 
 }
818
 
 
819
 
-static JSBool js_get_mute (JSContext *cx, JSObject *obj, uintN argc,
820
 
-                          jsval *argv, jsval *rval)
821
 
+static JSBool js_get_mute (JSContext *cx, uintN argc, jsval *vp)
822
 
 {
823
 
   /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
824
 
   int mute;
825
 
   se_log_fncall_obsolete ("get_mute");
826
 
   mute = xine_get_param (stream, XINE_PARAM_AUDIO_MUTE);
827
 
-  *rval = BOOLEAN_TO_JSVAL (mute);
828
 
+  JS_SET_RVAL (cx, vp, BOOLEAN_TO_JSVAL (mute));
829
 
   return JS_TRUE;
830
 
 }
831
 
 
832
 
-static JSBool js_get_zoom (JSContext *cx, JSObject *obj, uintN argc,
833
 
-                          jsval *argv, jsval *rval)
834
 
+static JSBool js_get_zoom (JSContext *cx, uintN argc, jsval *vp)
835
 
 {
836
 
   /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
837
 
   int   zoom;
838
 
   se_log_fncall_obsolete ("get_zoom");
839
 
   zoom = xine_get_param (stream, XINE_PARAM_VO_ZOOM_X);
840
 
-  *rval = INT_TO_JSVAL (zoom);
841
 
+  JS_SET_RVAL (cx, vp, INT_TO_JSVAL (zoom));
842
 
   return JS_TRUE;
843
 
 }
844
 
 
845
 
 #endif /* WITH_OBSOLETE */
846
 
 
847
 
-static JSBool controls_pause (JSContext *cx, JSObject *obj, uintN argc,
848
 
-                             jsval *argv, jsval *rval)
849
 
+static JSBool controls_pause (JSContext *cx, uintN argc, jsval *vp)
850
 
 {
851
 
   int32 pause_state=-1;
852
 
+  jsval *argv = JS_ARGV (cx, vp);
853
 
 
854
 
   se_log_fncall_checkinit ("pause");
855
 
   se_argc_check_max (1, "pause");
856
 
@@ -553,21 +546,21 @@ static JSBool controls_pause (JSContext
857
 
       set_speed (XINE_SPEED_NORMAL);
858
 
   }
859
 
 
860
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
861
 
   return JS_TRUE;
862
 
 }
863
 
 
864
 
-static JSBool controls_stop (JSContext *cx, JSObject *obj, uintN argc,
865
 
-                            jsval *argv, jsval *rval)
866
 
+static JSBool controls_stop (JSContext *cx, uintN argc, jsval *vp)
867
 
 {
868
 
   se_log_fncall_checkinit ("stop");
869
 
   player_stop ();
870
 
   playlist_logo (NULL);
871
 
   ui_set_control_adjustment (Control_SEEKER, 0);
872
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
873
 
   return JS_TRUE;
874
 
 }
875
 
 
876
 
-static JSBool controls_eject (JSContext *cx, JSObject *obj, uintN argc,
877
 
-                             jsval *argv, jsval *rval)
878
 
+static JSBool controls_eject (JSContext *cx, uintN argc, jsval *vp)
879
 
 {
880
 
   se_log_fncall_checkinit ("eject");
881
 
   if (xine_get_status (stream) == XINE_STATUS_PLAY)
882
 
@@ -576,17 +569,18 @@ static JSBool controls_eject (JSContext
883
 
   playlist_logo (cx); /* doesn't matter so long as it's not NULL */
884
 
   gdk_threads_enter ();
885
 
   ui_set_control_adjustment (Control_SEEKER, 0);
886
 
+  gtk_video_in_spu_button (gtv, 0);
887
 
   int ret = xine_eject (stream);
888
 
-  *rval = BOOLEAN_TO_JSVAL (ret);
889
 
+  JS_SET_RVAL (cx, vp, BOOLEAN_TO_JSVAL (ret));
890
 
   return JS_TRUE;
891
 
 }
892
 
 
893
 
 #ifdef WITH_OBSOLETE
894
 
 
895
 
-static JSBool js_set_speed (JSContext *cx, JSObject *obj, uintN argc,
896
 
-                           jsval *argv, jsval *rval)
897
 
+static JSBool js_set_speed (JSContext *cx, uintN argc, jsval *vp)
898
 
 {
899
 
   int32 speed;
900
 
+  jsval *argv = JS_ARGV (cx, vp);
901
 
 
902
 
   se_log_fncall_obsolete ("set_speed");
903
 
 
904
 
@@ -599,13 +593,14 @@ static JSBool js_set_speed (JSContext *c
905
 
     speed = 0;
906
 
   set_speed (calc_speed (speed));
907
 
 
908
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
909
 
   return JS_TRUE;
910
 
 }
911
 
 
912
 
-static JSBool js_set_volume (JSContext *cx, JSObject *obj, uintN argc,
913
 
-                           jsval *argv, jsval *rval)
914
 
+static JSBool js_set_volume (JSContext *cx, uintN argc, jsval *vp)
915
 
 {
916
 
   int32 volume;
917
 
+  jsval *argv = JS_ARGV (cx, vp);
918
 
 
919
 
   se_log_fncall_obsolete ("set_volume");
920
 
   se_argc_check (1, "set_volume");
921
 
@@ -618,13 +613,14 @@ static JSBool js_set_volume (JSContext *
922
 
   ui_set_control_adjustment (Control_VOLUME, volume);
923
 
   ui_xine_set_param_from_adjustment (Control_VOLUME);
924
 
 
925
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
926
 
   return JS_TRUE;
927
 
 }
928
 
 
929
 
-static JSBool js_set_mute (JSContext *cx, JSObject *obj, uintN argc,
930
 
-                          jsval *argv, jsval *rval)
931
 
+static JSBool js_set_mute (JSContext *cx, uintN argc, jsval *vp)
932
 
 {
933
 
   JSBool mute;
934
 
+  jsval *argv = JS_ARGV (cx, vp);
935
 
 
936
 
   se_log_fncall_obsolete ("set_mute");
937
 
   se_argc_check_max (1, "set_mute");
938
 
@@ -639,13 +635,14 @@ static JSBool js_set_mute (JSContext *cx
939
 
 
940
 
   set_mute (mute);
941
 
 
942
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
943
 
   return JS_TRUE;
944
 
 }
945
 
 
946
 
-static JSBool js_set_zoom (JSContext *cx, JSObject *obj, uintN argc,
947
 
-                          jsval *argv, jsval *rval)
948
 
+static JSBool js_set_zoom (JSContext *cx, uintN argc, jsval *vp)
949
 
 {
950
 
   int32 zoom;
951
 
+  jsval *argv = JS_ARGV (cx, vp);
952
 
 
953
 
   se_log_fncall_obsolete ("set_zoom");
954
 
   se_argc_check (1, "set_zoom");
955
 
@@ -654,6 +651,7 @@ static JSBool js_set_zoom (JSContext *cx
956
 
   JS_ValueToInt32 (cx, argv[0], &zoom);
957
 
   set_zoom (zoom);
958
 
 
959
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
960
 
   return JS_TRUE;
961
 
 }
962
 
 
963
 
@@ -684,9 +682,9 @@ static gboolean set_video_size_cb (gpoin
964
 
   return FALSE;
965
 
 }
966
 
 
967
 
-static JSBool js_set_video_size (JSContext *cx, JSObject *obj, uintN argc,
968
 
-                          jsval *argv, jsval *rval)
969
 
+static JSBool js_set_video_size (JSContext *cx, uintN argc, jsval *vp)
970
 
 {
971
 
+  jsval *argv = JS_ARGV (cx, vp);
972
 
   se_log_fncall ("set_video_size");
973
 
   se_argc_check (1, "set_video_size");
974
 
   se_arg_is_int (0, "set_video_size");
975
 
@@ -704,15 +702,16 @@ static JSBool js_set_video_size (JSConte
976
 
     g_source_remove (zoomcb_id);
977
 
   zoomcb_id = g_idle_add ((GSourceFunc) set_video_size_cb, NULL);
978
 
 
979
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
980
 
   return JS_TRUE;
981
 
 }
982
 
 
983
 
 #ifdef WITH_DEPRECATED
984
 
 
985
 
-static JSBool js_set_fullscreen (JSContext *cx, JSObject *obj, uintN argc,
986
 
-                                jsval *argv, jsval *rval)
987
 
+static JSBool js_set_fullscreen (JSContext *cx, uintN argc, jsval *vp)
988
 
 {
989
 
   int32 fs;
990
 
+  jsval *argv = JS_ARGV (cx, vp);
991
 
 
992
 
   se_log_fncall_deprecated ("set_fullscreen");
993
 
   se_argc_check_max (1, "set_fullscreen");
994
 
@@ -728,15 +727,16 @@ static JSBool js_set_fullscreen (JSConte
995
 
   if (gtk_toggle_action_get_active (action_items.fullscreen) != fs)
996
 
     gtk_action_activate (GTK_ACTION (action_items.fullscreen));
997
 
 
998
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
999
 
   return JS_TRUE;
1000
 
 }
1001
 
 
1002
 
 #ifdef WITH_OBSOLETE
1003
 
 
1004
 
-static JSBool js_set_deinterlace (JSContext *cx, JSObject *obj, uintN argc,
1005
 
-                                jsval *argv, jsval *rval)
1006
 
+static JSBool js_set_deinterlace (JSContext *cx, uintN argc, jsval *vp)
1007
 
 {
1008
 
   int32 di;
1009
 
+  jsval *argv = JS_ARGV (cx, vp);
1010
 
 
1011
 
   se_log_fncall_obsolete ("set_deinterlace");
1012
 
   se_argc_check_max (1, "set_deinterlace");
1013
 
@@ -750,14 +750,15 @@ static JSBool js_set_deinterlace (JSCont
1014
 
     di = !gtk_video_get_use_post_plugins_deinterlace ((GtkVideo *)gtv);
1015
 
 
1016
 
   set_deinterlace (di);
1017
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1018
 
   return JS_TRUE;
1019
 
 }
1020
 
 
1021
 
-static JSBool js_set_postproc_video (JSContext *cx, JSObject *obj,
1022
 
-                                    uintN argc, jsval *argv, jsval *rval)
1023
 
+static JSBool js_set_postproc_video (JSContext *cx, uintN argc, jsval *vp)
1024
 
 {
1025
 
   se_t *se = (se_t *) JS_GetContextPrivate(cx);
1026
 
   int32 di;
1027
 
+  jsval *argv = JS_ARGV (cx, vp);
1028
 
 
1029
 
   se_log_fncall_obsolete ("set_postproc_video");
1030
 
   se_argc_check_max (1, "set_postproc_video");
1031
 
@@ -767,26 +768,28 @@ static JSBool js_set_postproc_video (JSC
1032
 
     if (JSVAL_IS_INT (argv[0]))
1033
 
       JS_ValueToInt32 (cx, argv[0], &di);
1034
 
     else if (JSVAL_IS_STRING (argv[0]))
1035
 
-      return set_vo_postproc_chain (cx, obj, argc, argv, rval);
1036
 
+      return set_vo_postproc_chain (cx, argc, vp);
1037
 
     else
1038
 
     {
1039
 
       se->print_cb (se->print_cb_data,
1040
 
                   _("error: %s() argument %d is neither int nor string\n"),
1041
 
                   "set_postproc_video", 1);
1042
 
+      JS_SET_RVAL (cx, vp, JSVAL_VOID);
1043
 
       return JS_TRUE;
1044
 
     }
1045
 
   } else
1046
 
     di = !gtk_video_get_use_post_plugins_video ((GtkVideo *)gtv);
1047
 
 
1048
 
   set_vo_postproc (di);
1049
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1050
 
   return JS_TRUE;
1051
 
 }
1052
 
 
1053
 
-static JSBool js_set_postproc_audio (JSContext *cx, JSObject *obj,
1054
 
-                                    uintN argc, jsval *argv, jsval *rval)
1055
 
+static JSBool js_set_postproc_audio (JSContext *cx, uintN argc, jsval *vp)
1056
 
 {
1057
 
   se_t *se = (se_t *) JS_GetContextPrivate(cx);
1058
 
   int32 di;
1059
 
+  jsval *argv = JS_ARGV (cx, vp);
1060
 
 
1061
 
   se_log_fncall_obsolete ("set_postproc_audio");
1062
 
   se_argc_check_max (1, "set_postproc_audio");
1063
 
@@ -796,25 +799,27 @@ static JSBool js_set_postproc_audio (JSC
1064
 
     if (JSVAL_IS_INT (argv[0]))
1065
 
       JS_ValueToInt32 (cx, argv[0], &di);
1066
 
     else if (JSVAL_IS_STRING (argv[0]))
1067
 
-      return set_ao_postproc_chain (cx, obj, argc, argv, rval);
1068
 
+      return set_ao_postproc_chain (cx, argc, vp);
1069
 
     else
1070
 
     {
1071
 
       se->print_cb (se->print_cb_data,
1072
 
                   _("error: %s() argument %d is neither int nor string\n"),
1073
 
                   "set_postproc_audio", 1);
1074
 
+      JS_SET_RVAL (cx, vp, JSVAL_VOID);
1075
 
       return JS_TRUE;
1076
 
     }
1077
 
   } else
1078
 
     di = !gtk_video_get_use_post_plugins_audio ((GtkVideo *)gtv);
1079
 
 
1080
 
   set_ao_postproc (di);
1081
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1082
 
   return JS_TRUE;
1083
 
 }
1084
 
 
1085
 
-static JSBool js_set_auto_resize (JSContext *cx, JSObject *obj, uintN argc,
1086
 
-                                jsval *argv, jsval *rval)
1087
 
+static JSBool js_set_auto_resize (JSContext *cx, uintN argc, jsval *vp)
1088
 
 {
1089
 
   int32 ar;
1090
 
+  jsval *argv = JS_ARGV (cx, vp);
1091
 
 
1092
 
   se_log_fncall_obsolete ("set_auto_resize");
1093
 
   se_argc_check_max (1, "set_auto_resize");
1094
 
@@ -828,13 +833,14 @@ static JSBool js_set_auto_resize (JSCont
1095
 
     ar = !gtk_video_get_auto_resize ((GtkVideo *)gtv);
1096
 
 
1097
 
   set_auto_resize (ar);
1098
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1099
 
   return JS_TRUE;
1100
 
 }
1101
 
 
1102
 
-static JSBool js_set_auto_rescale (JSContext *cx, JSObject *obj, uintN argc,
1103
 
-                                  jsval *argv, jsval *rval)
1104
 
+static JSBool js_set_auto_rescale (JSContext *cx, uintN argc, jsval *vp)
1105
 
 {
1106
 
   int32 ar;
1107
 
+  jsval *argv = JS_ARGV (cx, vp);
1108
 
 
1109
 
   se_log_fncall_obsolete ("set_auto_rescale");
1110
 
   se_argc_check_max (1, "set_auto_rescale");
1111
 
@@ -848,13 +854,14 @@ static JSBool js_set_auto_rescale (JSCon
1112
 
     ar = !gtk_video_get_auto_rescale ((GtkVideo *)gtv);
1113
 
 
1114
 
   set_auto_rescale (ar);
1115
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1116
 
   return JS_TRUE;
1117
 
 }
1118
 
 
1119
 
-static JSBool js_set_aspect (JSContext *cx, JSObject *obj, uintN argc,
1120
 
-                            jsval *argv, jsval *rval)
1121
 
+static JSBool js_set_aspect (JSContext *cx, uintN argc, jsval *vp)
1122
 
 {
1123
 
   int32 aspect;
1124
 
+  jsval *argv = JS_ARGV (cx, vp);
1125
 
 
1126
 
   se_log_fncall_obsolete ("set_aspect");
1127
 
   se_argc_check_max (1, "set_aspect");
1128
 
@@ -868,18 +875,19 @@ static JSBool js_set_aspect (JSContext *
1129
 
     aspect = xine_get_param (stream, XINE_PARAM_VO_ASPECT_RATIO) + 1;
1130
 
 
1131
 
   set_aspect (aspect);
1132
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1133
 
   return JS_TRUE;
1134
 
 }
1135
 
 
1136
 
 #endif /* WITH_OBSOLETE */
1137
 
 #endif /* WITH_DEPRECATED */
1138
 
 
1139
 
-static JSBool js_snapshot (JSContext *cx, JSObject *obj, uintN argc,
1140
 
-                          jsval *argv, jsval *rval)
1141
 
+static JSBool js_snapshot (JSContext *cx, uintN argc, jsval *vp)
1142
 
 {
1143
 
   JSString *str;
1144
 
   char     *fname = NULL;
1145
 
   int32            scale = -1, blend = -1;
1146
 
+  jsval    *argv = JS_ARGV (cx, vp);
1147
 
 
1148
 
   se_log_fncall_checkinit ("snapshot");
1149
 
   se_argc_check_range (0, 3, "snapshot");
1150
 
@@ -895,18 +903,20 @@ static JSBool js_snapshot (JSContext *cx
1151
 
   case 1:
1152
 
     se_arg_is_string (0, "snapshot");
1153
 
     str = JS_ValueToString (cx, argv[0]);
1154
 
-    fname = JS_GetStringBytes (str);
1155
 
+    fname = SE_JS_ENCODE_STRING (cx, str);
1156
 
   }
1157
 
 
1158
 
   make_snapshot (fname, scale, blend);
1159
 
 
1160
 
+  SE_JS_FREE_ENCODED_STRING (cx, fname);
1161
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1162
 
   return JS_TRUE;
1163
 
 }
1164
 
 
1165
 
 
1166
 
-static JSBool controls_play (JSContext *cx, JSObject *obj, uintN argc,
1167
 
-                            jsval *argv, jsval *rval)
1168
 
+static JSBool controls_play (JSContext *cx, uintN argc, jsval *vp)
1169
 
 {
1170
 
+  jsval *argv = JS_ARGV (cx, vp);
1171
 
   se_log_fncall_checkinit ("play");
1172
 
   se_argc_check_max (3, "play");
1173
 
 
1174
 
@@ -925,7 +935,7 @@ static JSBool controls_play (JSContext *
1175
 
 
1176
 
       str = JS_ValueToString (cx, argv[0]);
1177
 
 
1178
 
-      mrl = JS_GetStringBytes (str);
1179
 
+      mrl = SE_JS_ENCODE_STRING (cx, str);
1180
 
       se_log ("playing '%s' from start\n", mrl);
1181
 
     }
1182
 
     break;
1183
 
@@ -935,9 +945,10 @@ static JSBool controls_play (JSContext *
1184
 
       se_arg_is_number (0, "play");
1185
 
       se_arg_is_int (1, "play");
1186
 
 
1187
 
-      jsdouble *posv = JS_NewDouble (cx, 0); /* when is this freed? */
1188
 
-      JS_ValueToNumber (cx, argv[0], posv);
1189
 
-      pos = (*posv >= 0 && *posv < 100) ? *posv * 655.35 : -1;
1190
 
+      jsdouble posv;
1191
 
+      JS_ValueToNumber (cx, argv[0], &posv);
1192
 
+      pos = (posv >= 0 && posv < 100) ? posv * 655.35 : -1;
1193
 
+
1194
 
       JS_ValueToInt32 (cx, argv[1], &pos_time);
1195
 
       mrl = NULL;
1196
 
       se_log ("playing from %d, %d\n", pos, pos_time);
1197
 
@@ -951,18 +962,23 @@ static JSBool controls_play (JSContext *
1198
 
       se_arg_is_int (2, "play");
1199
 
 
1200
 
       JSString *str = JS_ValueToString (cx, argv[0]);
1201
 
-      jsdouble *posv = JS_NewDouble (cx, 0); /* when is this freed? */
1202
 
-      JS_ValueToNumber (cx, argv[1], posv);
1203
 
-      pos = (*posv >= 0 && *posv < 100) ? *posv * 655.35 : -1;
1204
 
+
1205
 
+      jsdouble posv;
1206
 
+      JS_ValueToNumber (cx, argv[1], &posv);
1207
 
+      pos = (posv >= 0 && posv < 100) ? posv * 655.35 : -1;
1208
 
+
1209
 
       JS_ValueToInt32 (cx, argv[2], &pos_time);
1210
 
-      mrl = JS_GetStringBytes (str);
1211
 
+      mrl = SE_JS_ENCODE_STRING (cx, str);
1212
 
       se_log ("playing '%s' from %d, %d\n", mrl, pos, pos_time);
1213
 
     }
1214
 
     break;
1215
 
   }
1216
 
 
1217
 
   if (mrl)
1218
 
+  {
1219
 
     playlist_play_from (playlist_add_mrl (mrl, -1), pos, pos_time);
1220
 
+    SE_JS_FREE_ENCODED_STRING (cx, mrl);
1221
 
+  }
1222
 
   else
1223
 
   {
1224
 
     play_item_t *item = playlist_get_current_item ();
1225
 
@@ -990,15 +1006,16 @@ static JSBool controls_play (JSContext *
1226
 
   }
1227
 
   set_speed (XINE_SPEED_NORMAL);
1228
 
 
1229
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1230
 
   return JS_TRUE;
1231
 
 }
1232
 
 
1233
 
 /* Crude hack to allow combined play/pause function.
1234
 
  * (Useful on some keyboards with CD/DVD control keys.)
1235
 
  */
1236
 
-static JSBool controls_play_pause (JSContext *cx, JSObject *obj, uintN argc,
1237
 
-                                 jsval *argv, jsval *rval)
1238
 
+static JSBool controls_play_pause (JSContext *cx, uintN argc, jsval *vp)
1239
 
 {
1240
 
+  jsval *argv = JS_ARGV (cx, vp);
1241
 
   se_log_fncall_checkinit ("play_pause");
1242
 
   se_argc_check_max (1, "play_pause");
1243
 
 
1244
 
@@ -1009,22 +1026,21 @@ static JSBool controls_play_pause (JSCon
1245
 
   {
1246
 
   case XINE_STATUS_STOP:
1247
 
   case XINE_STATUS_IDLE:
1248
 
-    return controls_play (cx, obj, 0, 0, rval);
1249
 
+    return controls_play (cx, argc, vp);
1250
 
   default:
1251
 
-    return controls_pause (cx, obj, argc, argv, rval);
1252
 
+    return controls_pause (cx, argc, vp);
1253
 
   }
1254
 
 }
1255
 
 
1256
 
-static JSBool js_is_live_stream (JSContext *cx, JSObject *obj, uintN argc,
1257
 
-                                jsval *argv, jsval *rval)
1258
 
+static JSBool js_is_live_stream (JSContext *cx, uintN argc, jsval *vp)
1259
 
 {
1260
 
-  *rval = JSVAL_FALSE;
1261
 
+  JS_SET_RVAL(cx, vp, JSVAL_FALSE);
1262
 
 
1263
 
   se_log_fncall ("is_live_stream");
1264
 
   se_argc_check_max (0, "is_live_stream");
1265
 
 
1266
 
   if (player_live_stream ())
1267
 
-    *rval = JSVAL_TRUE;
1268
 
+    JS_SET_RVAL (cx, vp, JSVAL_TRUE);
1269
 
 
1270
 
   return JS_TRUE;
1271
 
 }
1272
 
@@ -1087,12 +1103,11 @@ static xine_audio_port_t *load_audio_out
1273
 
 /* Properties */
1274
 
 
1275
 
 static void add_chain_funcs (const char *prop, const char *config,
1276
 
-                            JSBool (*set_chain) (JSContext *, JSObject *,
1277
 
-                                                 uintN, jsval *, jsval *))
1278
 
+                            JSBool (*set_chain) (JSContext *, uintN, jsval *))
1279
 
 {
1280
 
   se_o_t *obj = se_find_object (gse, NULL, prop);
1281
 
   if (set_chain)
1282
 
-    se_defun (gse, obj, "set_chain", set_chain, 0, 0, SE_GROUP_HIDDEN, NULL, NULL);
1283
 
+    se_defun (gse, obj, "set_chain", set_chain, 0, JSFUN_FAST_NATIVE, SE_GROUP_HIDDEN, NULL, NULL);
1284
 
   se_prop_create_xine_id (gse, obj, "chain", config);
1285
 
   se_prop_add_listener (gse, obj, "chain",
1286
 
                        listen_postproc_chain, (void *)config);
1287
 
@@ -1194,69 +1209,69 @@ void player_init (void)
1288
 
 
1289
 
   {
1290
 
     static const se_f_def_t defs[] = {
1291
 
-      { "play", controls_play, 0, 0,
1292
 
+      { "play", controls_play, 0, JSFUN_FAST_NATIVE,
1293
 
        /* help text describes function parameters */
1294
 
        SE_GROUP_ENGINE, N_("[mrl] [, pos, time]"),
1295
 
        N_("time in milliseconds") },
1296
 
-      { "get_time", get_time, 0, 0,
1297
 
+      { "get_time", get_time, 0, JSFUN_FAST_NATIVE,
1298
 
        SE_GROUP_ENGINE, NULL, N_("stream time index") },
1299
 
-      { "get_pos", get_pos, 0, 0,
1300
 
+      { "get_pos", get_pos, 0, JSFUN_FAST_NATIVE,
1301
 
        SE_GROUP_ENGINE, NULL, N_("stream position (%)") },
1302
 
-      { "has_time", has_time, 0, 0,
1303
 
+      { "has_time", has_time, 0, JSFUN_FAST_NATIVE,
1304
 
        SE_GROUP_ENGINE, NULL, N_("whether the stream has a time index") },
1305
 
-      { "pause", controls_pause, 0, 0,
1306
 
+      { "pause", controls_pause, 0, JSFUN_FAST_NATIVE,
1307
 
        SE_GROUP_ENGINE, N_("[bool]"), NULL },
1308
 
-      { "stop", controls_stop, 0, 0,
1309
 
+      { "stop", controls_stop, 0, JSFUN_FAST_NATIVE,
1310
 
        SE_GROUP_ENGINE, NULL, NULL },
1311
 
-      { "eject", controls_eject, 0, 0,
1312
 
+      { "eject", controls_eject, 0, JSFUN_FAST_NATIVE,
1313
 
        SE_GROUP_ENGINE, NULL, NULL },
1314
 
-      { "play_pause", controls_play_pause, 0, 0,
1315
 
+      { "play_pause", controls_play_pause, 0, JSFUN_FAST_NATIVE,
1316
 
        SE_GROUP_ENGINE, N_("[bool]"), NULL },
1317
 
-      { "snapshot", js_snapshot, 0, 0,
1318
 
+      { "snapshot", js_snapshot, 0, JSFUN_FAST_NATIVE,
1319
 
        /* these correspond to the options in the snapshot-save dialogue box */
1320
 
        SE_GROUP_ENGINE, N_("[file name [, scale, blend]]"), NULL },
1321
 
 
1322
 
-      { "set_video_size", js_set_video_size, 0, 0,
1323
 
+      { "set_video_size", js_set_video_size, 0, JSFUN_FAST_NATIVE,
1324
 
        SE_GROUP_PROPERTIES, N_("int"), NULL },
1325
 
 
1326
 
 #ifdef WITH_DEPRECATED
1327
 
 #ifdef WITH_OBSOLETE
1328
 
-      { "set_speed", js_set_speed, 0, 0,
1329
 
+      { "set_speed", js_set_speed, 0, JSFUN_FAST_NATIVE,
1330
 
        SE_GROUP_HIDDEN, NULL, NULL },
1331
 
-      { "get_speed", js_get_speed, 0, 0,
1332
 
+      { "get_speed", js_get_speed, 0, JSFUN_FAST_NATIVE,
1333
 
        SE_GROUP_HIDDEN, NULL, NULL },
1334
 
-      { "set_volume", js_set_volume, 0, 0,
1335
 
+      { "set_volume", js_set_volume, 0, JSFUN_FAST_NATIVE,
1336
 
        SE_GROUP_HIDDEN, NULL, NULL },
1337
 
-      { "get_volume", js_get_volume, 0, 0,
1338
 
+      { "get_volume", js_get_volume, 0, JSFUN_FAST_NATIVE,
1339
 
        SE_GROUP_HIDDEN, NULL, NULL },
1340
 
-      { "set_mute", js_set_mute, 0, 0,
1341
 
+      { "set_mute", js_set_mute, 0, JSFUN_FAST_NATIVE,
1342
 
        SE_GROUP_HIDDEN, NULL, NULL },
1343
 
-      { "get_mute", js_get_mute, 0, 0,
1344
 
+      { "get_mute", js_get_mute, 0, JSFUN_FAST_NATIVE,
1345
 
        SE_GROUP_HIDDEN, NULL, NULL },
1346
 
-      { "set_zoom", js_set_zoom, 0, 0,
1347
 
+      { "set_zoom", js_set_zoom, 0, JSFUN_FAST_NATIVE,
1348
 
        SE_GROUP_HIDDEN, NULL, NULL },
1349
 
-      { "get_zoom", js_get_zoom, 0, 0,
1350
 
+      { "get_zoom", js_get_zoom, 0, JSFUN_FAST_NATIVE,
1351
 
        SE_GROUP_HIDDEN, NULL, NULL },
1352
 
 #endif /* WITH_OBSOLETE */
1353
 
-      { "set_fullscreen", js_set_fullscreen, 0, 0,
1354
 
+      { "set_fullscreen", js_set_fullscreen, 0, JSFUN_FAST_NATIVE,
1355
 
        SE_GROUP_HIDDEN, NULL, NULL },
1356
 
 #ifdef WITH_OBSOLETE
1357
 
-      { "set_aspect", js_set_aspect, 0, 0,
1358
 
+      { "set_aspect", js_set_aspect, 0, JSFUN_FAST_NATIVE,
1359
 
        SE_GROUP_HIDDEN, NULL, NULL },
1360
 
-      { "set_deinterlace", js_set_deinterlace, 0, 0,
1361
 
+      { "set_deinterlace", js_set_deinterlace, 0, JSFUN_FAST_NATIVE,
1362
 
        SE_GROUP_HIDDEN, NULL, NULL },
1363
 
-      { "set_postproc_video", js_set_postproc_video, 0, 0,
1364
 
+      { "set_postproc_video", js_set_postproc_video, 0, JSFUN_FAST_NATIVE,
1365
 
        SE_GROUP_HIDDEN, NULL, NULL },
1366
 
-      { "set_postproc_audio", js_set_postproc_audio, 0, 0,
1367
 
+      { "set_postproc_audio", js_set_postproc_audio, 0, JSFUN_FAST_NATIVE,
1368
 
        SE_GROUP_HIDDEN, NULL, NULL },
1369
 
-      { "set_auto_resize", js_set_auto_resize, 0, 0,
1370
 
+      { "set_auto_resize", js_set_auto_resize, 0, JSFUN_FAST_NATIVE,
1371
 
        SE_GROUP_HIDDEN, NULL, NULL },
1372
 
-      { "set_auto_rescale", js_set_auto_rescale, 0, 0,
1373
 
+      { "set_auto_rescale", js_set_auto_rescale, 0, JSFUN_FAST_NATIVE,
1374
 
        SE_GROUP_HIDDEN, NULL, NULL },
1375
 
 #endif /* WITH_OBSOLETE */
1376
 
 #endif /* WITH_DEPRECATED */
1377
 
 
1378
 
-      { "is_live_stream", js_is_live_stream, 0, 0,
1379
 
+      { "is_live_stream", js_is_live_stream, 0, JSFUN_FAST_NATIVE,
1380
 
        SE_GROUP_PROPERTIES, NULL, NULL },
1381
 
       { NULL }
1382
 
     };
1383
 
--- gxine-0.5.905.orig/src/wizards.c
1384
 
+++ gxine-0.5.905/src/wizards.c
1385
 
@@ -414,17 +414,17 @@ void run_wizards (gboolean requested)
1386
 
   }
1387
 
 }
1388
 
 
1389
 
-static JSBool js_run_wizards (JSContext *cx, JSObject *obj, uintN argc,
1390
 
-                             jsval *argv, jsval *rval)
1391
 
+static JSBool js_run_wizards (JSContext *cx, uintN argc, jsval *vp)
1392
 
 {
1393
 
   /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
1394
 
   se_log_fncall_checkinit ("run_wizards");
1395
 
   run_wizards (TRUE);
1396
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1397
 
   return JS_TRUE;
1398
 
 }
1399
 
 
1400
 
 void wizards_init (void)
1401
 
 {
1402
 
-  se_defun (gse, NULL, "run_wizards", js_run_wizards, 0, 0,
1403
 
+  se_defun (gse, NULL, "run_wizards", js_run_wizards, 0, JSFUN_FAST_NATIVE,
1404
 
            SE_GROUP_HIDDEN, NULL, NULL);
1405
 
 }
1406
 
--- gxine-0.5.905.orig/src/open_mrl.c
1407
 
+++ gxine-0.5.905/src/open_mrl.c
1408
 
@@ -88,21 +88,21 @@ static void open_mrl_response_cb (GtkDia
1409
 
   }
1410
 
 }
1411
 
 
1412
 
-static JSBool js_open_show (JSContext *cx, JSObject *obj, uintN argc,
1413
 
-                           jsval *argv, jsval *rval)
1414
 
+static JSBool js_open_show (JSContext *cx, uintN argc, jsval *vp)
1415
 
 {
1416
 
   /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
1417
 
   se_log_fncall_checkinit ("open_show");
1418
 
   file_dialog_show ();
1419
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1420
 
   return JS_TRUE;
1421
 
 }
1422
 
 
1423
 
-static JSBool js_open_mrl_show (JSContext *cx, JSObject *obj, uintN argc,
1424
 
-                               jsval *argv, jsval *rval)
1425
 
+static JSBool js_open_mrl_show (JSContext *cx, uintN argc, jsval *vp)
1426
 
 {
1427
 
   /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
1428
 
   se_log_fncall_checkinit ("open_mrl_show");
1429
 
   open_mrl_show ();
1430
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1431
 
   return JS_TRUE;
1432
 
 }
1433
 
 
1434
 
@@ -142,8 +142,8 @@ void open_mrl_init (void)
1435
 
 
1436
 
   {
1437
 
     static const se_f_def_t defs[] = {
1438
 
-      { "open_show", js_open_show, 0, 0, SE_GROUP_FILE, NULL, NULL },
1439
 
-      { "open_mrl_show", js_open_mrl_show, 0, 0, SE_GROUP_FILE, NULL, NULL },
1440
 
+      { "open_show", js_open_show, 0, JSFUN_FAST_NATIVE, SE_GROUP_FILE, NULL, NULL },
1441
 
+      { "open_mrl_show", js_open_mrl_show, 0, JSFUN_FAST_NATIVE, SE_GROUP_FILE, NULL, NULL },
1442
 
       { NULL }
1443
 
     };
1444
 
     se_defuns (gse, NULL, defs);
1445
 
--- gxine-0.5.905.orig/src/key_events.c
1446
 
+++ gxine-0.5.905/src/key_events.c
1447
 
@@ -1041,10 +1041,13 @@ static JSBool js_xine_event (int type
1448
 
 #endif
1449
 
 
1450
 
 #define JS_XINE_EVENT(L,T) \
1451
 
-  static JSBool js_##L (JSContext *cx, JSObject *obj, uintN argc, \
1452
 
-                       jsval *argv, jsval *rval) \
1453
 
+  static JSBool js_##L (JSContext *cx, uintN argc, jsval *vp) \
1454
 
   { \
1455
 
-    return js_xine_event (XINE_EVENT_##T, #L); \
1456
 
+    JSBool ret = js_xine_event (XINE_EVENT_##T, #L); \
1457
 
+    if (ret) { \
1458
 
+      JS_SET_RVAL (cx, vp, JSVAL_VOID); \
1459
 
+    } \
1460
 
+    return ret; \
1461
 
   }
1462
 
 
1463
 
 JS_XINE_EVENT (input_up, INPUT_UP);
1464
 
@@ -1091,16 +1094,15 @@ JS_XINE_EVENT (input_menu3, INPUT_MENU3)
1465
 
 JS_XINE_EVENT (input_previous, INPUT_PREVIOUS);
1466
 
 JS_XINE_EVENT (input_next, INPUT_NEXT);
1467
 
 
1468
 
-static JSBool js_keybindings_show (JSContext *cx, JSObject *obj, uintN argc,
1469
 
-                                  jsval *argv, jsval *rval)
1470
 
+static JSBool js_keybindings_show (JSContext *cx, uintN argc, jsval *vp)
1471
 
 {
1472
 
   se_log_fncall_checkinit ("keybindings_show");
1473
 
   kb_edit_show ();
1474
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1475
 
   return JS_TRUE;
1476
 
 }
1477
 
 
1478
 
-static JSBool js_keypad_show (JSContext *cx, JSObject *obj, uintN argc,
1479
 
-                             jsval *argv, jsval *rval)
1480
 
+static JSBool js_keypad_show (JSContext *cx, uintN argc, jsval *vp)
1481
 
 {
1482
 
   se_log_fncall_checkinit ("keypad_show");
1483
 
   if (keypad)
1484
 
@@ -1110,6 +1112,7 @@ static JSBool js_keypad_show (JSContext
1485
 
     else
1486
 
       window_show (keypad, NULL);
1487
 
   }
1488
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1489
 
   return JS_TRUE;
1490
 
 }
1491
 
 
1492
 
@@ -1247,8 +1250,8 @@ static const kb_xine_event_map_t xine_vd
1493
 
   }
1494
 
 };
1495
 
 
1496
 
-JSBool js_event_generic (JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
1497
 
-                        jsval *rval, const char *func, const char *const *prefix,
1498
 
+JSBool js_event_generic (JSContext *cx, uintN argc, jsval *vp,
1499
 
+                         const char *func, const char *const *prefix,
1500
 
                         ...)
1501
 
 {
1502
 
   se_t *se = (se_t *) JS_GetContextPrivate(cx);
1503
 
@@ -1257,8 +1260,9 @@ JSBool js_event_generic (JSContext *cx,
1504
 
   char *evstr;
1505
 
   va_list ap;
1506
 
   const kb_xine_event_map_t *evlist;
1507
 
+  jsval *argv = JS_ARGV (cx, vp);
1508
 
 
1509
 
-  *rval = JSVAL_TRUE;
1510
 
+  JS_SET_RVAL (cx, vp, JSVAL_TRUE);
1511
 
 
1512
 
   se_log_fncall (func);
1513
 
   se_argc_check_max (1, func);
1514
 
@@ -1275,7 +1279,7 @@ JSBool js_event_generic (JSContext *cx,
1515
 
 
1516
 
   se_arg_is_string (0, func);
1517
 
 
1518
 
-  *rval = JSVAL_FALSE;
1519
 
+  JS_SET_RVAL (cx, vp, JSVAL_FALSE);
1520
 
 
1521
 
   if (prefix)
1522
 
   {
1523
 
@@ -1294,7 +1298,7 @@ JSBool js_event_generic (JSContext *cx,
1524
 
   }
1525
 
 
1526
 
   str = JS_ValueToString (cx, argv[0]);
1527
 
-  evstr = JS_GetStringBytes (str);
1528
 
+  evstr = SE_JS_ENCODE_STRING (cx, str);
1529
 
   event.type = 0;
1530
 
 
1531
 
   va_start (ap, prefix);
1532
 
@@ -1306,8 +1310,10 @@ JSBool js_event_generic (JSContext *cx,
1533
 
     event.type = kb_xine_event_lookup (NULL, evstr);
1534
 
 
1535
 
   if (!event.type)
1536
 
+  {
1537
 
+    SE_JS_FREE_ENCODED_STRING (cx, evstr);
1538
 
     return JS_TRUE;
1539
 
-
1540
 
+  }
1541
 
   if (event.type != -1)
1542
 
   {
1543
 
     event.data = NULL;
1544
 
@@ -1316,21 +1322,20 @@ JSBool js_event_generic (JSContext *cx,
1545
 
     xine_event_send (stream, &event);
1546
 
   }
1547
 
 
1548
 
-  *rval = JSVAL_TRUE;
1549
 
+  SE_JS_FREE_ENCODED_STRING (cx, evstr);
1550
 
+  JS_SET_RVAL (cx, vp, JSVAL_TRUE);
1551
 
   return JS_TRUE;
1552
 
 }
1553
 
 
1554
 
-static JSBool js_event (JSContext *cx, JSObject *obj, uintN argc,
1555
 
-                     jsval *argv, jsval *rval)
1556
 
+static JSBool js_event (JSContext *cx, uintN argc, jsval *vp)
1557
 
 {
1558
 
-  return js_event_generic (cx, obj, argc, argv, rval, "event", NULL, NULL);
1559
 
+  return js_event_generic (cx, argc, vp, "event", NULL, NULL);
1560
 
 }
1561
 
 
1562
 
-static JSBool js_vdr (JSContext *cx, JSObject *obj, uintN argc,
1563
 
-                     jsval *argv, jsval *rval)
1564
 
+static JSBool js_vdr (JSContext *cx, uintN argc, jsval *vp)
1565
 
 {
1566
 
   const char *const prefixes[] = { "vdr:/", "netvdr:/", NULL };
1567
 
-  return js_event_generic (cx, obj, argc, argv, rval, "vdr", prefixes,
1568
 
+  return js_event_generic (cx, argc, vp, "vdr", prefixes,
1569
 
                           &xine_vdr, NULL);
1570
 
 }
1571
 
 
1572
 
@@ -1528,25 +1533,25 @@ void key_events_init (void)
1573
 
 
1574
 
   {
1575
 
     static const se_f_def_t defs[] = {
1576
 
-      { "input_up", js_input_up, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1577
 
-      { "input_down", js_input_down, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1578
 
-      { "input_left", js_input_left, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1579
 
-      { "input_right", js_input_right, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1580
 
-      { "input_select", js_input_select, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1581
 
-      { "input_menu", js_input_menu, 0, 0,
1582
 
+      { "input_up", js_input_up, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1583
 
+      { "input_down", js_input_down, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1584
 
+      { "input_left", js_input_left, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1585
 
+      { "input_right", js_input_right, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1586
 
+      { "input_select", js_input_select, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1587
 
+      { "input_menu", js_input_menu, 0, JSFUN_FAST_NATIVE,
1588
 
        SE_GROUP_INPUT, N_("int"), N_("range is 1 to 7") },
1589
 
-      { "input_menu1", js_input_menu1, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1590
 
-      { "input_menu2", js_input_menu2, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1591
 
-      { "input_menu3", js_input_menu3, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1592
 
-      { "input_previous", js_input_previous, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1593
 
-      { "input_next", js_input_next, 0, 0, SE_GROUP_INPUT, NULL, NULL },
1594
 
-      { "keybindings_show", js_keybindings_show, 0, 0,
1595
 
+      { "input_menu1", js_input_menu1, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1596
 
+      { "input_menu2", js_input_menu2, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1597
 
+      { "input_menu3", js_input_menu3, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1598
 
+      { "input_previous", js_input_previous, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1599
 
+      { "input_next", js_input_next, 0, JSFUN_FAST_NATIVE, SE_GROUP_INPUT, NULL, NULL },
1600
 
+      { "keybindings_show", js_keybindings_show, 0, JSFUN_FAST_NATIVE,
1601
 
        SE_GROUP_DIALOGUE, NULL, NULL },
1602
 
-      { "keypad_show", js_keypad_show, 0, 0,
1603
 
+      { "keypad_show", js_keypad_show, 0, JSFUN_FAST_NATIVE,
1604
 
        SE_GROUP_DIALOGUE, NULL, NULL },
1605
 
-      { "event", js_event, 0, 0,
1606
 
+      { "event", js_event, 0, JSFUN_FAST_NATIVE,
1607
 
        SE_GROUP_INPUT, N_("string"), N_("event; returns true if sent") },
1608
 
-      { "vdr", js_vdr, 0, 0,
1609
 
+      { "vdr", js_vdr, 0, JSFUN_FAST_NATIVE,
1610
 
        SE_GROUP_EXTERNAL, N_("string"), N_("VDR event; returns true if sent") },
1611
 
       { NULL }
1612
 
     };
1613
 
--- gxine-0.5.905.orig/src/preferences.c
1614
 
+++ gxine-0.5.905/src/preferences.c
1615
 
@@ -1106,12 +1106,12 @@ static void response_cb (GtkDialog *dbox
1616
 
   }
1617
 
 }
1618
 
 
1619
 
-static JSBool js_preferences_show (JSContext *cx, JSObject *obj, uintN argc,
1620
 
-                                  jsval *argv, jsval *rval)
1621
 
+static JSBool js_preferences_show (JSContext *cx, uintN argc, jsval *vp)
1622
 
 {
1623
 
   /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
1624
 
   se_log_fncall_checkinit ("preferences_show");
1625
 
   preferences_show ();
1626
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1627
 
   return JS_TRUE;
1628
 
 }
1629
 
 
1630
 
@@ -1171,7 +1171,7 @@ void preferences_init (void)
1631
 
 {
1632
 
   is_visible = FALSE;
1633
 
   /* script engine functions */
1634
 
-  se_defun (gse, NULL, "preferences_show", js_preferences_show, 0, 0,
1635
 
+  se_defun (gse, NULL, "preferences_show", js_preferences_show, 0, JSFUN_FAST_NATIVE,
1636
 
            SE_GROUP_DIALOGUE, NULL, NULL);
1637
 
 
1638
 
   preferences_init_dbox ();
1639
 
--- gxine-0.5.905.orig/src/lirc.c
1640
 
+++ gxine-0.5.905/src/lirc.c
1641
 
@@ -212,8 +212,7 @@ void gxine_lirc_quit (void)
1642
 
 #endif
1643
 
 }
1644
 
 
1645
 
-static JSBool js_reload_lirc (JSContext *cx, JSObject *obj, uintN argc,
1646
 
-                             jsval *argv, jsval *rval)
1647
 
+static JSBool js_reload_lirc (JSContext *cx, uintN argc, jsval *vp)
1648
 
 {
1649
 
   se_log_fncall ("reload_lirc");
1650
 
   se_argc_check_max (0, "reload_lirc");
1651
 
@@ -221,13 +220,13 @@ static JSBool js_reload_lirc (JSContext
1652
 
   if (gxine_lirc_thread)
1653
 
     pthread_join (gxine_lirc_thread, NULL);
1654
 
   gxine_lirc_start ();
1655
 
-  *rval = gxine_lirc_thread ? JSVAL_TRUE : JSVAL_FALSE;
1656
 
+  JS_SET_RVAL (cx, vp, gxine_lirc_thread ? JSVAL_TRUE : JSVAL_FALSE);
1657
 
   return JS_TRUE;
1658
 
 }
1659
 
 
1660
 
 void gxine_lirc_init (void)
1661
 
 {
1662
 
-  se_defun (gse, NULL, "reload_lirc", js_reload_lirc, 0, 0,
1663
 
+  se_defun (gse, NULL, "reload_lirc", js_reload_lirc, 0, JSFUN_FAST_NATIVE,
1664
 
            SE_GROUP_HIDDEN, NULL, NULL);
1665
 
   gxine_lirc_start ();
1666
 
 }
1667
 
--- gxine-0.5.905.orig/src/script_engine.h
1668
 
+++ gxine-0.5.905/src/script_engine.h
1669
 
@@ -34,6 +34,97 @@
1670
 
 #include <jsapi.h>
1671
 
 #include <pthread.h>
1672
 
 
1673
 
+#ifndef JSFUN_FAST_NATIVE
1674
 
+// All natives are JSFastNative
1675
 
+#define JSFUN_FAST_NATIVE 0
1676
 
+#endif
1677
 
+
1678
 
+#ifdef HAVE_JS_GET_STRING_BYTES
1679
 
+# define SE_JS_ENCODE_STRING(cx, str) JS_GetStringBytes(str)
1680
 
+# define SE_JS_FREE_ENCODED_STRING(cx, str)
1681
 
+#else
1682
 
+# define SE_JS_ENCODE_STRING(cx, str) JS_EncodeString(cx, str)
1683
 
+# define SE_JS_FREE_ENCODED_STRING(cx, str) JS_free(cx, str)
1684
 
+#endif
1685
 
+
1686
 
+#ifdef HAVE_JS_NEW_DOUBLE
1687
 
+# define SE_JS_NEW_NUMBER_VAL(cx, d, rval) \
1688
 
+    jsdouble *new_d = JS_NewDouble (cx, d); \
1689
 
+    rval = DOUBLE_TO_JSVAL (new_d)
1690
 
+#else
1691
 
+# define SE_JS_NEW_NUMBER_VAL(cx, d, rval) \
1692
 
+    JS_NewNumberValue (cx, d, &rval)
1693
 
+#endif
1694
 
+
1695
 
+#ifdef JS_PROPERTY_OP_HAS_ID_AS_JSID
1696
 
+# define SE_JS_PROPERTY_GETTER_DECLARE(name) \
1697
 
+    static JSBool \
1698
 
+    name(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
1699
 
+# define SE_JS_PROPERTY_GETTER_INIT_VARIABLES(idval) \
1700
 
+    jsval idval; \
1701
 
+    JS_IdToValue (cx, id, &idval)
1702
 
+# define SE_JS_CALL_PROPERTY_GETTER_WITH_JSVAL(getter, cx, obj, propval, vp) __extension__ ({ \
1703
 
+    jsid propid; \
1704
 
+    JS_ValueToId (cx, propval, &propid); \
1705
 
+    JSBool ret = getter (cx, obj, propid, vp); \
1706
 
+    ret; \
1707
 
+})
1708
 
+#else
1709
 
+# define SE_JS_PROPERTY_GETTER_DECLARE(name) \
1710
 
+    static JSBool \
1711
 
+    name(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
1712
 
+# define SE_JS_PROPERTY_GETTER_INIT_VARIABLES(idval) \
1713
 
+    jsval idval = id
1714
 
+# define SE_JS_CALL_PROPERTY_GETTER_WITH_JSVAL(getter, cx, obj, propval, vp) __extension__ ({ \
1715
 
+    JSBool ret = getter (cx, obj, propval, vp); \
1716
 
+    ret; \
1717
 
+})
1718
 
+#endif
1719
 
+
1720
 
+#ifdef HAVE_JS_STRICT_PROPERTY_OP
1721
 
+# define SE_JS_PROPERTY_SETTER_DECLARE(name) \
1722
 
+    static JSBool \
1723
 
+    name(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
1724
 
+# define SE_JS_PROPERTY_SETTER_INIT_VARIABLES(idval) \
1725
 
+    jsval idval; \
1726
 
+    JS_IdToValue (cx, id, &idval)
1727
 
+# define SE_JS_CALL_PROPERTY_SETTER_WITH_JSVAL(setter, cx, obj, propval, vp) __extension__ ({ \
1728
 
+    jsid propid; \
1729
 
+    JS_ValueToId (cx, propval, &propid); \
1730
 
+    JSBool ret = setter (cx, obj, propid, JS_FALSE, vp); \
1731
 
+    ret; \
1732
 
+})
1733
 
+#elif JS_PROPERTY_OP_HAS_ID_AS_JSID
1734
 
+# define SE_JS_PROPERTY_SETTER_DECLARE(name) \
1735
 
+    static JSBool \
1736
 
+    name(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
1737
 
+# define SE_JS_PROPERTY_SETTER_INIT_VARIABLES(idval) \
1738
 
+    jsval idval; \
1739
 
+    JS_IdToValue (cx, id, &idval)
1740
 
+# define SE_JS_CALL_PROPERTY_SETTER_WITH_JSVAL(setter, cx, obj, propval, vp) __extension__ ({ \
1741
 
+    jsid propid; \
1742
 
+    JS_ValueToId (cx, propval, &propid); \
1743
 
+    JSBool ret = setter (cx, obj, propid, vp); \
1744
 
+    ret; \
1745
 
+})
1746
 
+#else
1747
 
+# define SE_JS_PROPERTY_SETTER_DECLARE(name) \
1748
 
+    static JSBool \
1749
 
+    name(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
1750
 
+# define SE_JS_PROPERTY_SETTER_INIT_VARIABLES(idval) \
1751
 
+    jsval idval = id
1752
 
+# define SE_JS_CALL_PROPERTY_SETTER_WITH_JSVAL(setter, cx, obj, propval, vp) __extension__ ({ \
1753
 
+    JSBool ret = setter (cx, obj, propval, vp); \
1754
 
+    ret; \
1755
 
+})
1756
 
+#endif
1757
 
+
1758
 
+#ifdef JSVAL_TO_DOUBLE_RETURNS_POINTER
1759
 
+# define SE_JSVAL_TO_DOUBLE(v) *JSVAL_TO_DOUBLE(v)
1760
 
+#else
1761
 
+# define SE_JSVAL_TO_DOUBLE(v) JSVAL_TO_DOUBLE(v)
1762
 
+#endif
1763
 
+
1764
 
 typedef int (*se_prop_int_cb_t) (void *user_data, char *property, int *num);
1765
 
 typedef void (*se_print_cb_t) (void *user_data, const char *str, ...)
1766
 
   __attribute__ ((format (printf, 2, 3)));
1767
 
--- gxine-0.5.905.orig/src/systray.c
1768
 
+++ gxine-0.5.905/src/systray.c
1769
 
@@ -214,10 +214,10 @@ button_cb (GtkWidget *widget, GdkEventBu
1770
 
   return TRUE;
1771
 
 }
1772
 
 
1773
 
-static JSBool js_minimise (JSContext *cx, JSObject *obj, uintN argc,
1774
 
-                             jsval *argv, jsval *rval)
1775
 
+static JSBool js_minimise (JSContext *cx, uintN argc, jsval *vp)
1776
 
 {
1777
 
   int32 tray_state=-1;
1778
 
+  jsval *argv = JS_ARGV (cx, vp);
1779
 
 
1780
 
   se_log_fncall_checkinit ("set_minimised");
1781
 
   se_argc_check_max (1, "set_minimised");
1782
 
@@ -239,13 +239,14 @@ static JSBool js_minimise (JSContext *cx
1783
 
       app_show ();
1784
 
   }
1785
 
 
1786
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1787
 
   return JS_TRUE;
1788
 
 }
1789
 
 
1790
 
 void systray_init (void)
1791
 
 {
1792
 
   static const se_f_def_t defs[] = {
1793
 
-    { "set_minimised", js_minimise, 0, 0,
1794
 
+    { "set_minimised", js_minimise, 0, JSFUN_FAST_NATIVE,
1795
 
       SE_GROUP_ENGINE, N_("[bool]"),
1796
 
       N_("true to hide, false to show") },
1797
 
     { NULL }
1798
 
--- gxine-0.5.905.orig/src/settings.c
1799
 
+++ gxine-0.5.905/src/settings.c
1800
 
@@ -129,10 +129,10 @@ get_sliders (const struct slider_window_
1801
 
   }
1802
 
 
1803
 
 #define JSFUNC(OBJ,FUNC) \
1804
 
-  static JSBool js_##OBJ##_##FUNC (JSContext *cx, JSObject *obj, uintN argc, \
1805
 
-                                  jsval *argv, jsval *rval) \
1806
 
+  static JSBool js_##OBJ##_##FUNC (JSContext *cx, uintN argc, jsval *vp) \
1807
 
   { \
1808
 
     int page = -1; \
1809
 
+    jsval *argv = JS_ARGV (cx, vp); \
1810
 
     se_log_fncall_checkinit (#OBJ"_"#FUNC); \
1811
 
     se_argc_check_max (1, #OBJ"_"#FUNC); \
1812
 
     if (argc) \
1813
 
@@ -141,11 +141,14 @@ get_sliders (const struct slider_window_
1814
 
       JS_ValueToInt32 (cx, argv[0], &page); \
1815
 
     } \
1816
 
     sliders_##FUNC (&OBJ##_window, page, TRUE); \
1817
 
+    if (vp) { \
1818
 
+      JS_SET_RVAL (cx, vp, JSVAL_VOID); \
1819
 
+    } \
1820
 
     return JS_TRUE; \
1821
 
   }
1822
 
 
1823
 
 #define JSDECL(OBJ,FUNC) \
1824
 
-  { #OBJ"_"#FUNC, js_##OBJ##_##FUNC, 0, 0,SE_GROUP_DIALOGUE, NULL, NULL }
1825
 
+  { #OBJ"_"#FUNC, js_##OBJ##_##FUNC, 0, JSFUN_FAST_NATIVE,SE_GROUP_DIALOGUE, NULL, NULL }
1826
 
 
1827
 
 static void sliders_show (struct slider_window_s *window, guint page,
1828
 
                          gboolean unused)
1829
 
@@ -331,5 +334,5 @@ void settings_init (void)
1830
 
 
1831
 
 void settings_clear (void)
1832
 
 {
1833
 
-  js_settings_clear (gse->cx, NULL, 0, NULL, NULL);
1834
 
+  js_settings_clear (gse->cx, 0, NULL);
1835
 
 }
1836
 
--- gxine-0.5.905.orig/src/post.c
1837
 
+++ gxine-0.5.905/src/post.c
1838
 
@@ -1079,38 +1079,47 @@ post_config_post_chain_window (gxine_cha
1839
 
 }
1840
 
 
1841
 
 static JSBool
1842
 
-js_deinterlace_show (JSContext *cx, JSObject *obj, uintN argc,
1843
 
-                    jsval *argv, jsval *rval)
1844
 
+js_deinterlace_show (JSContext *cx, uintN argc, jsval *vp)
1845
 
 {
1846
 
   se_log_fncall_checkinit ("deinterlace_show");
1847
 
-  return post_config_post_chain_window (&chains[POST_CHAIN_DEINTERLACE]);
1848
 
+  JSBool ret = post_config_post_chain_window (&chains[POST_CHAIN_DEINTERLACE]);
1849
 
+  if (ret) {
1850
 
+    JS_SET_RVAL (cx, vp, JSVAL_VOID);
1851
 
+  }
1852
 
+  return ret;
1853
 
 }
1854
 
 
1855
 
 static JSBool
1856
 
-js_pp_video_show (JSContext *cx, JSObject *obj, uintN argc,
1857
 
-                 jsval *argv, jsval *rval)
1858
 
+js_pp_video_show (JSContext *cx, uintN argc, jsval *vp)
1859
 
 {
1860
 
   se_log_fncall_checkinit ("postproc_video_show");
1861
 
-  return post_config_post_chain_window (&chains[POST_CHAIN_VIDEO]);
1862
 
+  JSBool ret = post_config_post_chain_window (&chains[POST_CHAIN_VIDEO]);
1863
 
+  if (ret) {
1864
 
+    JS_SET_RVAL (cx, vp, JSVAL_VOID);
1865
 
+  }
1866
 
+  return ret;
1867
 
 }
1868
 
 
1869
 
 static JSBool
1870
 
-js_pp_audio_show (JSContext *cx, JSObject *obj, uintN argc,
1871
 
-                 jsval *argv, jsval *rval)
1872
 
+js_pp_audio_show (JSContext *cx, uintN argc, jsval *vp)
1873
 
 {
1874
 
   se_log_fncall_checkinit ("postproc_audio_show");
1875
 
-  return post_config_post_chain_window (&chains[POST_CHAIN_AUDIO]);
1876
 
+  JSBool ret = post_config_post_chain_window (&chains[POST_CHAIN_AUDIO]);
1877
 
+  if (ret) {
1878
 
+    JS_SET_RVAL (cx, vp, JSVAL_VOID);
1879
 
+  }
1880
 
+  return ret;
1881
 
 }
1882
 
 
1883
 
 void
1884
 
 post_init (void)
1885
 
 {
1886
 
   static const se_f_def_t defs[] = {
1887
 
-    { "deinterlace_show", js_deinterlace_show, 0, 0,
1888
 
+    { "deinterlace_show", js_deinterlace_show, 0, JSFUN_FAST_NATIVE,
1889
 
       SE_GROUP_DIALOGUE, NULL, NULL },
1890
 
-    { "postproc_video_show", js_pp_video_show, 0, 0,
1891
 
+    { "postproc_video_show", js_pp_video_show, 0, JSFUN_FAST_NATIVE,
1892
 
       SE_GROUP_DIALOGUE, NULL, NULL },
1893
 
-    { "postproc_audio_show", js_pp_audio_show, 0, 0,
1894
 
+    { "postproc_audio_show", js_pp_audio_show, 0, JSFUN_FAST_NATIVE,
1895
 
       SE_GROUP_DIALOGUE, NULL, NULL },
1896
 
     { NULL }
1897
 
   };
1898
 
--- gxine-0.5.905.orig/src/playlist.c
1899
 
+++ gxine-0.5.905/src/playlist.c
1900
 
@@ -2123,71 +2123,70 @@ static void drop_cb (GtkTreeView        *widget
1901
 
  * js functions
1902
 
  */
1903
 
 
1904
 
-static JSBool js_playlist_get_item (JSContext *cx, JSObject *obj, uintN argc,
1905
 
-                                   jsval *argv, jsval *rval)
1906
 
+static JSBool js_playlist_get_item (JSContext *cx, uintN argc, jsval *vp)
1907
 
 {
1908
 
   /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
1909
 
   se_log_fncall ("playlist_get_item");
1910
 
-  *rval = INT_TO_JSVAL (playlist_get_list_pos());
1911
 
+  JS_SET_RVAL (cx, vp, INT_TO_JSVAL (playlist_get_list_pos()));
1912
 
   return JS_TRUE;
1913
 
 }
1914
 
 
1915
 
-static JSBool js_playlist_clear (JSContext *cx, JSObject *obj, uintN argc,
1916
 
-                                jsval *argv, jsval *rval)
1917
 
+static JSBool js_playlist_clear (JSContext *cx, uintN argc, jsval *vp)
1918
 
 {
1919
 
   se_log_fncall_checkinit ("playlist_clear");
1920
 
   playlist_clear ();
1921
 
-  *rval = JSVAL_VOID;
1922
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1923
 
   return JS_TRUE;
1924
 
 }
1925
 
 
1926
 
-static JSBool js_playlist_flush (JSContext *cx, JSObject *obj, uintN argc,
1927
 
-                                jsval *argv, jsval *rval)
1928
 
+static JSBool js_playlist_flush (JSContext *cx, uintN argc, jsval *vp)
1929
 
 {
1930
 
   se_log_fncall_checkinit ("playlist_flush");
1931
 
   playlist_flush (PLAY_ITEM_NORMAL);
1932
 
-  *rval = JSVAL_VOID;
1933
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1934
 
   return JS_TRUE;
1935
 
 }
1936
 
 
1937
 
-static JSBool js_playlist_load (JSContext *cx, JSObject *obj, uintN argc,
1938
 
-                               jsval *argv, jsval *rval)
1939
 
+static JSBool js_playlist_load (JSContext *cx, uintN argc, jsval *vp)
1940
 
 {
1941
 
+  jsval *argv = JS_ARGV (cx, vp);
1942
 
   se_log_fncall_checkinit ("playlist_load");
1943
 
 
1944
 
   se_argc_check (1, "playlist_load");
1945
 
   se_arg_is_string_or_null (0, "playlist_load");
1946
 
 
1947
 
-  char *mrl = JS_GetStringBytes (JS_ValueToString (cx, argv[0]));
1948
 
+  char *mrl = SE_JS_ENCODE_STRING (cx, JS_ValueToString (cx, argv[0]));
1949
 
 
1950
 
   logprintf ("playlist_load: file=%s\n", mrl);
1951
 
   playlist_load_any (mrl);
1952
 
 
1953
 
-  *rval = JSVAL_VOID;
1954
 
+  SE_JS_FREE_ENCODED_STRING (cx, mrl);
1955
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
1956
 
   return JS_TRUE;
1957
 
 }
1958
 
 
1959
 
-static JSBool js_playlist_add (JSContext *cx, JSObject *obj, uintN argc,
1960
 
-                              jsval *argv, jsval *rval)
1961
 
+static JSBool js_playlist_add (JSContext *cx, uintN argc, jsval *vp)
1962
 
 {
1963
 
+  jsval *argv = JS_ARGV (cx, vp);
1964
 
 
1965
 
   se_log_fncall_checkinit ("playlist_add");
1966
 
 
1967
 
   se_argc_check_range (1, 2, "playlist_add");
1968
 
   se_arg_is_string (0, "playlist_add");
1969
 
 
1970
 
-  char *mrl = JS_GetStringBytes (JS_ValueToString (cx, argv[0]));
1971
 
+  char *mrl = SE_JS_ENCODE_STRING (cx, JS_ValueToString (cx, argv[0]));
1972
 
   int item;
1973
 
 
1974
 
   if (argc > 1)
1975
 
   {
1976
 
     se_arg_is_string_or_null (1, "playlist_add");
1977
 
     char *title = JSVAL_IS_STRING (argv[1])
1978
 
-                 ? JS_GetStringBytes (JS_ValueToString (cx, argv[1]))
1979
 
+                  ? SE_JS_ENCODE_STRING (cx, JS_ValueToString (cx, argv[1]))
1980
 
                  : NULL;
1981
 
     logprintf ("playlist_add: MRL=%s title=%s\n", mrl, title);
1982
 
     play_item_t *play_item = play_item_new (title, mrl, 0, 0);
1983
 
     item = playlist_add (play_item, -1);
1984
 
+    SE_JS_FREE_ENCODED_STRING (cx, title);
1985
 
   }
1986
 
   else
1987
 
   {
1988
 
@@ -2195,14 +2194,15 @@ static JSBool js_playlist_add (JSContext
1989
 
     item = playlist_add_mrl (mrl, -1);
1990
 
   }
1991
 
 
1992
 
-  *rval = INT_TO_JSVAL (item);
1993
 
+  SE_JS_FREE_ENCODED_STRING (cx, mrl);
1994
 
+  JS_SET_RVAL (cx, vp, INT_TO_JSVAL (item));
1995
 
 
1996
 
   return JS_TRUE;
1997
 
 }
1998
 
 
1999
 
-static JSBool js_playlist_delete (JSContext *cx, JSObject *obj, uintN argc,
2000
 
-                                 jsval *argv, jsval *rval)
2001
 
+static JSBool js_playlist_delete (JSContext *cx, uintN argc, jsval *vp)
2002
 
 {
2003
 
+  jsval *argv = JS_ARGV (cx, vp);
2004
 
   se_log_fncall_checkinit ("playlist_remove");
2005
 
 
2006
 
   se_argc_check_range (1, 2, "playlist_remove");
2007
 
@@ -2227,14 +2227,14 @@ static JSBool js_playlist_delete (JSCont
2008
 
     gtk_list_store_remove (pl_store, &iter);
2009
 
   }
2010
 
 
2011
 
-  *rval = JSVAL_VOID;
2012
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2013
 
   return JS_TRUE;
2014
 
 }
2015
 
 
2016
 
-static JSBool js_playlist_play (JSContext *cx, JSObject *obj, uintN argc,
2017
 
-                               jsval *argv, jsval *rval)
2018
 
+static JSBool js_playlist_play (JSContext *cx, uintN argc, jsval *vp)
2019
 
 {
2020
 
   int32 item;
2021
 
+  jsval *argv = JS_ARGV (cx, vp);
2022
 
 
2023
 
   se_log_fncall_checkinit ("playlist_play");
2024
 
 
2025
 
@@ -2245,21 +2245,19 @@ static JSBool js_playlist_play (JSContex
2026
 
 
2027
 
   playlist_play (item);
2028
 
 
2029
 
-  *rval = JSVAL_VOID;
2030
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2031
 
   return JS_TRUE;
2032
 
 }
2033
 
 
2034
 
-static JSBool js_playlist_show (JSContext *cx, JSObject *obj, uintN argc,
2035
 
-                               jsval *argv, jsval *rval)
2036
 
+static JSBool js_playlist_show (JSContext *cx, uintN argc, jsval *vp)
2037
 
 {
2038
 
   se_log_fncall_checkinit ("playlist_show");
2039
 
   playlist_show ();
2040
 
-  *rval = JSVAL_VOID;
2041
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2042
 
   return JS_TRUE;
2043
 
 }
2044
 
 
2045
 
-static JSBool js_mrl_browser_refresh (JSContext *cx, JSObject *obj, uintN argc,
2046
 
-                                     jsval *argv, jsval *rval)
2047
 
+static JSBool js_mrl_browser_refresh (JSContext *cx, uintN argc, jsval *vp)
2048
 
 {
2049
 
   GtkTreeIter iter;
2050
 
   se_log_fncall_checkinit ("mrl_browser_refresh");
2051
 
@@ -2270,14 +2268,14 @@ static JSBool js_mrl_browser_refresh (JS
2052
 
       || !item_marked_current (&iter))
2053
 
   {
2054
 
     playlist_flush (PLAY_ITEM_BROWSER);
2055
 
-    *rval = JSVAL_VOID;
2056
 
+    JS_SET_RVAL (cx, vp, JSVAL_VOID);
2057
 
     return JS_TRUE;
2058
 
   }
2059
 
 
2060
 
   CUR_ITEM_LOCK ();
2061
 
   playlist_browse_set (cur_item ? : playlist_get_item (cur_list_pos));
2062
 
   CUR_ITEM_UNLOCK ();
2063
 
-  *rval = JSVAL_VOID;
2064
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2065
 
   return JS_TRUE;
2066
 
 }
2067
 
 
2068
 
@@ -2604,23 +2602,23 @@ void playlist_init (void)
2069
 
 
2070
 
   {
2071
 
     static const se_f_def_t defs[] = {
2072
 
-      { "playlist_show", js_playlist_show, 0, 0,
2073
 
+      { "playlist_show", js_playlist_show, 0, JSFUN_FAST_NATIVE,
2074
 
        SE_GROUP_DIALOGUE, NULL, NULL },
2075
 
-      { "playlist_clear", js_playlist_clear, 0, 0,
2076
 
+      { "playlist_clear", js_playlist_clear, 0, JSFUN_FAST_NATIVE,
2077
 
        SE_GROUP_PLAYLIST, NULL, NULL },
2078
 
-      { "playlist_flush", js_playlist_flush, 0, 0,
2079
 
+      { "playlist_flush", js_playlist_flush, 0, JSFUN_FAST_NATIVE,
2080
 
        SE_GROUP_PLAYLIST, NULL, NULL },
2081
 
-      { "playlist_load", js_playlist_load, 0, 0,
2082
 
+      { "playlist_load", js_playlist_load, 0, JSFUN_FAST_NATIVE,
2083
 
        SE_GROUP_PLAYLIST, N_("file"), NULL },
2084
 
-      { "playlist_add", js_playlist_add, 0, 0,
2085
 
+      { "playlist_add", js_playlist_add, 0, JSFUN_FAST_NATIVE,
2086
 
        SE_GROUP_PLAYLIST, N_("MRL[, title]"), NULL },
2087
 
-      { "playlist_delete", js_playlist_delete, 0, 0,
2088
 
+      { "playlist_delete", js_playlist_delete, 0, JSFUN_FAST_NATIVE,
2089
 
        SE_GROUP_PLAYLIST, N_("int"), NULL },
2090
 
-      { "playlist_play", js_playlist_play, 0, 0,
2091
 
+      { "playlist_play", js_playlist_play, 0, JSFUN_FAST_NATIVE,
2092
 
        SE_GROUP_PLAYLIST, N_("int"), N_("playlist entry number") },
2093
 
-      { "playlist_get_item", js_playlist_get_item, 0, 0,
2094
 
+      { "playlist_get_item", js_playlist_get_item, 0, JSFUN_FAST_NATIVE,
2095
 
        SE_GROUP_PLAYLIST, NULL, NULL },
2096
 
-      { "mrl_browser_refresh", js_mrl_browser_refresh, 0, 0,
2097
 
+      { "mrl_browser_refresh", js_mrl_browser_refresh, 0, JSFUN_FAST_NATIVE,
2098
 
        SE_GROUP_HIDDEN, NULL, NULL },
2099
 
       { NULL }
2100
 
     };
2101
 
--- gxine-0.5.905.orig/src/key_events.h
2102
 
+++ gxine-0.5.905/src/key_events.h
2103
 
@@ -52,8 +52,7 @@ void save_key_bindings (void);
2104
 
 /* returns xine event number (XINE_EVENT_*) or 0 on failure */
2105
 
 int kb_xine_event_lookup (const kb_xine_event_map_t *, const char *);
2106
 
 
2107
 
-JSBool js_event_generic (JSContext *, JSObject *, uintN argc, jsval *argv,
2108
 
-                        jsval *rval, const char *func,
2109
 
+JSBool js_event_generic (JSContext *, uintN argc, jsval *vp, const char *func,
2110
 
                         const char *const *mrlprefix, ...)
2111
 
                         __attribute__ ((sentinel));
2112
 
 
2113
 
--- gxine-0.5.905.orig/src/xml_widgets.c
2114
 
+++ gxine-0.5.905/src/xml_widgets.c
2115
 
@@ -186,13 +186,13 @@ stock_toggle_cb (GtkToggleButton *button
2116
 
     ui_set_status (UI_CURRENT_STATE);
2117
 
 }
2118
 
 
2119
 
-#define JS_WIDGET() ((se_o_t *)JS_GetPrivate (cx, obj))->user_data
2120
 
+#define JS_WIDGET() ((se_o_t *)JS_GetPrivate (cx, JS_THIS_OBJECT (cx, vp)))->user_data
2121
 
 
2122
 
 static JSBool
2123
 
-js_set_show (JSContext *cx, JSObject *obj,
2124
 
-            uintN argc, jsval *argv, jsval *rval)
2125
 
+js_set_show (JSContext *cx, uintN argc, jsval *vp)
2126
 
 {
2127
 
   int v, all = 0;
2128
 
+  jsval *argv = JS_ARGV (cx, vp);
2129
 
   se_log_fncall ("<widget>.set_show");
2130
 
   se_argc_check_range (1, 2, "<widget>.set_show");
2131
 
   se_arg_is_int_or_bool (0, "<widget>.set_show");
2132
 
@@ -210,28 +210,30 @@ js_set_show (JSContext *cx, JSObject *ob
2133
 
     gtk_widget_show (JS_WIDGET ());
2134
 
   else
2135
 
     gtk_widget_hide (JS_WIDGET ());
2136
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2137
 
   return JS_TRUE;
2138
 
 }
2139
 
 
2140
 
 static JSBool
2141
 
-js_set_sensitive (JSContext *cx, JSObject *obj,
2142
 
-                 uintN argc, jsval *argv, jsval *rval)
2143
 
+js_set_sensitive (JSContext *cx, uintN argc, jsval *vp)
2144
 
 {
2145
 
   int v;
2146
 
+  jsval *argv = JS_ARGV (cx, vp);
2147
 
   se_log_fncall ("<widget>.set_sensitive");
2148
 
   se_argc_check (1, "<widget>.set_sensitive");
2149
 
   se_arg_is_int_or_bool (0, "<widget>.set_sensitive");
2150
 
   JS_ValueToBoolean (cx, argv[0], &v);
2151
 
   gtk_widget_set_sensitive (JS_WIDGET (), v);
2152
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2153
 
   return JS_TRUE;
2154
 
 }
2155
 
 
2156
 
 static JSBool
2157
 
-js_activate (JSContext *cx, JSObject *obj,
2158
 
-            uintN argc, jsval *argv, jsval *rval)
2159
 
+js_activate (JSContext *cx, uintN argc, jsval *vp)
2160
 
 {
2161
 
   se_log_fncall ("<widget>.activate");
2162
 
   gtk_widget_activate (JS_WIDGET ());
2163
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2164
 
   return JS_TRUE;
2165
 
 }
2166
 
 
2167
 
@@ -1257,9 +1259,9 @@ widget_parse (xml_node_t *node)
2168
 
       se_o_t *se_widget;
2169
 
       char *se_name, *se_dot;
2170
 
       static const se_f_def_t defs[] = {
2171
 
-       { "set_show", js_set_show, 0, 0, SE_GROUP_HIDDEN, NULL, NULL },
2172
 
-       { "set_sensitive", js_set_sensitive, 0, 0, SE_GROUP_HIDDEN, NULL, NULL },
2173
 
-       { "activate", js_activate, 0, 0, SE_GROUP_HIDDEN, NULL, NULL },
2174
 
+       { "set_show", js_set_show, 0, JSFUN_FAST_NATIVE, SE_GROUP_HIDDEN, NULL, NULL },
2175
 
+       { "set_sensitive", js_set_sensitive, 0, JSFUN_FAST_NATIVE, SE_GROUP_HIDDEN, NULL, NULL },
2176
 
+       { "activate", js_activate, 0, JSFUN_FAST_NATIVE, SE_GROUP_HIDDEN, NULL, NULL },
2177
 
        { NULL }
2178
 
       };
2179
 
       if (!se_widget_space)
2180
 
--- gxine-0.5.905.orig/src/mediamarks.c
2181
 
+++ gxine-0.5.905/src/mediamarks.c
2182
 
@@ -680,30 +680,30 @@ void mm_save (void)
2183
 
   g_free(fname);
2184
 
 }
2185
 
 
2186
 
-static JSBool js_mm_add_show (JSContext *cx, JSObject *obj, uintN argc,
2187
 
-                             jsval *argv, jsval *rval)
2188
 
+static JSBool js_mm_add_show (JSContext *cx, uintN argc, jsval *vp)
2189
 
 {
2190
 
   /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
2191
 
   se_log_fncall_checkinit ("mm_add_show");
2192
 
   mm_add_show (NULL);
2193
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2194
 
   return JS_TRUE;
2195
 
 }
2196
 
 
2197
 
-static JSBool js_mm_manage_show (JSContext *cx, JSObject *obj, uintN argc,
2198
 
-                                jsval *argv, jsval *rval)
2199
 
+static JSBool js_mm_manage_show (JSContext *cx, uintN argc, jsval *vp)
2200
 
 {
2201
 
   /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
2202
 
   se_log_fncall_checkinit ("mm_manage_show");
2203
 
   mm_manage_show ();
2204
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2205
 
   return JS_TRUE;
2206
 
 }
2207
 
 
2208
 
-static JSBool js_import_mediamarks (JSContext *cx, JSObject *obj, uintN argc,
2209
 
-                                   jsval *argv, jsval *rval)
2210
 
+static JSBool js_import_mediamarks (JSContext *cx, uintN argc, jsval *vp)
2211
 
 {
2212
 
   /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
2213
 
   se_log_fncall_checkinit ("import_mediamarks");
2214
 
   mm_import ();
2215
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2216
 
   return JS_TRUE;
2217
 
 }
2218
 
 
2219
 
@@ -950,11 +950,11 @@ void mediamarks_init (void)
2220
 
 
2221
 
   {
2222
 
     static const se_f_def_t defs[] = {
2223
 
-      { "mm_add_show", js_mm_add_show, 0, 0,
2224
 
+      { "mm_add_show", js_mm_add_show, 0, JSFUN_FAST_NATIVE,
2225
 
        SE_GROUP_DIALOGUE, NULL, NULL },
2226
 
-      { "mm_manage_show", js_mm_manage_show, 0, 0,
2227
 
+      { "mm_manage_show", js_mm_manage_show, 0, JSFUN_FAST_NATIVE,
2228
 
        SE_GROUP_DIALOGUE, NULL, NULL },
2229
 
-      { "import_mediamarks", js_import_mediamarks, 0, 0,
2230
 
+      { "import_mediamarks", js_import_mediamarks, 0, JSFUN_FAST_NATIVE,
2231
 
        SE_GROUP_FILE, NULL, NULL },
2232
 
       { NULL }
2233
 
     };
2234
 
--- gxine-0.5.905.orig/src/engine.c
2235
 
+++ gxine-0.5.905/src/engine.c
 
29
--- gxine-0.5.907.orig/src/script_engine.c
 
30
+++ gxine-0.5.907/src/script_engine.c
 
31
@@ -855,6 +855,7 @@ SE_JS_PROPERTY_SETTER_DECLARE(generic_JS
 
32
        }
 
33
         if (!SE_JS_CALL_PROPERTY_SETTER_WITH_JSVAL (generic_JSSetProperty, cx, p->obj, dot, vp))
 
34
          *vp = OBJECT_TO_JSVAL (p->obj);
 
35
+        SE_JS_FREE_ENCODED_STRING (cx, prop);
 
36
        return JS_TRUE;
 
37
       }
 
38
     }
 
39
--- gxine-0.5.907.orig/src/engine.c
 
40
+++ gxine-0.5.907/src/engine.c
2236
41
@@ -30,7 +30,7 @@
2237
42
 #include <errno.h>
2238
43
 #include <unistd.h>
2242
47
 
2243
48
 #include "engine.h"
2244
49
 #include "ui.h"
2245
 
@@ -56,7 +56,7 @@ GAsyncQueue *js_queue;
2246
 
 static gboolean queue_available = FALSE;
2247
 
 
2248
 
 static JSBool
2249
 
-show_about (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
2250
 
+show_about (JSContext *cx, uintN argc, jsval *vp)
2251
 
 {
2252
 
   static const gchar *const authors[] = {
2253
 
     "Darren Salt <dsalt@users.sourceforge.net>",
2254
 
@@ -126,7 +126,7 @@ show_about (JSContext *cx, JSObject *obj
2255
 
   }
2256
 
 
2257
 
   window_show (about, NULL);
2258
 
-  *rval = JSVAL_VOID;
2259
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2260
 
   return JS_TRUE;
2261
 
 }
2262
 
 
2263
 
@@ -184,8 +184,10 @@ int engine_exec_obj (const char *cmd, se
2264
 
   if ((str = se_result_str (gse)))
2265
 
   {
2266
 
     /* JS output. Could end up in a terminal or the JS console. */
2267
 
+    char *free_str = str;
2268
 
     str = g_strdup_printf (_("result: %s"), str);
2269
 
     cb (cb_data, "%s", str);
2270
 
+    free (free_str);
2271
 
     free (str);
2272
 
   }
2273
 
   else if (se_result_double (gse, &num.d))
2274
 
@@ -405,12 +407,12 @@ se_startup_response_cb (GtkWidget *widge
2275
 
 }
2276
 
 
2277
 
 static JSBool
2278
 
-show_startup (JSContext *cx, JSObject *obj, uintN argc,
2279
 
-             jsval *argv, jsval *rval)
2280
 
+show_startup (JSContext *cx, uintN argc, jsval *vp)
2281
 
 {
2282
 
   if (!GTK_WIDGET_VISIBLE (se_startup_window))
2283
 
     reset_startup_buffer (se_startup_cmds);
2284
 
   window_show (se_startup_window, NULL);
2285
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2286
 
   return JS_TRUE;
2287
 
 }
2288
 
 
2289
 
@@ -439,8 +441,8 @@ void engine_init (void)
2290
 
   gse = se_new ();
2291
 
 
2292
 
   static const se_f_def_t defs[] = {
2293
 
-    { "about_show", show_about, 0, 0, SE_GROUP_DIALOGUE, NULL, NULL },
2294
 
-    { "startup_cmds_show", show_startup, 0, 0, SE_GROUP_DIALOGUE, NULL, NULL },
2295
 
+    { "about_show", show_about, 0, JSFUN_FAST_NATIVE, SE_GROUP_DIALOGUE, NULL, NULL },
2296
 
+    { "startup_cmds_show", show_startup, 0, JSFUN_FAST_NATIVE, SE_GROUP_DIALOGUE, NULL, NULL },
2297
 
     { NULL }
2298
 
   };
2299
 
   se_defuns (gse, gse->g, defs);
2300
 
--- gxine-0.5.905.orig/src/log_window.c
2301
 
+++ gxine-0.5.905/src/log_window.c
2302
 
@@ -220,11 +220,11 @@ static void switch_cb (GtkNotebook *note
2303
 
   gtk_dialog_set_response_sensitive ((GtkDialog *) win, GTK_RESPONSE_YES, !is_cp);
2304
 
 }
2305
 
 
2306
 
-static JSBool js_log_show (JSContext *cx, JSObject *obj, uintN argc,
2307
 
-                          jsval *argv, jsval *rval)
2308
 
+static JSBool js_log_show (JSContext *cx, uintN argc, jsval *vp)
2309
 
 {
2310
 
   se_log_fncall ("log_show");
2311
 
   log_window_show ();
2312
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2313
 
   return JS_TRUE;
2314
 
 }
2315
 
 
2316
 
@@ -379,7 +379,7 @@ void log_window_init (void)
2317
 
 
2318
 
   /* script engine functions */
2319
 
 
2320
 
-  se_defun (gse, NULL, "log_show", js_log_show, 0, 0,
2321
 
+  se_defun (gse, NULL, "log_show", js_log_show, 0, JSFUN_FAST_NATIVE,
2322
 
            SE_GROUP_DIALOGUE, NULL, NULL);
2323
 
 }
2324
 
 
2325
 
--- gxine-0.5.905.orig/src/vis.c
2326
 
+++ gxine-0.5.905/src/vis.c
2327
 
@@ -66,23 +66,26 @@ void vis_set (const char *str)
2328
 
     gtk_action_activate (action->data);
2329
 
 }
2330
 
 
2331
 
-static JSBool js_set_vis (JSContext *cx, JSObject *obj, uintN argc,
2332
 
-                         jsval *argv, jsval *rval)
2333
 
+static JSBool js_set_vis (JSContext *cx, uintN argc, jsval *vp)
2334
 
 {
2335
 
+  jsval *argv = JS_ARGV (cx, vp);
2336
 
   se_log_fncall ("js_set_vis");
2337
 
   se_argc_check (1, "set_vis");
2338
 
   se_arg_is_string (0, "set_vis");
2339
 
 
2340
 
   JSString *str = JS_ValueToString (cx, argv[0]);
2341
 
-  vis_set (JS_GetStringBytes (str));
2342
 
+  char *cstr = SE_JS_ENCODE_STRING (cx, str);
2343
 
+  vis_set (cstr);
2344
 
+  SE_JS_FREE_ENCODED_STRING (cx, cstr);
2345
 
 
2346
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2347
 
   return JS_TRUE;
2348
 
 }
2349
 
 
2350
 
 void vis_init (void)
2351
 
 {
2352
 
   xine_cfg_entry_t entry;
2353
 
-  se_defun (gse, NULL, "set_vis", js_set_vis, 0, 0,
2354
 
+  se_defun (gse, NULL, "set_vis", js_set_vis, 0, JSFUN_FAST_NATIVE,
2355
 
            SE_GROUP_ENGINE, N_("string"), N_("visualisation name"));
2356
 
   if (xine_config_lookup_entry (xine, "post_audio_plugin", &entry))
2357
 
     gtk_video_select_vis ((GtkVideo *)gtv, entry.str_value, &audio_port);
2358
 
--- gxine-0.5.905.orig/src/stream_info.c
2359
 
+++ gxine-0.5.905/src/stream_info.c
2360
 
@@ -180,12 +180,12 @@ static void response_cb (GtkDialog *dbox
2361
 
   }
2362
 
 }
2363
 
 
2364
 
-static JSBool js_stream_info_show (JSContext *cx, JSObject *obj, uintN argc,
2365
 
-                                  jsval *argv, jsval *rval)
2366
 
+static JSBool js_stream_info_show (JSContext *cx, uintN argc, jsval *vp)
2367
 
 {
2368
 
   /* se_t *se = (se_t *) JS_GetContextPrivate(cx); */
2369
 
   se_log_fncall_checkinit ("stream_info_show");
2370
 
   stream_info_show ();
2371
 
+  JS_SET_RVAL (cx, vp, JSVAL_VOID);
2372
 
   return JS_TRUE;
2373
 
 }
2374
 
 
2375
 
@@ -235,6 +235,6 @@ void stream_info_init (void)
2376
 
 
2377
 
   is_visible = FALSE;
2378
 
 
2379
 
-  se_defun (gse, NULL, "stream_info_show", js_stream_info_show, 0, 0,
2380
 
+  se_defun (gse, NULL, "stream_info_show", js_stream_info_show, 0, JSFUN_FAST_NATIVE,
2381
 
            SE_GROUP_DIALOGUE, N_("[bool]"), NULL);
2382
 
 }
2383
 
--- gxine-0.5.905.orig/src/console_output.h
2384
 
+++ gxine-0.5.905/src/console_output.h
 
50
--- gxine-0.5.907.orig/src/key_events.c
 
51
+++ gxine-0.5.907/src/key_events.c
 
52
@@ -1336,7 +1336,7 @@ static JSBool js_event (JSContext *cx, u
 
53
 
 
54
 static JSBool js_vdr (JSContext *cx, uintN argc, jsval *vp)
 
55
 {
 
56
-  const char *const prefixes[] = { "vdr:/", "netvdr:/", NULL };
 
57
+  const char *const prefixes[] = { "vdr:/", "netvdr:/", "xvdr:/", NULL };
 
58
   return js_event_generic (cx, argc, vp, "vdr", prefixes,
 
59
                           &xine_vdr, NULL);
 
60
 }
 
61
--- gxine-0.5.907.orig/src/Makefile.am
 
62
+++ gxine-0.5.907/src/Makefile.am
 
63
@@ -53,7 +53,7 @@ gxine_SOURCES = \
 
64
 gxine_LDADD = $(XINE_LIBS) $(GTK2_LIBS) $(GTHREAD2_LIBS) \
 
65
              $(JS_LIBS) $(HAL_LIBS) $(UDEV_LIBS) $(DBUS_LIBS) $(LIRC_LIBS) \
 
66
              $(X_LIBS) $(X_EXTRA_LIBS) $(XEXT_LIBS) $(XTEST_LIBS) \
 
67
-             $(XINERAMA_LIBS) $(XRANDR_LIBS) $(XCB_LIBS)
 
68
+             $(XINERAMA_LIBS) $(XRANDR_LIBS) $(XCB_LIBS) -ldl -lm
 
69
 
 
70
 gxine_client_SOURCES = client.c console_output.c
 
71
 
 
72
--- gxine-0.5.907.orig/src/console_output.h
 
73
+++ gxine-0.5.907/src/console_output.h
2385
74
@@ -21,7 +21,7 @@
2386
75
 #ifndef GXINE_CONSOLE_OUTPUT_H
2387
76
 #define GXINE_CONSOLE_OUTPUT_H
2391
80
 
2392
81
 void console_output_init (void);
2393
82
 
2394
 
--- gxine-0.5.905.orig/src/main.c
2395
 
+++ gxine-0.5.905/src/main.c
2396
 
@@ -45,7 +45,6 @@
2397
 
 #include <gdk/gdkx.h>
 
83
--- gxine-0.5.907.orig/src/main.c
 
84
+++ gxine-0.5.907/src/main.c
 
85
@@ -46,7 +46,6 @@
 
86
 #include <gdk/gdk.h>
2398
87
 #include <gdk/gdkkeysyms.h>
2399
88
 #include <glib.h>
2400
89
-#include <glib/gmessages.h>
2401
90
 
2402
91
 #include "desktop_integration.h"
2403
92
 #include "engine.h"
 
93
--- gxine-0.5.907.orig/src/Makefile.in
 
94
+++ gxine-0.5.907/src/Makefile.in
 
95
@@ -377,7 +377,7 @@ gxine_SOURCES = \
 
96
 gxine_LDADD = $(XINE_LIBS) $(GTK2_LIBS) $(GTHREAD2_LIBS) \
 
97
              $(JS_LIBS) $(HAL_LIBS) $(UDEV_LIBS) $(DBUS_LIBS) $(LIRC_LIBS) \
 
98
              $(X_LIBS) $(X_EXTRA_LIBS) $(XEXT_LIBS) $(XTEST_LIBS) \
 
99
-             $(XINERAMA_LIBS) $(XRANDR_LIBS) $(XCB_LIBS)
 
100
+             $(XINERAMA_LIBS) $(XRANDR_LIBS) $(XCB_LIBS) -ldl -lm
 
101
 
 
102
 gxine_client_SOURCES = client.c console_output.c
 
103
 gxine_client_CFLAGS = $(AM_CFLAGS) -DGXINE_CLIENT