[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10517: AS corrections, some swfdec
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10517: AS corrections, some swfdec test passes. |
Date: |
Thu, 08 Jan 2009 08:05:33 +0100 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10517
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2009-01-08 08:05:33 +0100
message:
AS corrections, some swfdec test passes.
modified:
libcore/as_environment.cpp
libcore/asobj/AsBroadcaster.cpp
libcore/asobj/AsBroadcaster.h
libcore/asobj/ClassHierarchy.cpp
libcore/asobj/Global.cpp
libcore/asobj/LoadableObject.cpp
libcore/movie_root.cpp
libcore/vm/ASHandlers.cpp
testsuite/swfdec/PASSING
------------------------------------------------------------
revno: 10513.1.3
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Wed 2009-01-07 13:19:14 +0100
message:
Prop flags of _customHeaders.
modified:
libcore/asobj/LoadableObject.cpp
------------------------------------------------------------
revno: 10513.1.4
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Wed 2009-01-07 14:41:57 +0100
message:
Add more checks for invalid variables names. Passes swfdec tests, though
it's not entirely clear if this is the correct place to check.
modified:
libcore/as_environment.cpp
libcore/vm/ASHandlers.cpp
------------------------------------------------------------
revno: 10513.1.5
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Wed 2009-01-07 14:57:11 +0100
message:
Cleanup.
modified:
libcore/as_environment.cpp
------------------------------------------------------------
revno: 10513.1.6
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Wed 2009-01-07 16:23:27 +0100
message:
Silence debugging.
modified:
libcore/as_environment.cpp
------------------------------------------------------------
revno: 10513.1.7
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Wed 2009-01-07 16:27:53 +0100
message:
Correct AsBroadcaster prop_flags, allowing override. Register native.
modified:
libcore/asobj/AsBroadcaster.cpp
libcore/asobj/AsBroadcaster.h
libcore/asobj/ClassHierarchy.cpp
libcore/asobj/Global.cpp
=== modified file 'libcore/as_environment.cpp'
--- a/libcore/as_environment.cpp 2008-12-30 15:18:25 +0000
+++ b/libcore/as_environment.cpp 2009-01-07 15:23:27 +0000
@@ -124,23 +124,30 @@
return get_variable(varname, empty_scopeStack);
}
-static bool validRawVariableName(const std::string& varname)
+static bool
+validRawVariableName(const std::string& varname)
{
+ if (varname.empty()) return false;
+
+ if (varname[0] == '.') return false;
+
+ if (varname[0] == ':' &&
+ varname.find_first_of(":.", 1) == std::string::npos) {
+ return false;
+ }
return (varname.find(":::") == std::string::npos);
}
as_value
-as_environment::get_variable_raw(
- const std::string& varname,
+as_environment::get_variable_raw(const std::string& varname,
const ScopeStack& scopeStack, as_object** retTarget) const
// varname must be a plain variable name; no path parsing.
{
#ifdef GNASH_DEBUG_GET_VARIABLE
log_debug(_("get_variable_raw(%s)"), varname);
#endif
- //assert(strchr(varname.c_str(), ':') == NULL);
- if ( ! validRawVariableName(varname) )
+ if (!validRawVariableName(varname))
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("Won't get invalid raw variable name: %s"), varname);
@@ -164,7 +171,8 @@
{
// Found the var in with context.
#ifdef GNASH_DEBUG_GET_VARIABLE
- log_debug("Found %s in object %d/%d of scope stack (%p)", varname,
i, scopeStack.size(), obj);
+ log_debug("Found %s in object %d/%d of scope stack (%p)",
+ varname, i, scopeStack.size(), obj);
#endif
if ( retTarget ) *retTarget = obj;
return val;
@@ -299,9 +307,7 @@
// Given a path to variable, set its value.
void
-as_environment::set_variable(
- const std::string& varname,
- const as_value& val,
+as_environment::set_variable(const std::string& varname, const as_value& val,
const ScopeStack& scopeStack)
{
IF_VERBOSE_ACTION (
@@ -316,29 +322,26 @@
//log_debug(_("set_variable(%s, %s)"), varname, val);
if ( parse_path(varname, path, var) )
{
- //log_debug(_("Variable '%s' parsed into path='%s', var='%s'"),
varname, path, var);
- //target = find_target(path);
target = find_object(path, &scopeStack);
- if (target)
- {
- target->set_member(_vm.getStringTable().find(var), val);
- }
- else
- {
- IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("Path target '%s' not found while setting %s=%s"),
- path, varname, val);
- );
- }
- } else {
- set_variable_raw(varname, val, scopeStack);
+ if (target)
+ {
+ target->set_member(_vm.getStringTable().find(var), val);
+ }
+ else
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Path target '%s' not found while setting %s=%s"),
+ path, varname, val);
+ );
+ }
+ }
+ else {
+ set_variable_raw(varname, val, scopeStack);
}
}
void
-as_environment::set_variable(
- const std::string& varname,
- const as_value& val)
+as_environment::set_variable(const std::string& varname, const as_value& val)
{
static ScopeStack empty_scopeStack;
set_variable(varname, val, empty_scopeStack);
@@ -346,16 +349,14 @@
// No path rigamarole.
void
-as_environment::set_variable_raw(
- const std::string& varname,
- const as_value& val,
- const ScopeStack& scopeStack)
+as_environment::set_variable_raw(const std::string& varname,
+ const as_value& val, const ScopeStack& scopeStack)
{
- if ( ! validRawVariableName(varname) )
+ if (!validRawVariableName(varname))
{
IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("Won't set invalid raw variable name: %s"), varname);
+ log_aserror(_("Won't set invalid raw variable name: %s"), varname);
);
return;
}
@@ -376,7 +377,7 @@
as_object* obj = const_cast<as_object*>(scopeStack[i-1].get());
if (obj && obj->set_member(varkey, val, 0, true) )
{
- return;
+ return;
}
}
@@ -415,8 +416,7 @@
}
void
-as_environment::set_variable_raw(
- const std::string& varname,
+as_environment::set_variable_raw( const std::string& varname,
const as_value& val)
{
static ScopeStack empty_scopeStack;
@@ -465,15 +465,15 @@
/* public static */
bool
-as_environment::parse_path(const std::string& var_path_in,
- std::string& path, std::string& var)
+as_environment::parse_path(const std::string& var_path_in, std::string& path,
+ std::string& var)
{
#ifdef DEBUG_TARGET_FINDING
log_debug("parse_path(%s)", var_path_in);
#endif
size_t lastDotOrColon = var_path_in.find_last_of(":.");
- if ( lastDotOrColon == std::string::npos ) return false;
+ if (lastDotOrColon == std::string::npos) return false;
std::string thePath, theVar;
@@ -486,27 +486,23 @@
if ( thePath.empty() ) return false;
- // this check should be performed by callers (getvariable/setvariable in
particular)
+ // this check should be performed by callers (getvariable/setvariable
+ // in particular)
size_t pathlen = thePath.length();
size_t i = pathlen-1;
- size_t contiguoscommas = 0;
+ size_t consecutiveColons = 0;
while ( i && thePath[i--] == ':' )
{
- if ( ++contiguoscommas > 1 )
+ if ( ++consecutiveColons > 1 )
{
#ifdef DEBUG_TARGET_FINDING
- log_debug("path '%s' ends with too many colon chars, not
considering a path", thePath);
+ log_debug("path '%s' ends with too many colon chars, not "
+ "considering a path", thePath);
#endif
return false;
}
}
-#ifdef DEBUG_TARGET_FINDING
- log_debug("contiguoscommas: %d", contiguoscommas);
-#endif
-
- //if ( var.empty() ) return false;
-
path = thePath;
var = theVar;
@@ -514,8 +510,8 @@
}
bool
-as_environment::parse_path(const std::string& var_path,
- as_object** target, as_value& val)
+as_environment::parse_path(const std::string& var_path, as_object** target,
+ as_value& val)
{
std::string path;
std::string var;
@@ -557,7 +553,8 @@
}
as_object*
-as_environment::find_object(const std::string& path_in, const ScopeStack*
scopeStack) const
+as_environment::find_object(const std::string& path_in,
+ const ScopeStack* scopeStack) const
{
#ifdef DEBUG_TARGET_FINDING
log_debug(_("find_object(%s) called"), path_in);
=== modified file 'libcore/asobj/AsBroadcaster.cpp'
--- a/libcore/asobj/AsBroadcaster.cpp 2008-12-27 19:56:32 +0000
+++ b/libcore/asobj/AsBroadcaster.cpp 2009-01-07 15:27:53 +0000
@@ -161,7 +161,6 @@
const int flags = as_prop_flags::dontEnum |
as_prop_flags::dontDelete |
- as_prop_flags::readOnly |
as_prop_flags::onlySWF6Up;
// NOTE: we may add NSV::PROP_INITIALIZE, unavailable at
@@ -170,16 +169,12 @@
// well save the string_table size in case we'll not load
// the class.
obj->init_member("initialize",
- new builtin_function(asbroadcaster_initialize),
- flags);
+ new builtin_function(asbroadcaster_initialize), flags);
obj->init_member(NSV::PROP_ADD_LISTENER,
- new builtin_function(asbroadcaster_addListener),
- flags);
+ new builtin_function(asbroadcaster_addListener), flags);
obj->init_member(NSV::PROP_REMOVE_LISTENER,
- new builtin_function(asbroadcaster_removeListener),
- flags);
- obj->init_member(NSV::PROP_BROADCAST_MESSAGE,
- new builtin_function(asbroadcaster_broadcastMessage),
+ new builtin_function(asbroadcaster_removeListener), flags);
+ obj->init_member(NSV::PROP_BROADCAST_MESSAGE, vm.getNative(101, 12),
flags);
}
@@ -188,7 +183,15 @@
void
-AsBroadcaster_init(as_object& global)
+AsBroadcaster::registerNative(as_object& global)
+{
+ VM& vm = global.getVM();
+ vm.registerNative(asbroadcaster_broadcastMessage, 101, 12);
+}
+
+
+void
+AsBroadcaster::init(as_object& global)
{
// _global.AsBroadcaster is NOT a class, but a simple object
global.init_member("AsBroadcaster", AsBroadcaster::getAsBroadcaster());
@@ -296,6 +299,7 @@
}
+
as_value
asbroadcaster_removeListener(const fn_call& fn)
{
@@ -385,7 +389,7 @@
as_value listenersValue;
// TODO: test if we're supposed to crawl the target object's
- // inheritance chain in case it's own property _listeners
+ // inheritance chain in case its own property _listeners
// has been deleted while another one is found in any base
// class.
if ( ! obj->get_member(NSV::PROP_uLISTENERS, &listenersValue) )
=== modified file 'libcore/asobj/AsBroadcaster.h'
--- a/libcore/asobj/AsBroadcaster.h 2008-12-11 11:34:15 +0000
+++ b/libcore/asobj/AsBroadcaster.h 2009-01-07 15:27:53 +0000
@@ -54,10 +54,12 @@
///
static as_object* getAsBroadcaster();
+ static void registerNative(as_object &global);
+
+ static void init(as_object& global);
+
};
-void AsBroadcaster_init(as_object& global);
-
} // end of gnash namespace
// __ASBROADCASTER_H__
=== modified file 'libcore/asobj/ClassHierarchy.cpp'
--- a/libcore/asobj/ClassHierarchy.cpp 2008-12-31 12:53:47 +0000
+++ b/libcore/asobj/ClassHierarchy.cpp 2009-01-07 15:27:53 +0000
@@ -305,7 +305,7 @@
{ number_class_init, NSV::CLASS_NUMBER, NSV::CLASS_OBJECT, NS_GLOBAL, 5
},
{ TextFormat_as::init, NSV::CLASS_TEXT_FORMAT, NSV::CLASS_OBJECT,
NS_GLOBAL, 5 },
{ key_class_init, NSV::CLASS_KEY, NSV::CLASS_OBJECT, NS_GLOBAL, 5 },
- { AsBroadcaster_init, NSV::CLASS_AS_BROADCASTER, NSV::CLASS_OBJECT,
NS_GLOBAL, 5 },
+ { AsBroadcaster::init, NSV::CLASS_AS_BROADCASTER, NSV::CLASS_OBJECT,
NS_GLOBAL, 5 },
{ textsnapshot_class_init, NSV::CLASS_TEXT_SNAPSHOT, NSV::CLASS_OBJECT,
NSV::NS_FLASH_TEXT, 6 },
{ video_class_init, NSV::CLASS_VIDEO, NSV::CLASS_OBJECT,
NSV::NS_FLASH_MEDIA, 6 },
{ camera_class_init, NSV::CLASS_CAMERA, NSV::CLASS_OBJECT,
NSV::NS_FLASH_UI, 6 },
=== modified file 'libcore/asobj/Global.cpp'
--- a/libcore/asobj/Global.cpp 2008-12-31 12:53:47 +0000
+++ b/libcore/asobj/Global.cpp 2009-01-07 15:27:53 +0000
@@ -581,7 +581,8 @@
if (fn.nargs < 2)
{
IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("ASNative(%s): needs at least two arguments"),
fn.dump_args());
+ log_aserror(_("ASNative(%s): needs at least two arguments"),
+ fn.dump_args());
)
return ret;
}
@@ -694,6 +695,7 @@
registerStageNative(global);
registerSharedObjectNative(global);
+ AsBroadcaster::registerNative(global);
TextFormat_as::registerNative(global);
Date_as::registerNative(global);
Mouse_as::registerNative(global);
=== modified file 'libcore/asobj/LoadableObject.cpp'
--- a/libcore/asobj/LoadableObject.cpp 2008-12-27 19:56:32 +0000
+++ b/libcore/asobj/LoadableObject.cpp 2009-01-07 12:19:14 +0000
@@ -355,7 +355,10 @@
array = new Array_as;
// This property is always initialized on the first call to
// addRequestHeaders.
- ptr->set_member(NSV::PROP_uCUSTOM_HEADERS, array);
+ const int flags = as_prop_flags::dontEnum |
+ as_prop_flags::dontDelete;
+
+ ptr->init_member(NSV::PROP_uCUSTOM_HEADERS, array, flags);
}
if (fn.nargs == 0)
=== modified file 'libcore/movie_root.cpp'
--- a/libcore/movie_root.cpp 2008-12-28 09:40:28 +0000
+++ b/libcore/movie_root.cpp 2009-01-08 07:05:33 +0000
@@ -199,18 +199,21 @@
{
setLevel(0, movie);
- // actions in first frame of _level0 must execute now, before
next advance,
+ // actions in first frame of _level0 must execute now,
+ // before next advance,
// or they'll be executed with _currentframe being set to 2
processActionQueue();
}
catch (ActionLimitException& al)
{
- boost::format fmt = boost::format(_("ActionLimits hit during
setRootMovie: %s. Disable scripts?")) % al.what();
+ boost::format fmt = boost::format(_("ActionLimits hit during "
+ "setRootMovie: %s. Disable scripts?")) % al.what();
handleActionLimitHit(fmt.str());
}
catch (ActionParserException& e)
{
- log_error("ActionParserException thrown during setRootMovie: %s",
e.what());
+ log_error("ActionParserException thrown during setRootMovie: %s",
+ e.what());
}
cleanupAndCollect();
=== modified file 'libcore/vm/ASHandlers.cpp'
--- a/libcore/vm/ASHandlers.cpp 2009-01-05 09:32:03 +0000
+++ b/libcore/vm/ASHandlers.cpp 2009-01-07 13:41:57 +0000
@@ -1037,7 +1037,8 @@
{
IF_VERBOSE_ASCODING_ERRORS (
// Invalid object, can't set.
- log_aserror(_("ActionSetVariable: %s=%s: variable name evaluates
to invalid (empty) string"),
+ log_aserror(_("ActionSetVariable: %s=%s: variable name "
+ "evaluates to invalid (empty) string"),
env.top(1),
env.top(0));
);
=== modified file 'testsuite/swfdec/PASSING'
--- a/testsuite/swfdec/PASSING 2008-12-31 02:22:00 +0000
+++ b/testsuite/swfdec/PASSING 2009-01-08 07:05:33 +0000
@@ -459,6 +459,10 @@
getvariable-dotdot-7.swf:efa5597fe3e61764b6ee937f87d8cf1b
getvariable-dotdot-8.swf:2861d34a85b5de09f41af572e0b1a6a5
getvariable-length-5.swf:2d07e2afdf45356cf2df5c1176ed29ad
+getvariable-setvariable-5.swf:6bdb4be98bfd34cf5c37d237c13a732a
+getvariable-setvariable-6.swf:eec9c92f5871136bdc444595aa26dbb9
+getvariable-setvariable-7.swf:ca4ed5a192fde844558b9b1b91b48a03
+getvariable-setvariable-8.swf:ec8318e00c7e44937c1996f10598887e
getvariable-slashpath-5.swf:3067a6cdf4991af85520d7eb3bb51178
getvariable-slashpath-6.swf:17d6ee6ddb15296e887944d7c7c45432
getvariable-slashpath-7.swf:499213312255eba3746c4ff6b7b4782d
@@ -508,6 +512,9 @@
instance-of-propflags-5.swf:1cab145faaa9544b3b1488c09f6639e5
instance-of-propflags-8.swf:af7c2eee7fa1e572ff330d03d936d959
instance-of-propflags-9.swf:b125071d54db67ae00035fc87ba37a9b
+invalid-variable-name-6.swf:1221e10f77fb8391cbff23a2b889ff70
+invalid-variable-name-7.swf:158fe803e0820e73bdc22eab51e76448
+invalid-variable-name-8.swf:8c86b479ef7a88282d126e3b3db6dd0f
isnan-5.swf:b296bdcf5e062c7263bdeac1df3b08b3
isnan-6.swf:115656233daa53cadfba0c85584567e7
isnan-7.swf:68650298c0f014793884b2d7adea1356
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10517: AS corrections, some swfdec test passes.,
Benjamin Wolsey <=