Displaying 20 results from an estimated 24 matches for "scopechain".
2007 Feb 22
0
3 commits - libswfdec/swfdec_js.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_script.c
...dbf607849f02fc9f637f8caf1c339c6 (from 27f57143cbff3082c9b565e5256023baaf079140)
Author: Benjamin Otte <otte@gnome.org>
Date: Thu Feb 22 18:53:05 2007 +0100
rework SetVariable, SetProperty and GetProperty
- try setting an existing property first
- use the varobj and not the scopeChain if the property doesn't exist
- make GetProperty ("bla", x) work like GetVariable ("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_...
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
...ut 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_script.c b/libswfdec/swfdec_script.c
index d46687f..824861b 100644
--- a/libswfdec/s...
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
...563..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->scopeChain, s, cx->fp->sp[-1]);
+ swfdec_js_eval_set (cx, NULL,...
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
...orrect this object
diff --git a/libswfdec/swfdec_js.c b/libswfdec/swfdec_js.c
index e501c4f..829c1ad 100644
--- a/libswfdec/swfdec_js.c
+++ b/libswfdec/swfdec_js.c
@@ -384,7 +384,7 @@ swfdec_js_eval_internal (JSContext *cx,
if (cx->fp == NULL)
goto out;
g_assert (cx->fp->scopeChain);
- cur = OBJECT_TO_JSVAL (cx->fp->scopeChain);
+ cur = OBJECT_TO_JSVAL (OBJ_THIS_OBJECT (cx, cx->fp->scopeChain));
}
finish:
diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c
index dca72e0..537fced 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfd...
2007 Mar 16
0
4 commits - libswfdec/swfdec_script.c test/image test/trace
...tion *fun;
SwfdecScript *script;
+ JSObject *scope;
gboolean has_preloads = FALSE;
guint flags = 0;
guint8 *preloads = NULL;
@@ -1659,14 +1660,23 @@ swfdec_action_define_function (JSContext
return JS_FALSE;
}
n_args = swfdec_bits_get_u16 (&bits);
+ scope = cx->fp->scopeChain;
+ script = cx->fp->swf;
+ if (script->version == 5) {
+ /* In Flash 5 there's only the root scope as a parent scope */
+ JSObject *parent;
+ /* FIXME: this implementation is hacky (but it works) */
+ while (JS_GetClass (scope) == &js_CallClass && (parent = JS...
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
...j, jsval *val)
+{
+ if (JSVAL_IS_STRING (*val)) {
+ const char *bytes = swfdec_js_to_string (cx, *val);
+ if (bytes == NULL)
+ return NULL;
+ *val = swfdec_js_eval (cx, obj, bytes);
+ return bytes;
+ } else {
+ if (obj == NULL) {
+ obj = OBJ_THIS_OBJECT (cx, cx->fp->scopeChain);
+ }
+ *val = OBJECT_TO_JSVAL (obj);
+ return ".";
+ }
+}
+
+static const char *properties[22] = {
+ "_x", "_y", "_xscale", "_yscale", "_currentframe",
+ "_totalframes", "_alpha", "_visible", &quo...
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
...*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] = fun;
@@ -589,6 +593,8 @@ swfdec_action_call_method (JSCont...
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
...return JS_TRUE;
}
-
-static void
-swfdec_action_do_set_target (SwfdecAsContext *cx, JSObject *target)
-{
- JSObject *with;
-
- /* FIXME: this whole function stops working the moment it's used together
- * with With */
- with = js_NewObject(cx, &js_WithClass, target, cx->fp->scopeChain);
- if (!with)
- return JS_FALSE;
- cx->fp->scopeChain = with;
- return JS_TRUE;
-}
-
-static void
-swfdec_action_do_unset_target (SwfdecAsContext *cx)
-{
- if (JS_GetClass (cx->fp->scopeChain) != &js_WithClass) {
- SWFDEC_ERROR ("Cannot unset target: scope chain cont...
2007 Oct 12
0
Changes to 'refs/tags/0.5.3'
....swf.trace | 5
test/trace/getvariable-length-8.swf |binary
test/trace/getvariable-length-8.swf.trace | 5
test/trace/getvariable-length.as | 23
test/trace/getvariable-scopechain-5.swf |binary
test/trace/getvariable-scopechain-5.swf.trace | 2
test/trace/getvariable-scopechain-6.swf |binary
test/trace/getvariable-scopechain-6.swf.trace | 5
test/trace/getvariable-sc...
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
...dec/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->scopeChain, s, cx->fp->sp[-1],
+ ((SwfdecScript *) cx->fp->swf)->version < 7);
cx->fp->sp -= 2;
return JS_TRUE;
}
diff-tree 9dab0726ed4e35c06038b8700492bd62658ff689 (f...
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
...ef..5b9f960 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -315,7 +315,26 @@ 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, cx->fp->scopeChain, s,
+ ((SwfdecScript *) cx->fp->swf)->version < 7);
+ return JS_TRUE;
+}
+
+static JSBool
+swfdec_action_set_variable (JSContext *cx, guint action, const guint8 *data, guint len)
+{
+ const char *s;
+
+...
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
...: 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, s);
+ return JS_TRUE;
+}
+
/*** PRINT FUNCTIONS ***/
static char *
@@ -352,6 +365,7 @@ swfdec_action_print_push (guint action,
break;
case 7: /* 32bit int */
g_string_append_printf (string, "%u", swfdec_bits_get_u32 (&bits));
+ break;
case 8: /* 8bit ConstantP...
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
...j, jsval *val)
-{
- if (JSVAL_IS_STRING (*val)) {
- const char *bytes = swfdec_js_to_string (cx, *val);
- if (bytes == NULL)
- return NULL;
- *val = swfdec_js_eval (cx, obj, bytes);
- return bytes;
- } else {
- if (obj == NULL) {
- obj = OBJ_THIS_OBJECT (cx, cx->fp->scopeChain);
- }
- *val = OBJECT_TO_JSVAL (obj);
- return ".";
- }
-}
-
-static const char *properties[22] = {
- "_x", "_y", "_xscale", "_yscale", "_currentframe",
- "_totalframes", "_alpha", "_visible", &quo...
2007 Mar 15
0
11 commits - libswfdec/swfdec_debugger.c libswfdec/swfdec_debugger.h libswfdec/swfdec_event.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_movie.c libswfdec/swfdec_movie.h libswfdec/swfdec_net_stream.c libswfdec/swfdec_player.c
...ript.c
+++ b/libswfdec/swfdec_script.c
@@ -1662,11 +1662,11 @@ swfdec_action_define_function (JSContext
if (*function_name == '\0') {
/* anonymous function */
fun = JS_NewFunction (cx, NULL, n_args, JSFUN_LAMBDA | JSFUN_HEAVYWEIGHT,
- cx->fp->thisp, NULL);
+ cx->fp->scopeChain, NULL);
} else {
/* named function */
fun = JS_NewFunction (cx, NULL, n_args, JSFUN_HEAVYWEIGHT,
- cx->fp->thisp, function_name);
+ cx->fp->scopeChain, function_name);
}
if (fun == NULL)
return JS_FALSE;
diff-tree dcb79d8d456dd148d4af43af2e22c4573427ed76 (from 0...
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
...s = swfdec_js_to_string (cx, fp->sp[-1]);
+ if (s == NULL)
+ return JS_FALSE;
+ if (!JS_ValueToECMAUint32 (cx, fp->sp[-2], &n_args))
+ return JS_FALSE;
+ if (n_args + 2 > (guint) (fp->sp - fp->spbase))
+ return JS_FALSE;
+
+ obj = OBJ_THIS_OBJECT (cx, cx->fp->scopeChain);
+ if (!JS_GetProperty (cx, obj, s, &fun))
+ return JS_FALSE;
+ fp->sp[-1] = fun;
+ fp->sp[-2] = OBJECT_TO_JSVAL (obj);
+ swfdec_action_call (cx, n_args, 0);
+ return JS_TRUE;
+}
+
static JSBool
swfdec_action_call_method (JSContext *cx, guint action, const guint8 *data, guint l...
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
...*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] = fun;
@@ -589,6 +593,8 @@ swfdec_action_call_method (JSCont...
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
...,7 +1684,7 @@ swfdec_action_define_function (JSContext
*cx->fp->sp++ = OBJECT_TO_JSVAL (fun->object);
} else {
jsval val = OBJECT_TO_JSVAL (fun->object);
- if (!JS_SetProperty (cx, cx->fp->thisp, function_name, &val))
+ if (!JS_SetProperty (cx, cx->fp->scopeChain, function_name, &val))
return JS_FALSE;
}
diff-tree 41a55370d4636e6bb3d39e0e6a3f1af1438df5db (from b86811135dd32ae460e5082f4f986664de624b89)
Author: Benjamin Otte <otte@gnome.org>
Date: Sun Mar 11 13:38:26 2007 +0100
add libswfedit.la files
diff --git a/test/.gitignore...
2007 Mar 28
0
Branch 'as' - 3 commits - libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_context.h libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h libswfdec/swfdec_as_types.c
...as 4 registers */
+ script->n_registers = 5;
/* These flags are the default arguments used by scripts read from a file.
* DefineFunction and friends override this */
script->flags = SWFDEC_SCRIPT_SUPPRESS_ARGS;
@@ -3102,7 +3114,7 @@ swfdec_script_execute (SwfdecScript *scr
frame.scopeChain = obj;
frame.varobj = obj;
/* allocate stack for variables */
- frame.nvars = 4;
+ frame.nvars = script->n_registers;
frame.vars = js_AllocRawStack (cx, frame.nvars, &mark);
if (frame.vars == NULL) {
return JS_FALSE;
diff --git a/libswfdec/swfdec_script.h b/libswfdec/swfde...
2007 Apr 27
0
Changes to 'refs/tags/0.4.3'
...it a Buffer.Full when we're full and in eof
add swfdec_loader_[gs]et_size
API was broken by adding new members to SwfdecLoader struct, so update libversion
implement swfdec_loader_get_loaded to query the already loaded amount of bytes
make named functions set varobj, not scopeChain
implement NetStream::bytesLoaded and NetStream::bytesTotal
add a test to confirm that registerClass does not effect previous instances
add some fixes for number conversion
compute new width/height relative to original width/height, not current one
update to new SwfdecL...
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
...: Fri Mar 9 17:38:34 2007 +0100
add an spend member to JSStackFrame to track the end of the stack
diff --git a/libswfdec/js/jsinterp.c b/libswfdec/js/jsinterp.c
index ab095f6..121962f 100644
--- a/libswfdec/js/jsinterp.c
+++ b/libswfdec/js/jsinterp.c
@@ -844,6 +844,7 @@ have_fun:
frame.scopeChain = NULL; /* set below for real, after cx->fp is set */
frame.pc = NULL;
frame.spbase = NULL;
+ frame.spend = NULL;
frame.sharpDepth = 0;
frame.sharpArray = NULL;
frame.dormantNext = NULL;
@@ -1138,6 +1139,7 @@ js_Execute(JSContext *cx, JSObject *chai
frame.pc =...