Displaying 20 results from an estimated 60 matches for "js_false".
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
..._MOVIE (object)) {
+ SWFDEC_ERROR ("no valid target");
+ return NULL;
+ }
+ return SWFDEC_MOVIE (object);
+}
+
+#if 0
+static void
+swfdec_action_push_string (SwfdecAsContext *cx, const char *s)
+{
+ JSString *string = JS_NewStringCopyZ (cx, s);
+ if (string == NULL)
+ return JS_FALSE;
+ *cx->fp->sp++ = STRING_TO_JSVAL (string);
+ return JS_TRUE;
+}
+
+static void
+swfdec_value_to_boolean_5 (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) != 0;
+ }...
2007 Feb 22
0
3 commits - libswfdec/swfdec_js.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c
...ariable ("bla.$property[x]")
- same for SetVariable
diff --git a/libswfdec/swfdec_js.c b/libswfdec/swfdec_js.c
index ee5c7b7..b9313c1 100644
--- a/libswfdec/swfdec_js.c
+++ b/libswfdec/swfdec_js.c
@@ -341,9 +341,16 @@ swfdec_js_eval_set_property (JSContext *
if (!atom)
return JS_FALSE;
if (obj == NULL) {
- if (cx->fp == NULL || cx->fp->scopeChain == NULL)
+ JSObject *pobj;
+ JSProperty *prop;
+ if (cx->fp == NULL || cx->fp->varobj == NULL)
return JS_FALSE;
- obj = cx->fp->thisp;
+ if (!js_FindProperty (cx, (jsid) atom, &obj...
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
...= fp->sp - fp->spbase;
+ g_assert (stacksize >= 2);
+ if (n_args + 2 > stacksize) {
+ SWFDEC_WARNING ("broken script. Want %u arguments, only got %u", n_args, stacksize - 2);
+ n_args = stacksize - 2;
+ if (!swfdec_script_ensure_stack (cx, n_args + 2))
+ return JS_FALSE;
+ }
j = -1;
i = - (n_args + 2);
@@ -677,13 +685,13 @@ swfdec_action_call_function (JSContext *
jsval fun;
JSAtom *atom;
+ if (!swfdec_script_ensure_stack (cx, 2))
+ return JS_FALSE;
s = swfdec_js_to_string (cx, fp->sp[-1]);
if (s == NULL)
return JS_FALSE;
if...
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
...ec_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
+swfdec_script_ensure_stack (JSContext *cx, guint n_elements)
+{
+ JSStackFrame *fp = cx->fp;
+ guint current = (guint) (fp->sp - fp->spbase);
+
+ if (current >= n_elements)
+ return JS_TRUE;
+
+ if (n_elements > (guint) (fp->spend - fp-&g...
2007 Mar 05
0
5 commits - libswfdec/swfdec_js.h libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c test/trace
...on_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 == NULL)
return JS_FALSE;
fp->sp[-2] = OBJECT_TO_JSVAL (obj...
2007 Apr 04
0
Branch 'as' - 9 commits - libswfdec/swfdec_as_context.c libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_function.c libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_stack.c libswfdec/swfdec_as_stack.h
...t.c
@@ -512,22 +512,18 @@ swfdec_action_push (SwfdecAsContext *cx,
}
}
-#if 0
static void
swfdec_action_get_variable (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
{
const char *s;
- s = swfdec_js_to_string (cx, cx->fp->sp[-1]);
- if (s == NULL)
- return JS_FALSE;
- cx->fp->sp[-1] = swfdec_js_eval (cx, NULL, s);
+ s = swfdec_as_value_to_string (cx, swfdec_as_stack_peek (cx->frame->stack, 1));
+ swfdec_as_context_eval (cx, NULL, s, swfdec_as_stack_peek (cx->frame->stack, 1));
#ifdef SWFDEC_WARN_MISSING_PROPERTIES
- if (cx->fp->sp...
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
...+ cx->fp->sp[-1] = d == 0 ? JSVAL_TRUE : JSVAL_FALSE;
+ return JS_TRUE;
+}
+
+static JSBool
+swfdec_action_jump (JSContext *cx, guint action, const guint8 *data, guint len)
+{
+ if (len != 2) {
+ SWFDEC_ERROR ("Jump action length invalid (is %u, should be 2", len);
+ return JS_FALSE;
+ }
+ cx->fp->pc += 4 + GINT16_FROM_LE (*((gint16*) data));
+ return JS_TRUE;
+}
+
+static JSBool
+swfdec_action_if (JSContext *cx, guint action, const guint8 *data, guint len)
+{
+ double d;
+
+ if (len != 2) {
+ SWFDEC_ERROR ("Jump action length invalid (is %u, should be 2&qu...
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
...+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 ("not enough stack space");
+ return JS_FALSE;
+ }
+
+ object = JS_NewObject (cx, &js_ObjectClass, NULL, NULL);
+ if (object == NULL)
+ return JS_FALSE;
+ for (i = 0; i < n_args; i++) {
+...
2007 Jan 31
0
Branch 'interpreter' - 3 commits - libswfdec/js libswfdec/swfdec_script.c
...ction (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;
+
+ switch (action) {
+ case 0x60:
+ d = (int) (a & b);
+ break;
+ case 0x61:
+ d = (int) (a | b);
+ break;
+ case 0x62:
+ d = (int) (a ^ b);
+ break;
+ default:
+ g_assert_not_reached ();
+ return JS_FALSE;
+ }
+
+ cx->fp->sp--;
+...
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
...ntext_return (cx);
}
-#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 (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
...Function (cx, NULL, n_args, JSFUN_LAMBDA, cx->fp->thisp, NULL);
} else {
/* named function */
- fun = JS_NewFunction (cx, NULL, n_args, 0, NULL, function_name);
+ fun = JS_NewFunction (cx, NULL, n_args, 0, cx->fp->thisp, function_name);
}
if (fun == NULL)
return JS_FALSE;
diff-tree aabc4fdacdad8392d185467be20a858d2bff1cad (from debdc90a5da93480aa82e2d78331720c4f53c103)
Author: Benjamin Otte <otte@gnome.org>
Date: Fri Feb 16 19:23:42 2007 +0100
make DefineFunction2 work
various changes, including:
- make DefineFunction2 really work (it used...
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
...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_variable (JSContext *c
if (s == NULL)
return JS_FALSE;
- swfdec_js_eval_set (cx, cx->fp-&g...
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
...;
- JSObject *obj;
+ JSObject *obj, *pobj;
+ JSProperty *prop;
jsval fun;
+ JSAtom *atom;
s = swfdec_js_to_string (cx, fp->sp[-1]);
if (s == NULL)
@@ -561,7 +563,9 @@ swfdec_action_call_function (JSContext *
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]...
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
...e"
-};
-
-static void
-swfdec_action_get_property (SwfdecAsContext *cx, guint action, const guint8 *data, guint len)
-{
- jsval val;
- SwfdecMovie *movie;
- JSObject *jsobj;
- guint32 id;
- const char *bytes;
-
- if (!JS_ValueToECMAUint32 (cx, cx->fp->sp[-1], &id))
- return JS_FALSE;
- val = cx->fp->sp[-2];
- bytes = swfdec_eval_jsval (cx, NULL, &val);
- if (id > (((SwfdecScript *) cx->fp->swf)->version > 4 ? 21 : 18)) {
- SWFDEC_WARNING ("trying to SetProperty %u, not allowed", id);
- goto out;
- }
-
- if (bytes == NULL)
- retu...
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 18
0
Branch 'interpreter' - 4 commits - libswfdec/js libswfdec/swfdec_bits.c libswfdec/swfdec_bits.h libswfdec/swfdec_codec_screen.c libswfdec/swfdec_image.c libswfdec/swfdec_script.c libswfdec/swfdec_swf_decoder.c libswfdec/swfdec_tag.c
...@@
#include <string.h>
#include "swfdec_decoder.h"
+#include "swfdec_js.h"
#include "swfdec_movie.h"
#include "swfdec_root_movie.h"
@@ -305,6 +306,18 @@ swfdec_action_push (JSContext *cx, guint
return swfdec_bits_left (&bits) ? JS_TRUE : JS_FALSE;
}
+static JSBool
+swfdec_action_get_variable (JSContext *cx, guint action, const guint8 *data, guint len)
+{
+ const char *s;
+
+ 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,...
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
...-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_script.c b/libswfdec/swfdec_script.c
index d46687f..824861b 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/s...
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
...e;
swfdec_bits_init_data (&bits, data, len);
@@ -288,24 +308,13 @@ swfdec_action_goto_frame2 (JSContext *cx
}
val = cx->fp->sp[-1];
cx->fp->sp--;
- if (JSVAL_IS_STRING (val)) {
- const char *name = swfdec_js_to_string (cx, val);
- if (name == NULL)
- return JS_FALSE;
- if (strchr (name, ':')) {
- SWFDEC_ERROR ("FIXME: handle targets");
- }
- frame = swfdec_sprite_get_frame (SWFDEC_SPRITE_MOVIE (movie)->sprite, name);
- if (frame == -1)
- return JS_TRUE;
- } else {
- /* FIXME: how do we treat undefined etc? */
-...
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
...FO ("attempted to construct a color without a movie");
- return JS_TRUE;
+ if (argc > 0) {
+ movie = swfdec_scriptable_from_jsval (cx, argv[0], SWFDEC_TYPE_MOVIE);
+ } else {
+ movie = NULL;
+ }
+ if (movie != NULL) {
+ if (!JS_SetPrivate (cx, obj, movie))
+ return JS_FALSE;
+ g_object_ref (movie);
}
- if (!JS_SetPrivate (cx, obj, movie))
- return JS_TRUE;
- g_object_ref (movie);
*rval = OBJECT_TO_JSVAL (obj);
return JS_TRUE;
}
@@ -195,7 +200,7 @@ void
swfdec_js_add_color (SwfdecPlayer *player)
{
JS_InitClass (player->jscx, player->jsobj,...
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
...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 <otte@gnome.org>
Date: Sun Mar...