Displaying 20 results from an estimated 41 matches for "jsval_is_object".
2007 Mar 05
0
5 commits - libswfdec/swfdec_js.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c test/trace
...ontext *cx,
if (JS_GetClass (object) != &js_FunctionClass)
goto fail;
clasp = ((JSFunction *) JS_GetPrivate (cx, object))->clasp;
- object = JS_NewObject (cx, clasp, NULL, NULL);
+ if (!JS_GetProperty (cx, object, "prototype", &proto))
+ return JS_FALSE;
+ if (!JSVAL_IS_OBJECT (proto)) {
+ SWFDEC_ERROR ("prototype of %s is not an object", name);
+ }
+ object = JS_NewObject (cx, clasp, JSVAL_IS_OBJECT (proto) ? JSVAL_TO_OBJECT (proto) : NULL, NULL);
if (object == NULL)
return JS_FALSE;
fp->sp[-2] = OBJECT_TO_JSVAL (object);
@@ -1436,7 +1441,7...
2007 Mar 09
0
17 commits - libswfdec/js libswfdec/swfdec_js.c libswfdec/swfdec_js_global.c libswfdec/swfdec_js.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_movie.c libswfdec/swfdec_player.c libswfdec/swfdec_player_internal.h libswfdec/swfdec_root_movie.c
...+static JSBool
+swfdec_js_object_register_class (JSContext *cx, JSObject *obj, uintN argc,
+ jsval *argv, jsval *rval)
+{
+ SwfdecPlayer *player = JS_GetContextPrivate (cx);
+ const char *name;
+
+ name = swfdec_js_to_string (cx, argv[0]);
+ if (name == NULL)
+ return JS_FALSE;
+ if (!JSVAL_IS_OBJECT(argv[1]))
+ return JS_FALSE;
+
+ swfdec_player_set_export_class (player, name, argv[1]);
+ return JS_TRUE;
+}
+
+static JSFunctionSpec static_object_methods[] = {
+ { "registerClass", swfdec_js_object_register_class, 2, 0, 0 },
+ { NULL, NULL, 0, 0, 0 }
+};
+
void
swfdec_js_...
2007 Sep 28
1
SwfDec in Windows
.../Administrador/swfdec-0.4.3/libswfdec/js/jsapi.c:598:
undefined reference to '_imp__js_FunctionClass'
The lines are:
JS_PUBLIC_API(JSType)
JS_TypeOfValue(JSContext *cx, jsval v)
{
JSType type;
JSObject *obj;
JSObjectOps *ops;
JSClass *clasp;
CHECK_REQUEST(cx);
if (JSVAL_IS_OBJECT(v)) {
/* XXX JSVAL_IS_OBJECT(v) is true for null too! Can we change ECMA? */
obj = JSVAL_TO_OBJECT(v);
if (obj &&
(ops = obj->map->ops,
ops == &js_ObjectOps //***ERROR IN THIS LINE****/
? (clasp = OBJ_GET_CLASS(cx, obj...
2007 Jan 31
0
Branch 'interpreter' - 20 commits - autogen.sh configure.ac libswfdec/js libswfdec/swfdec_debug.h libswfdec/swfdec_js.c libswfdec/swfdec_js_color.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_movie.c libswfdec/swfdec_movie.h libswfdec/swfdec_script.c
...- g_assert (movie);
+ if (!movie)
+ return JS_TRUE;
if (!JS_ValueToECMAUint32 (cx, argv[0], &color))
return JS_TRUE;
@@ -117,8 +120,9 @@ swfdec_js_color_set_transform (JSContext
JSObject *parse;
SwfdecMovie *movie = JS_GetPrivate (cx, obj);
- g_assert (movie);
- if (!JSVAL_IS_OBJECT (argv[0]))
+ if (!movie)
+ return JS_TRUE;
+ if (!movie)
return JS_TRUE;
parse = JSVAL_TO_OBJECT (argv[0]);
parse_property (cx, parse, "ra", &movie->color_transform.ra, TRUE);
@@ -161,7 +165,6 @@ swfdec_js_color_finalize (JSContext *cx,
SwfdecMovie *movie;
m...
2007 Apr 04
0
Branch 'as' - 4 commits - libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_interpret.h libswfdec/swfdec_as_object.c libswfdec/swfdec_as_types.c libswfdec/swfdec_as_types.h
...n (d);
+ } else if (JSVAL_IS_STRING (val)) {
+ double d;
+ if (!JS_ValueToNumber (cx, val, &d))
+ return 0;
+ return d != 0.0 && !isnan (d);
+ } else if (JSVAL_IS_NULL (val)) {
+ return JS_FALSE;
+ } else if (JSVAL_IS_VOID (val)) {
+ return JS_FALSE;
+ } else if (JSVAL_IS_OBJECT (val)) {
+ return JS_TRUE;
+ }
+ g_assert_not_reached ();
+ return JS_FALSE;
+}
+
+static void
+swfdec_value_to_boolean_7 (SwfdecAsContext *cx, jsval val)
+{
+ if (JSVAL_IS_BOOLEAN (val)) {
+ return JSVAL_TO_BOOLEAN (val);
+ } else if (JSVAL_IS_INT (val)) {
+ return JSVAL_TO_INT (val)...
2007 Mar 07
1
2 commits - libswfdec/swfdec_script.c test/trace
libswfdec/swfdec_script.c | 14 ++++++++++++--
test/trace/Makefile.am | 2 ++
test/trace/gotoframe.swf |binary
test/trace/gotoframe.swf.trace | 13 +++++++++++++
4 files changed, 27 insertions(+), 2 deletions(-)
New commits:
diff-tree 12348410a3509928a6e8e4c8ca00292a58ff542c (from 46e62d4410c20c19774a45758d8ebf11cd0bdf96)
Author: Benjamin Otte <otte@gnome.org>
2007 Feb 01
0
Branch 'interpreter' - 9 commits - libswfdec/js libswfdec/swfdec_script.c libswfdec/swfdec_script.h player/swfdec_debug_stack.c test/trace
...libswfdec/swfdec_script.c
index ad08eef..39b3b8b 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -161,7 +161,7 @@ swfdec_action_to_number (JSContext *cx,
static JSBool
swfdec_value_to_number_7 (JSContext *cx, jsval val, double *d)
{
- if (JSVAL_IS_NULL (val)) {
+ if (JSVAL_IS_OBJECT (val)) {
*d = *cx->runtime->jsNaN;
return JS_TRUE;
} else {
@@ -550,8 +550,10 @@ swfdec_action_call_function (JSContext *
JSStackFrame *fp = cx->fp;
const char *s;
guint32 n_args;
- JSObject *obj;
+ JSObject *obj, *pobj;
+ JSProperty *prop;
jsval fun;
+ JSAtom...
2007 Jul 13
0
4 commits - configure.ac libswfdec/swfdec_as_internal.h libswfdec/swfdec_as_object.h libswfdec/swfdec_scriptable.c libswfdec/swfdec_scriptable.h NEWS
...rns: the scriptable represented by @val or NULL if @val does not
- * reference a @scriptable
- **/
-gpointer
-swfdec_scriptable_from_jsval (JSContext *cx, jsval val, GType type)
-{
- JSObject *object;
-
- g_return_val_if_fail (g_type_is_a (type, SWFDEC_TYPE_SCRIPTABLE), NULL);
-
- if (!JSVAL_IS_OBJECT (val))
- return NULL;
- object = JSVAL_TO_OBJECT (val);
- return swfdec_scriptable_from_object (cx, object, type);
-}
-
-/**
- * swfdec_scriptable_set_variables:
- * @script: a #SwfdecScriptable
- * @variables: variables to set on @script in application-x-www-form-urlencoded
- * f...
2007 May 29
0
Branch 'as' - 6 commits - libswfdec/swfdec_as_interpret.c libswfdec/swfdec_js_xml.c libswfdec/swfdec_tag.c player/swfplay.c
...}
-#if 0
static void
swfdec_action_delete (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
{
+ SwfdecAsValue *val;
const char *name;
- cx->fp->sp -= 2;
- name = swfdec_js_to_string (cx, cx->fp->sp[1]);
- if (name == NULL)
- return JS_FALSE;
- if (!JSVAL_IS_OBJECT (cx->fp->sp[0]))
- return JS_TRUE;
- return JS_DeleteProperty (cx, JSVAL_TO_OBJECT (cx->fp->sp[0]), name);
+ name = swfdec_as_value_to_string (cx, swfdec_as_stack_pop (cx->frame->stack));
+ val = swfdec_as_stack_pop (cx->frame->stack);
+ if (SWFDEC_AS_VALUE_IS_OBJECT...
2007 Mar 20
0
9 commits - configure.ac libswfdec/swfdec_bits.c libswfdec/swfdec_debug.c libswfdec/swfdec_js.c libswfdec/swfdec_script.c libswfdec/swfdec_sound.c
...}
+#endif
return JS_TRUE;
}
@@ -1066,14 +1076,24 @@ static JSBool
swfdec_action_get_member (JSContext *cx, guint action, const guint8 *data, guint len)
{
const char *s;
+ jsval o;
s = swfdec_js_to_string (cx, cx->fp->sp[-1]);
if (s == NULL)
return JS_FALSE;
- if (JSVAL_IS_OBJECT (cx->fp->sp[-2]) && !JSVAL_IS_NULL (cx->fp->sp[-2])) {
- if (!JS_GetProperty (cx, JSVAL_TO_OBJECT (cx->fp->sp[-2]), s, &cx->fp->sp[-2]))
- return JS_FALSE;
+ o = cx->fp->sp[-2];
+ if (JSVAL_IS_OBJECT (o) && !JSVAL_IS_NULL (o)) {
+ if (!...
2007 Jan 29
0
Branch 'interpreter' - 18 commits - libswfdec/swfdec_image.c libswfdec/swfdec_image.h libswfdec/swfdec_js.c libswfdec/swfdec_js_color.c libswfdec/swfdec_js_sound.c libswfdec/swfdec_pattern.c libswfdec/swfdec_scriptable.c libswfdec/swfdec_script.c
...tor))
+ return JS_FALSE;
+ if (!JS_ValueToECMAUint32 (cx, fp->sp[-2], &n_args))
+ return JS_FALSE;
+ if ((guint) (fp->sp - fp->spbase) < n_args + 2) {
+ SWFDEC_ERROR ("not enough stack space");
+ return JS_FALSE;
+ }
+ fp->sp[-1] = constructor;
+
+ if (!JSVAL_IS_OBJECT (constructor))
+ goto fail;
+ object = JSVAL_TO_OBJECT (constructor);
+ if (JS_GetClass (object) != &js_FunctionClass)
+ goto fail;
+ clasp = ((JSFunction *) JS_GetPrivate (cx, object))->clasp;
+ object = JS_NewObject (cx, clasp, NULL, NULL);
+ if (object == NULL)
+ return JS_F...
2007 Feb 19
0
2 commits - libswfdec/swfdec_script.c test/swfdec-extract.c
...wfdec/swfdec_script.c b/libswfdec/swfdec_script.c
index 824861b..f8a9623 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -675,6 +675,9 @@ swfdec_action_call_method (JSContext *cx
} else {
if (!JS_GetProperty (cx, obj, s, &fun))
return JS_FALSE;
+ if (!JSVAL_IS_OBJECT (fun)) {
+ SWFDEC_WARNING ("%s:%s is not a function", JS_GetClass (obj)->name, s);
+ }
}
fp->sp--;
fp->sp[-1] = fun;
diff-tree 842b4b558af7b8ad68f47fd7473989fc46fd23d6 (from 185d07d2ed05ec0bf1970484d27642703177702e)
Author: Benjamin Otte <otte@gnome.org>
Da...
2007 Feb 22
0
6 commits - libswfdec/Makefile.am libswfdec/swfdec_js.c libswfdec/swfdec_js_mouse.c libswfdec/swfdec_listener.c libswfdec/swfdec_listener.h libswfdec/swfdec_movie.c libswfdec/swfdec_player.c libswfdec/swfdec_player_internal.h libswfdec/swfdec_root_movie.c
....h"
+#include "swfdec_listener.h"
#include "swfdec_player_internal.h"
static JSBool
+swfdec_js_mouse_add_listener (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+ SwfdecPlayer *player = JS_GetContextPrivate (cx);
+
+ g_assert (player);
+ if (!JSVAL_IS_OBJECT (argv[0]) || argv[0] == JSVAL_NULL)
+ return JS_TRUE;
+ return swfdec_listener_add (player->mouse_listener, JSVAL_TO_OBJECT (argv[0]));
+}
+
+static JSBool
+swfdec_js_mouse_remove_listener (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+ SwfdecPlayer *player = JS_Ge...
2007 Mar 21
0
4 commits - libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c player/swfdec_slow_loader.c
...ipt.c
index 06915d0..d96ec0f 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -265,8 +265,12 @@ swfdec_value_to_number (JSContext *cx, j
double d;
if (!JS_ValueToNumber (cx, val, &d))
return 0;
- return isnan (d) ? 0 : d;
+ return d;
} else if (JSVAL_IS_OBJECT(val) && (((SwfdecScript *) cx->fp->swf)->version >= 6)) {
+ /* Checking for version 6 is completely wrong, but a lot of the testsuite
+ * depends on it (oops).
+ * The code calls the valueOf function and returns 0 if no such function exists.
+ */
return JSVA...
2007 Feb 06
0
109 commits - configure.ac libswfdec/js libswfdec/Makefile.am libswfdec/swfdec_bits.c libswfdec/swfdec_bits.h libswfdec/swfdec_buffer.c libswfdec/swfdec_button_movie.c libswfdec/swfdec_codec_screen.c libswfdec/swfdec_color.c libswfdec/swfdec_color.h
...libswfdec/swfdec_script.c
index ad08eef..39b3b8b 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -161,7 +161,7 @@ swfdec_action_to_number (JSContext *cx,
static JSBool
swfdec_value_to_number_7 (JSContext *cx, jsval val, double *d)
{
- if (JSVAL_IS_NULL (val)) {
+ if (JSVAL_IS_OBJECT (val)) {
*d = *cx->runtime->jsNaN;
return JS_TRUE;
} else {
@@ -550,8 +550,10 @@ swfdec_action_call_function (JSContext *
JSStackFrame *fp = cx->fp;
const char *s;
guint32 n_args;
- JSObject *obj;
+ JSObject *obj, *pobj;
+ JSProperty *prop;
jsval fun;
+ JSAtom...
2007 Jun 01
0
Branch 'as' - 2 commits - libswfdec/Makefile.am libswfdec/swfdec_as_strings.c libswfdec/swfdec_as_types.c libswfdec/swfdec_interval.c libswfdec/swfdec_interval.h libswfdec/swfdec_player_as.c libswfdec/swfdec_player.c
...*timeout)
-{
- SwfdecAsInterval *interval = (SwfdecAsInterval *) timeout;
- JSContext *cx = interval->player->jscx;
- SwfdecAsValue fun, rval;
-
- timeout->timestamp += SWFDEC_MSECS_TO_TICKS (interval->msecs);
- swfdec_player_add_timeout (interval->player, timeout);
- g_assert (JSVAL_IS_OBJECT (interval->vals[1]));
- if (JSVAL_IS_STRING (interval->vals[0])) {
- JSAtom *atom = js_AtomizeString (cx, JSVAL_TO_STRING (interval->vals[0]), 0);
- if (!atom)
- return;
- if (!js_GetProperty (cx, JSVAL_TO_OBJECT (interval->vals[1]),
- (jsid) atom, &fun))
- ret...
2007 Jan 26
0
Branch 'interpreter' - 9 commits - libswfdec/js libswfdec/Makefile.am libswfdec/swfdec_debugger.c libswfdec/swfdec_debugger.h libswfdec/swfdec_edittext_movie.c libswfdec/swfdec_event.c libswfdec/swfdec_js.c libswfdec/swfdec_js_global.c
..."%s\" on %p", str, obj);
@@ -361,12 +359,10 @@ swfdec_js_eval_internal (JSContext *cx,
goto out;
obj = cx->fp->thisp;
}
- cur = OBJECT_TO_JSVAL (obj);
while (str != NULL && *str != '\0') {
char *dot = strchr (str, '.');
if (!JSVAL_IS_OBJECT (cur))
goto out;
- obj = JSVAL_TO_OBJECT (cur);
if (dot) {
if (!swfdec_js_eval_get_property (cx, obj, str, dot - str, &cur))
goto out;
@@ -381,6 +377,7 @@ swfdec_js_eval_internal (JSContext *cx,
}
str = NULL;
}
+ obj = JSVAL_TO_OBJECT (cur);
}...
2007 Feb 19
0
22 commits - libswfdec/js libswfdec/swfdec_debugger.c libswfdec/swfdec_js.c libswfdec/swfdec_js_global.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_movie.c libswfdec/swfdec_player.c libswfdec/swfdec_player_internal.h libswfdec/swfdec_script.c
...Timeout *timeout)
+{
+ SwfdecJSInterval *interval = (SwfdecJSInterval *) timeout;
+ JSContext *cx = interval->player->jscx;
+ jsval fun, rval;
+
+ timeout->timestamp += SWFDEC_MSECS_TO_TICKS (interval->msecs);
+ swfdec_player_add_timeout (interval->player, timeout);
+ g_assert (JSVAL_IS_OBJECT (interval->vals[1]));
+ if (JSVAL_IS_STRING (interval->vals[0])) {
+ JSAtom *atom = js_AtomizeString (cx, JSVAL_TO_STRING (interval->vals[0]), 0);
+ if (!atom)
+ return;
+ if (!js_GetProperty (cx, JSVAL_TO_OBJECT (interval->vals[1]),
+ (jsid) atom, &fun))
+ ret...
2007 Feb 22
0
3 commits - libswfdec/swfdec_js.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c
.../* evaluate relative to this to not get trapped by previous SetTarget calls */
- target = swfdec_js_eval (cx, cx->fp->thisp, (const char *) data);
+ if (*data == '\0')
+ return swfdec_action_do_unset_target (cx);
+ target = swfdec_js_eval (cx, NULL, (const char *) data);
if (!JSVAL_IS_OBJECT (target) || JSVAL_IS_NULL (target)) {
SWFDEC_WARNING ("target is not an object");
return JS_TRUE;
@@ -2601,7 +2628,7 @@ swfdec_script_execute (SwfdecScript *scr
frame.callobj = NULL;
frame.script = NULL;
- frame.varobj = frame.argsobj = NULL;
+ frame.argsobj = NULL;...
2007 Apr 05
0
Branch 'as' - 9 commits - configure.ac libswfdec/swfdec_as_context.c libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_function.h libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h
...(SwfdecAsContext *c
}
static void
-swfdec_action_get_member (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
-{
- const char *s;
- jsval o;
-
- s = swfdec_js_to_string (cx, cx->fp->sp[-1]);
- if (s == NULL)
- return JS_FALSE;
-
- o = cx->fp->sp[-2];
- if (JSVAL_IS_OBJECT (o) && !JSVAL_IS_NULL (o)) {
- if (!JS_GetProperty (cx, JSVAL_TO_OBJECT (o), s, &cx->fp->sp[-2]))
- return JS_FALSE;
-#ifdef SWFDEC_WARN_MISSING_PROPERTIES
- if (cx->fp->sp[-2] == JSVAL_VOID) {
- const JSClass *clasp = JS_GetClass (JSVAL_TO_OBJECT (o));
-...