search for: js_getproperty

Displaying 20 results from an estimated 26 matches for "js_getproperty".

2007 Mar 05
0
5 commits - libswfdec/swfdec_js.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c test/trace
...const JSClass *clasp; guint n_args; @@ -1414,7 +1414,12 @@ swfdec_action_new_object (JSContext *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...
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
...JSAtom *atom; + JSObject *obj, *pobj; + JSProperty *prop; + SWFDEC_LOG ("preloading root into register %u", preload_reg); + if (!(atom = js_Atomize (cx, "_root", 5, 0)) || + !js_FindProperty (cx, (jsid) atom, &obj, &pobj, &prop) || + !js_GetProperty (cx, obj, (jsid) atom, &fp->vars[preload_reg++])) { + ok = JS_FALSE; + goto out; + } + } + if (script->flags & SWFDEC_SCRIPT_PRELOAD_PARENT) { + JSAtom *atom; + JSObject *obj, *pobj; + JSProperty *prop; + SWFDEC_LOG ("preloading parent into register...
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 22
0
3 commits - libswfdec/swfdec_js.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c
...t;eval", swfdec_js_global_eval, 1, 0, 0 }, { "getBytesLoaded", mc_getBytesLoaded, 0, 0, 0 }, { "getBytesTotal", mc_getBytesTotal, 0, 0, 0 }, + { "getNextHighestDepth", mc_getNextHighestDepth, 0, 0, 0 }, { "getProperty", swfdec_js_getProperty, 2, 0, 0 }, { "getURL", swfdec_js_getURL, 2, 0, 0 }, { "gotoAndPlay", mc_gotoAndPlay, 1, 0, 0 }, diff-tree 3c4a91276dbf607849f02fc9f637f8caf1c339c6 (from 27f57143cbff3082c9b565e5256023baaf079140) Author: Benjamin Otte <otte@gnome.org> Date: Thu Feb 22 18:53...
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
...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 (!JS_GetProperty (cx, JSVAL_TO_OBJECT (o), s, &cx->fp->sp[-2])) + return JS_FALSE; +#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
...gt;sp[-1]); + if (s == NULL) + return JS_FALSE; + if (!JS_ValueToECMAUint32 (cx, fp->sp[-2], &n_args)) + return JS_FALSE; + + if (!(atom = js_Atomize (cx, s, strlen (s), 0)) || + !js_FindProperty (cx, (jsid) atom, &obj, &pobj, &prop)) + return JS_FALSE; + if (!JS_GetProperty (cx, obj, s, &fun)) + return JS_FALSE; + if (!JSVAL_IS_OBJECT (fun)) { + /* FIXME: figure out what class we operate on */ + SWFDEC_WARNING ("%s is not a function", s); + } + fp->sp[-1] = fun; + fp->sp[-2] = OBJECT_TO_JSVAL (obj); + swfdec_action_call (cx, n_args, 0...
2007 Feb 19
0
2 commits - libswfdec/swfdec_script.c test/swfdec-extract.c
...warning in CallMethod if a function doesn't exist diff --git a/libswfdec/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 185d07d2ed05ec0...
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
...*name, - guint n_args, jsval *args) -{ - JSObject *obj; - jsval fun; - - g_return_if_fail (SWFDEC_IS_SCRIPTABLE (script)); - g_return_if_fail (name != NULL); - g_return_if_fail (n_args == 0 || args != NULL); - - obj = swfdec_scriptable_get_object (script); - if (!obj) - return; - if (!JS_GetProperty (script->jscx, obj, name, &fun)) - return; - if (!JSVAL_IS_OBJECT (fun) || fun == JSVAL_NULL || - JS_GetClass (JSVAL_TO_OBJECT (fun)) != &js_FunctionClass) { - SWFDEC_LOG ("scriptable has no handler for %s event", name); - return; - } - js_InternalCall (script-...
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
...;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)) + return; + } else { + fun = interval->vals[0]; + } + js_InternalCall (cx, JSVAL_TO_OBJECT (interval->vals[1]), fun, + interval->n_args, &interval->vals[2], &rval); +} + +static SwfdecJSInte...
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
...(constructor) || + !SWFDEC_IS_AS_FUNCTION (fun = (SwfdecAsFunction *) SWFDEC_AS_VALUE_GET_OBJECT (constructor))) { + SWFDEC_WARNING ("%s is not a constructor", name); goto fail; - if (s[0] == '\0') { - constructor = OBJECT_TO_JSVAL (object); - } else { - if (!JS_GetProperty (cx, object, s, &constructor)) - return JS_FALSE; - if (!JSVAL_IS_OBJECT (constructor)) { - SWFDEC_WARNING ("%s:%s is not a function", JS_GetClass (object)->name, s); + } + if (name != SWFDEC_AS_STR_EMPTY) { + if (SWFDEC_AS_VALUE_IS_OBJECT (constructor)) { +...
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
...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 guint8 *data, guint len) -{ - jsval val; - SwfdecMovie *m...
2007 Mar 07
0
11 commits - libswfdec/swfdec_event.c libswfdec/swfdec_event.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_movie.c libswfdec/swfdec_scriptable.c libswfdec/swfdec_scriptable.h libswfdec/swfdec_script.c libswfdec/swfdec_sprite.c libswfdec/swfdec_sprite.h
...*name, + guint n_args, jsval *args) +{ + JSObject *obj; + jsval fun; + + g_return_if_fail (SWFDEC_IS_SCRIPTABLE (script)); + g_return_if_fail (name != NULL); + g_return_if_fail (n_args == 0 || args != NULL); + + obj = swfdec_scriptable_get_object (script); + if (!obj) + return; + if (!JS_GetProperty (script->jscx, obj, name, &fun)) + return; + if (!JSVAL_IS_OBJECT (fun) || fun == JSVAL_NULL || + JS_GetClass (JSVAL_TO_OBJECT (fun)) != &js_FunctionClass) { + SWFDEC_LOG ("scriptable has no handler for %s event", name); + return; + } + js_InternalCall (script-...
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
...300,29 +300,26 @@ fail: static JSBool swfdec_js_eval_get_property (JSContext *cx, JSObject *obj, - const char *name, gboolean initial, jsval *ret) + const char *name, gboolean initial, gboolean ignore_case, jsval *ret) { JSAtom *atom; JSObject *pobj; JSProperty *prop; - if (!JS_GetProperty (cx, obj, name, ret)) - return JS_FALSE; - if (!JSVAL_IS_VOID (*ret)) - return JS_TRUE; - if (!initial) - return JS_FALSE; - - atom = js_Atomize(cx, name, strlen(name), 0); + atom = js_Atomize (cx, name, strlen(name), ignore_case ? ATOM_NOCASE : 0); if (!atom) return JS_FAL...
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
...;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)) - return; - } else { - fun = interval->vals[0]; - } - js_InternalCall (cx, JSVAL_TO_OBJECT (interval->vals[1]), fun, - interval->n_args, &interval->vals[2], &rval); -} - -static SwfdecAsInte...
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
...if (n_args + 2 > (guint) (fp->sp - fp->spbase)) return JS_FALSE; - obj = OBJ_THIS_OBJECT (cx, cx->fp->scopeChain); + if (!(atom = js_Atomize (cx, s, strlen (s), 0)) || + !js_FindProperty (cx, (jsid) atom, &obj, &pobj, &prop)) + return JS_FALSE; if (!JS_GetProperty (cx, obj, s, &fun)) return JS_FALSE; fp->sp[-1] = fun; @@ -589,6 +593,8 @@ swfdec_action_call_method (JSContext *cx if (!JS_ValueToObject (cx, fp->sp[-2], &obj)) return JS_FALSE; + if (obj == NULL) + goto fail; if (s[0] == '\0') { fun = OBJECT_T...
2007 Mar 01
0
11 commits - libswfdec/Makefile.am libswfdec/swfdec_connection.c libswfdec/swfdec_connection.h libswfdec/swfdec_flv_decoder.c libswfdec/swfdec_js.c libswfdec/swfdec_js_connection.c libswfdec/swfdec_js.h libswfdec/swfdec_js_net_stream.c
...rget *target) +{ + SwfdecXml *xml = SWFDEC_XML (target); + + return xml->player; +} + +static void +swfdec_xml_ondata (SwfdecXml *xml) +{ + JSContext *cx = SWFDEC_SCRIPTABLE (xml)->jscx; + JSObject *obj = SWFDEC_SCRIPTABLE (xml)->jsobj; + jsval val, fun; + JSString *string; + + if (!JS_GetProperty (cx, obj, "onData", &fun)) + return; + if (fun == JSVAL_VOID) + return; + if (xml->text) { + string = JS_NewStringCopyZ (cx, xml->text); + if (string == NULL) { + SWFDEC_ERROR ("Could not convert text to JS string"); + return; + } + val =...
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
...r->entries[i].blocked) { + jsval fun; + JSObject *obj = listener->entries[i].object; + if (listener->entries[i].removed) { + listener->entries[i].object = NULL; + listener->entries[i].removed = FALSE; + } + listener->entries[i].blocked = FALSE; + if (!JS_GetProperty (cx, obj, event_name, &fun)) + continue; + if (!JSVAL_IS_OBJECT (fun) || fun == JSVAL_NULL || + JS_GetClass (JSVAL_TO_OBJECT (fun)) != &js_FunctionClass) { + SWFDEC_INFO ("object has no handler for %s event", (char *) event_name); + continue; + } + js_InternalCall...
2007 Mar 07
0
13 commits - libswfdec/Makefile.am libswfdec/swfdec_js_global.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_root_movie.c libswfdec/swfdec_root_movie.h libswfdec/swfdec_script.c libswfdec/swfdec_sprite.h libswfdec/swfdec_sprite_movie.c
...for missing functions instead of always printing "global" diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 7d93740..927aa67 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -653,8 +653,8 @@ swfdec_action_call_function (JSContext * 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); + /* FIXME: figure out what class we operate on */ + SWFDEC_WARNING ("%s is not a function", s); } fp->...
2007 May 23
0
Branch 'as' - 7 commits - libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h libswfdec/swfdec_as_strings.c
...movie->color_transform.ba = 0; - movie->color_transform.bb = color & 0xFF; - swfdec_movie_invalidate (movie); - return JS_TRUE; -} - -static inline void -parse_property (JSContext *cx, JSObject *obj, const char *name, int *target, gboolean scale) -{ - jsval val; - double d; - - if (!JS_GetProperty (cx, obj, name, &val)) - return; - if (JSVAL_IS_VOID (val)) - return; - if (!JS_ValueToNumber (cx, val, &d)) - return; - if (scale) { - *target = d * 256.0 / 100.0; - } else { - *target = d; - } -} - -static JSBool -swfdec_js_color_set_transform (JSContext *cx, JSObject...
2007 Apr 04
0
Branch 'as' - 17 commits - configure.ac doc/Makefile.am doc/swfdec-docs.sgml doc/swfdec-sections.txt doc/swfdec.types libswfdec-gtk/Makefile.am libswfdec-gtk/swfdec-gtk.h libswfdec-gtk/swfdec_gtk_loader.c libswfdec-gtk/swfdec_gtk_loader.h
...n, const char *code, const char *level, const char *description) { - JSContext *cx = SWFDEC_SCRIPTABLE (conn)->jscx; - JSObject *obj = SWFDEC_SCRIPTABLE (conn)->jsobj; - JSObject *info; - jsval val, fun; - JSString *string; + SwfdecAsValue value; + SwfdecAsObject *info; - if (!JS_GetProperty (cx, obj, "onStatus", &fun)) - return; - if (fun == JSVAL_VOID) - return; - info = JS_NewObject (cx, NULL, NULL, NULL); - if (info == NULL || - (string = JS_NewStringCopyZ (cx, code)) == NULL || - (val = STRING_TO_JSVAL (string)) == 0 || - !JS_SetProperty (cx,...