search for: jscontext

Displaying 20 results from an estimated 63 matches for "jscontext".

Did you mean: scontext
2007 Mar 22
0
7 commits - configure.ac doc/swfdec-docs.sgml libswfdec/js libswfdec/swfdec_buffer.c libswfdec/swfdec_buffer.h libswfdec/swfdec_js_movie.c test/trace
...0 change all conversions JSObject->SwfdecMovie to not assert on failure but silently return diff --git a/libswfdec/swfdec_js_movie.c b/libswfdec/swfdec_js_movie.c index 2d9b1a1..3f6333c 100644 --- a/libswfdec/swfdec_js_movie.c +++ b/libswfdec/swfdec_js_movie.c @@ -116,7 +116,11 @@ mc_play (JSContext *cx, JSObject *obj, u { SwfdecMovie *movie; - movie = JS_GetPrivate(cx, obj); + movie = swfdec_scriptable_from_object (cx, obj, SWFDEC_TYPE_MOVIE); + if (movie == NULL) { + SWFDEC_WARNING ("not a movie"); + return JS_TRUE; + } g_assert (movie); movie->stopped = FA...
2007 Feb 22
0
3 commits - libswfdec/swfdec_js.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c
...e@gnome.org> Date: Thu Feb 22 19:26:37 2007 +0100 implement getNextHighestDepth () diff --git a/libswfdec/swfdec_js_movie.c b/libswfdec/swfdec_js_movie.c index 5b730b3..2296078 100644 --- a/libswfdec/swfdec_js_movie.c +++ b/libswfdec/swfdec_js_movie.c @@ -87,7 +87,7 @@ mc_getBytesLoaded (JSContext *cx, JSObje } static JSBool -mc_getBytesTotal(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +mc_getBytesTotal (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { SwfdecMovie *movie; SwfdecDecoder *dec; @@ -101,6 +101,23 @@ mc_getBytesTotal(JSConte...
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
...(it used to not work before) - allocate 4 local variables in swfdec_script_interpret diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index dc8b2a5..95a5561 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -1418,7 +1418,8 @@ swfdec_action_init_object (JSContext *cx } static JSBool -swfdec_action_define_function (JSContext *cx, guint action, const guint8 *data, guint len) +swfdec_action_do_define_function (JSContext *cx, guint action, + const guint8 *data, guint len, gboolean v2) { const char *function_name; guint i, n_args, size; @@ -1426,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
...f --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 428fc4c..50dbf2b 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -125,6 +125,42 @@ swfdec_constant_pool_get_area (SwfdecScr /*** SUPPORT FUNCTIONS ***/ +/** + * swfdec_script_ensure_stack: + * @cx: #JSContext to check + * @n_elements: number of elements the stack should contain + * + * Ensures that the stack is at least @n_elements values. If not enough stack + * space is available, the stack is filled up with JSVAL_VOID. + * + * Returns: JS_TRUE on success or JS_FALSE on OOM + **/ +static inline JSBool...
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
...(SwfdecPlayer * player); void swfdec_js_add_globals (SwfdecPlayer * player); @@ -47,9 +43,6 @@ void swfdec_js_add_mouse (SwfdecPlayer void swfdec_js_add_movieclip_class (SwfdecPlayer * player); void swfdec_js_add_sound (SwfdecPlayer * player); -SwfdecMovie * swfdec_js_val_to_movie (JSContext * cx, - jsval val); -gboolean swfdec_js_add_movie (SwfdecMovie * movie); void swfdec_js_movie_add_property (SwfdecMovie * movie); void swfdec_js_movie_remove_property (SwfdecMovie * movie); diff --git a/libswfdec/swfdec_js_color.c b/libswfdec/swfdec_js_color.c index b72d3c3..a117...
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
...2007 +0100 use NULL in _eval of SetVariable and GetVariable to walk the scope chain diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index a3bb563..7848e14 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -316,7 +316,7 @@ swfdec_action_get_variable (JSContext *c s = swfdec_js_to_string (cx, cx->fp->sp[-1]); if (s == NULL) return JS_FALSE; - cx->fp->sp[-1] = swfdec_js_eval (cx, cx->fp->scopeChain, s); + cx->fp->sp[-1] = swfdec_js_eval (cx, NULL, s); return JS_TRUE; } @@ -329,7 +329,7 @@ swfdec_action_set_variabl...
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
...CallMethod - walk the whole scope chain in CallFunction when trying to find the function diff --git a/libswfdec/swfdec_script.c b/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 *...
2007 Mar 05
0
11 commits - configure.ac libswfdec/swfdec_js_movie.c libswfdec/swfdec_root_movie.c libswfdec/swfdec_root_movie.h libswfdec/swfdec_script.c libswfdec/swfdec_sprite.c libswfdec/swfdec_sprite.h libswfdec/swfdec_sprite_movie.c libswfdec/swfdec_swf_decoder.c
...8:11 2007 +0100 only remove movie as property if it is one diff --git a/libswfdec/swfdec_js_movie.c b/libswfdec/swfdec_js_movie.c index dcf119d..855d002 100644 --- a/libswfdec/swfdec_js_movie.c +++ b/libswfdec/swfdec_js_movie.c @@ -1154,7 +1154,8 @@ swfdec_js_movie_remove_property (SwfdecM JSContext *cx; JSBool found = JS_FALSE; - if (script->jsobj == NULL) + if (!movie->has_name || + script->jsobj == NULL) return; cx = script->jscx; diff-tree efce7d9c8c83c94695264ad55902cd78130141df (from f7b8a791525df2b8f431ce233219f25cd694428a) Author: Benjamin Otte <ott...
2007 Feb 01
0
Branch 'interpreter' - libswfdec/swfdec_script.c
...hu Feb 1 16:11:16 2007 +0100 implement WaitForFrame2 videostar.swf works now diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 39b3b8b..c416f64 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -267,6 +267,27 @@ swfdec_action_goto_label (JSContext *cx, return JS_TRUE; } +static int +swfdec_value_to_frame (JSContext *cx, SwfdecMovie *movie, jsval val) +{ + int frame; + + if (JSVAL_IS_STRING (val)) { + const char *name = swfdec_js_to_string (cx, val); + if (name == NULL || + !SWFDEC_IS_SPRITE_MOVIE (movie)) + return -...
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
...Object action all tests pass now diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index b1f1a63..64f0746 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -1105,6 +1105,35 @@ fail: return JS_TRUE; } +static JSBool +swfdec_action_init_object (JSContext *cx, guint action, const guint8 *data, guint len) +{ + JSStackFrame *fp = cx->fp; + JSObject *object; + guint i, n_args; + + if (!JS_ValueToECMAUint32 (cx, fp->sp[-1], &n_args)) + return JS_FALSE; + if ((guint) (fp->sp - fp->spbase) < 2 * n_args + 1) { + SWFDEC_ERROR (...
2007 Mar 05
0
5 commits - libswfdec/swfdec_js.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c test/trace
...Mon Mar 5 22:08:33 2007 +0100 handle constructor prototypes correctly diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 01dd6ae..f00a6f1 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -1387,7 +1387,7 @@ static JSBool swfdec_action_new_object (JSContext *cx, guint action, const guint8 *data, guint len) { JSStackFrame *fp = cx->fp; - jsval constructor; + jsval constructor, proto; JSObject *object; const JSClass *clasp; guint n_args; @@ -1414,7 +1414,12 @@ swfdec_action_new_object (JSContext *cx, if (JS_GetClass (object) != &amp...
2007 Mar 11
0
10 commits - libswfdec/js libswfdec/swfdec_js_color.c libswfdec/swfdec_js_connection.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_js_net_stream.c libswfdec/swfdec_js_video.c libswfdec/swfdec_js_xml.c libswfdec/swfdec_script.c player/.gitignore
...1:51:06 2007 +0100 fix handling of missing arguments to be in line with the official player diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 2860e24..4b17af1 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -650,8 +650,16 @@ swfdec_action_call (JSContext *cx, guint JSStackFrame *fp = cx->fp; int i, j; jsval tmp; + guint stacksize; - g_assert ((guint) (fp->sp - fp->spbase) >= n_args + 2); + stacksize = fp->sp - fp->spbase; + g_assert (stacksize >= 2); + if (n_args + 2 > stacksize) { + SWFDEC_WARNING ("...
2007 Jan 31
0
Branch 'interpreter' - 3 commits - libswfdec/js libswfdec/swfdec_script.c
...07 +0100 implement BitAnd, BitOr, BitXor, DefineLocal, DefineLocal2 and Return diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 9b3a328..46ba618 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -1359,6 +1359,35 @@ swfdec_action_define_function (JSContext } static JSBool +swfdec_action_bitwise (JSContext *cx, guint action, const guint8 *data, guint len) +{ + guint32 a, b; + double d; + + if (!JS_ValueToECMAUint32 (cx, cx->fp->sp[-1], &a) || + !JS_ValueToECMAUint32 (cx, cx->fp->sp[-2], &b)) + return JS_FALSE; + + s...
2007 Mar 01
0
7 commits - libswfdec/swfdec_connection.c libswfdec/swfdec_js_connection.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_js_net_stream.c libswfdec/swfdec_js_xml.c libswfdec/swfdec_net_stream.c libswfdec/swfdec_scriptable.c libswfdec/swfdec_scriptable.h
...diff --git a/libswfdec/swfdec_js_net_stream.c b/libswfdec/swfdec_js_net_stream.c index 9f12dd0..ed9c81e 100644 --- a/libswfdec/swfdec_js_net_stream.c +++ b/libswfdec/swfdec_js_net_stream.c @@ -27,6 +27,23 @@ #include "swfdec_player_internal.h" static JSBool +swfdec_js_net_stream_play (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +{ + SwfdecNetStream *stream; + const char *url; + + stream = swfdec_scriptable_from_object (cx, obj, SWFDEC_TYPE_NET_STREAM); + if (stream == NULL) + return JS_TRUE; + url = swfdec_js_to_string (cx, argv[0]); + if (url == NULL) +...
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
...handle colors not referring to movies This also fixes the color-new test diff --git a/libswfdec/swfdec_js_color.c b/libswfdec/swfdec_js_color.c index ade8d6a..095abd7 100644 --- a/libswfdec/swfdec_js_color.c +++ b/libswfdec/swfdec_js_color.c @@ -32,7 +32,8 @@ swfdec_js_color_get_rgb (JSContext *cx, int result; SwfdecMovie *movie = JS_GetPrivate (cx, obj); - g_assert (movie); + if (!movie) + return JS_TRUE; result = (movie->color_transform.rb << 16) | ((movie->color_transform.gb % 256) << 8) | (movie->color_transform.bb % 256); @@ -55,7 +56...
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
...ytes, otherwise it's in actions */ - guint offset; /* action to jump to */ -} Jump; - -typedef struct { - guint original; /* amount of bytes we've advanced in the input */ - guint compiled; /* amount of bytes we've advancecd in the bytecode */ -} Offset; - -typedef struct { - JSContext * cx; /* JSContext from player */ - JSAtomList atoms; /* accumulated atoms */ - - SwfdecBits * bits; /* where to read the code from */ - int version; /* Flash version we're compiling for */ - GByteArray * bytecode; /* generated bytecode so far */ - char * error; /* error encount...
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
...t;otte@gnome.org> Date: Mon Jan 22 10:54:05 2007 +0100 implement Increment and Decrement diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index 909cba4..171877f 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -753,6 +753,26 @@ swfdec_action_if (JSContext *cx, guint a return JS_TRUE; } +static JSBool +swfdec_action_decrement (JSContext *cx, guint action, const guint8 *data, guint len) +{ + double d; + + d = swfdec_action_to_number (cx, cx->fp->sp[-1]); + d--; + return JS_NewNumberValue (cx, d, &cx->fp->sp[-1]); +} + +static...
2007 Jan 24
0
Branch 'interpreter' - 8 commits - libswfdec/swfdec_bits.c libswfdec/swfdec_bits.h libswfdec/swfdec_js.c libswfdec/swfdec_js.h libswfdec/swfdec_script.c test/swfdec_out.c test/swfdec_out.h test/swfedit_tag.c test/swfedit_token.c test/swfedit_token.h
...g> Date: Wed Jan 24 21:37:13 2007 +0100 use swfdec_js_eval_set for SetVariable diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index b2c4c81..32af30e 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -329,11 +329,8 @@ swfdec_action_set_variable (JSContext *c if (s == NULL) return JS_FALSE; - if (strpbrk (s, "./:")) { - SWFDEC_WARNING ("FIXME: implement paths"); - } - if (!JS_SetProperty (cx, cx->fp->scopeChain, s, &cx->fp->sp[-1])) - return JS_FALSE; + swfdec_js_eval_set (cx, cx->fp->scop...
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
...e for the entry scripts, so don't do it either the good thing about this: make check passes diff --git a/libswfdec/swfdec_js.c b/libswfdec/swfdec_js.c index 9d6782a..e6ce8a5 100644 --- a/libswfdec/swfdec_js.c +++ b/libswfdec/swfdec_js.c @@ -338,7 +338,7 @@ swfdec_js_eval_set_property (JSContext * if (obj == NULL) { if (cx->fp == NULL || cx->fp->scopeChain == NULL) return JS_FALSE; - obj = JS_GetParent (cx, cx->fp->scopeChain); + obj = cx->fp->thisp; } return OBJ_SET_PROPERTY (cx, obj, (jsid) atom, ret); } diff --git a/libswfdec/swfdec_scrip...
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
...ug.h" #include "swfdec_debugger.h" @@ -148,2445 +149,10 @@ swfdec_script_add_to_player (SwfdecScrip } } -#define swfdec_action_has_register(cx, i) \ - ((i) < ((SwfdecScript *) (cx)->fp->swf)->n_registers) - -#if 0 -static SwfdecMovie * -swfdec_action_get_target (JSContext *cx) -{ - JSObject *object = cx->fp->scopeChain; - /* this whole function needs a big FIXME */ - if (JS_GetClass (object) == &js_WithClass) - object = JS_GetPrototype (cx, object); - return swfdec_scriptable_from_jsval (cx, OBJECT_TO_JSVAL (object), SWFDEC_TYPE_MOVIE); -} - -static...