Displaying 20 results from an estimated 32 matches for "jsval_to_object".
Did you mean:
jsval_is_object
2007 Mar 05
0
5 commits - libswfdec/swfdec_js.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c test/trace
...bject (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 @@ swfdec_action_new_method (JSContext *cx,
const char *s;
guint32 n_args;
JSObject *object;
- jsval constructor;
+ jsval constructor, proto;
const JSCla...
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 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
...x, 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_FALSE;
+ fp->sp[-2] = OBJECT_TO_JSVAL (object);
+ if (!...
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
...x, jsobj, (jsid) prop->id, &val))
+ return JS_FALSE;
+ } else {
+ movie = swfdec_scriptable_from_jsval (cx, val, SWFDEC_TYPE_MOVIE);
+ if (movie == NULL) {
+ SWFDEC_WARNING ("specified target does not reference a movie clip");
+ goto out;
+ }
+
+ jsobj = JSVAL_TO_OBJECT (val);
+ val = JSVAL_VOID;
+
+ if (!JS_GetProperty (cx, jsobj, properties[id], &val))
+ return JS_FALSE;
+ }
+
+out:
+ cx->fp->sp -= 1;
+ cx->fp->sp[-1] = val;
+ return JS_TRUE;
+}
+
+static void
+swfdec_action_set_property (SwfdecAsContext *cx, guint action, const gu...
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
...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 (!JS_GetProperty (cx, JSVAL_TO_OBJECT (o), s, &cx->fp->sp[-2]))
+ return JS_FALSE;
+#ifdef SWFDEC_WARN_MISSI...
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
...R ("failed to initialize global object");
}
+ if (!JS_GetProperty (player->jscx, player->jsobj, "Object", &val)) {
+ SWFDEC_ERROR ("failed to get 'Object'");
+ }
+ g_assert (JSVAL_IS_OBJECT (val));
+ if (!JS_DefineFunctions (player->jscx, JSVAL_TO_OBJECT (val), static_object_methods)) {
+ SWFDEC_ERROR ("failed to set static Object methods");
+ }
}
diff-tree 6d91b775a72e20ccb85501a00a0c326109e5750a (from 66e2f04e58065e21a104926ef350b7ec65c40249)
Author: Benjamin Otte <otte@gnome.org>
Date: Fri Mar 9 09:44:22 2007 +0100...
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
...x, jsobj, (jsid) prop->id, &val))
- return JS_FALSE;
- } else {
- movie = swfdec_scriptable_from_jsval (cx, val, SWFDEC_TYPE_MOVIE);
- if (movie == NULL) {
- SWFDEC_WARNING ("specified target does not reference a movie clip");
- goto out;
- }
-
- jsobj = JSVAL_TO_OBJECT (val);
- val = JSVAL_VOID;
-
- if (!JS_GetProperty (cx, jsobj, properties[id], &val))
- return JS_FALSE;
- }
-
-out:
- cx->fp->sp -= 1;
- cx->fp->sp[-1] = val;
- return JS_TRUE;
-}
-
-static void
-swfdec_action_set_property (SwfdecAsContext *cx, guint action, const gu...
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
...al 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
- * format
- *
- * Verifies @variables to be encoded corr...
2007 Sep 28
1
SwfDec in Windows
...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),
clasp->call || clasp == &js_FunctionClass)
: ops->call != NULL)) {...
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
...layer_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))
- return;
- } else {
- fun = interval->vals[0];
- }
- js_InternalCall (cx, JSVAL_TO_OBJECT (interval->vals[1]), fun,
- interval->n_args, &interval->vals[2], &rval);
-}
-
-static SwfdecAsInterval *
-swfdec_js_int...
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
...< 0 ?
cx->runtime->jsNegativeInfinity :
cx->runtime->jsPositiveInfinity);
@@ -790,14 +800,6 @@ swfdec_action_add2_7 (JSContext *cx, gui
rval = cx->fp->sp[-1];
lval = cx->fp->sp[-2];
- if (!JSVAL_IS_PRIMITIVE (rval)) {
- if (!OBJ_DEFAULT_VALUE (cx, JSVAL_TO_OBJECT (rval), 0 , &rval))
- return JS_FALSE;
- }
- if (!JSVAL_IS_PRIMITIVE (lval)) {
- if (!OBJ_DEFAULT_VALUE (cx, JSVAL_TO_OBJECT (lval), 0 , &lval))
- return JS_FALSE;
- }
if ((cond = JSVAL_IS_STRING (lval)) || JSVAL_IS_STRING (rval)) {
JSString *str, *str2;
if (con...
2007 Feb 22
0
3 commits - libswfdec/swfdec_js.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c
...vie = swfdec_scriptable_from_jsval (cx, val, SWFDEC_TYPE_MOVIE);
+ if (movie == NULL) {
+ SWFDEC_WARNING ("specified target does not reference a movie clip");
+ goto out;
+ }
- if (!JS_GetProperty (cx, jsobj, properties[id], &val))
- return JS_FALSE;
+ jsobj = JSVAL_TO_OBJECT (val);
+ val = JSVAL_VOID;
+
+ if (!JS_GetProperty (cx, jsobj, properties[id], &val))
+ return JS_FALSE;
+ }
out:
cx->fp->sp -= 1;
@@ -767,23 +786,26 @@ swfdec_action_set_property (JSContext *c
SwfdecMovie *movie;
JSObject *jsobj;
guint32 id;
+ const char *byte...
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
...+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);
}
if (obj == NULL) {
if (cx->fp == NULL)
di...
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
...dd_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_GetContextPrivate (cx);
+
+ g_assert (player);
+ if (!JSVAL_IS_OBJECT (argv[0]) || argv[0] == JSVAL_NULL)
+ return JS_TRUE;
+ s...
2007 Apr 12
0
Branch 'as' - 15 commits - libswfdec/swfdec_as_context.c libswfdec/swfdec_as_context.h libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_function.c libswfdec/swfdec_as_function.h libswfdec/swfdec_as_interpret.c
...ltype == SWFDEC_TYPE_AS_NULL) {
+ cond = (rtype == SWFDEC_TYPE_AS_UNDEFINED || rtype == SWFDEC_TYPE_AS_NULL);
+ } else if (rtype == SWFDEC_TYPE_AS_UNDEFINED || rtype == SWFDEC_TYPE_AS_NULL) {
+ cond = FALSE;
} else {
- if (ltag == JSVAL_OBJECT) {
- if (!OBJ_DEFAULT_VALUE (cx, JSVAL_TO_OBJECT(lval), 0, &lval))
- return JS_FALSE;
- ltag = JSVAL_TAG(lval);
- } else if (rtag == JSVAL_OBJECT) {
- if (!OBJ_DEFAULT_VALUE (cx, JSVAL_TO_OBJECT(rval), 0, &rval))
- return JS_FALSE;
- rtag = JSVAL_TAG(rval);
- }
- if (ltag == JSVAL_STRING && rtag == JSVAL_STRING)...
2007 Jan 25
0
Branch 'interpreter' - 28 commits - configure.ac libswfdec/js libswfdec/swfdec_buffer.c libswfdec/swfdec_edittext_movie.c libswfdec/swfdec_js.c libswfdec/swfdec_js_global.c libswfdec/swfdec_js.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_player.c
...return;
if (text->text->variable_prefix) {
- val = swfdec_js_eval (parent->jscx, jsobj, text->text->variable_prefix);
+ val = swfdec_js_eval (parent->jscx, jsobj, text->text->variable_prefix, FALSE);
if (!JSVAL_IS_OBJECT (val))
return;
jsobj = JSVAL_TO_OBJECT (val);
diff --git a/libswfdec/swfdec_js.c b/libswfdec/swfdec_js.c
index cf14f65..bbd6a43 100644
--- a/libswfdec/swfdec_js.c
+++ b/libswfdec/swfdec_js.c
@@ -300,29 +300,26 @@ fail:
static JSBool
swfdec_js_eval_get_property (JSContext *cx, JSObject *obj,
- const char *name, gboolean initial,...
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
...< 0 ?
cx->runtime->jsNegativeInfinity :
cx->runtime->jsPositiveInfinity);
@@ -790,14 +800,6 @@ swfdec_action_add2_7 (JSContext *cx, gui
rval = cx->fp->sp[-1];
lval = cx->fp->sp[-2];
- if (!JSVAL_IS_PRIMITIVE (rval)) {
- if (!OBJ_DEFAULT_VALUE (cx, JSVAL_TO_OBJECT (rval), 0 , &rval))
- return JS_FALSE;
- }
- if (!JSVAL_IS_PRIMITIVE (lval)) {
- if (!OBJ_DEFAULT_VALUE (cx, JSVAL_TO_OBJECT (lval), 0 , &lval))
- return JS_FALSE;
- }
if ((cond = JSVAL_IS_STRING (lval)) || JSVAL_IS_STRING (rval)) {
JSString *str, *str2;
if (con...
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
...lor))
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;
movie = JS_GetPrivate (cx, obj);
- /* since we also finalize the class, not everyone has a private object */...
2007 Jan 16
0
9 commits - libswfdec/js libswfdec/Makefile.am libswfdec/swfdec_audio_stream.c libswfdec/swfdec_audio_stream.h libswfdec/swfdec_cache.c libswfdec/swfdec_cached.c libswfdec/swfdec_cached.h libswfdec/swfdec_edittext_movie.c libswfdec/swfdec_image.c
...NULL)
+ return;
if (text->text->variable_prefix) {
- val = swfdec_js_eval (player->jscx, object, text->text->variable_prefix);
+ val = swfdec_js_eval (parent->jscx, jsobj, text->text->variable_prefix);
if (!JSVAL_IS_OBJECT (val))
return;
- object = JSVAL_TO_OBJECT (val);
+ jsobj = JSVAL_TO_OBJECT (val);
}
- if (!JS_GetProperty (player->jscx, object, text->text->variable_name, &val))
+ if (!JS_GetProperty (parent->jscx, jsobj, text->text->variable_name, &val))
return;
if (!JSVAL_IS_VOID (val)) {
- const char *s = s...
2007 Feb 16
0
11 commits - libswfdec/swfdec_font.c libswfdec/swfdec_font.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c libswfdec/swfdec_script.h test/.gitignore test/trace
...action_push (JSContext *cx, guint
return JS_FALSE;
break;
}
- case 4: /* register */
default:
SWFDEC_ERROR ("Push: type %u not implemented", type);
return JS_FALSE;
@@ -1658,9 +1676,34 @@ swfdec_action_delete (JSContext *cx, gui
return JS_DeleteProperty (cx, JSVAL_TO_OBJECT (cx->fp->sp[0]), name);
}
+static JSBool
+swfdec_action_store_register (JSContext *cx, guint action, const guint8 *data, guint len)
+{
+ if (len != 1) {
+ SWFDEC_ERROR ("StoreRegister action requires a length of 1, but got %u", len);
+ return JS_FALSE;
+ }
+ if (!swfdec_...