CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/12/21 00:10:12
Modified files: . : ChangeLog server/asobj : xmlnode.cpp testsuite/actionscript.all: XML.as Log message: make XMLNode.attributes members enumerable (and test it) CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5233&r2=1.5234 http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xmlnode.cpp?cvsroot=gnash&r1=1.42&r2=1.43 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/XML.as?cvsroot=gnash&r1=1.52&r2=1.53 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.5233 retrieving revision 1.5234 diff -u -b -r1.5233 -r1.5234 --- ChangeLog 20 Dec 2007 23:29:03 -0000 1.5233 +++ ChangeLog 21 Dec 2007 00:10:11 -0000 1.5234 @@ -1,5 +1,12 @@ 2007-12-20 Sandro Santilli <[EMAIL PROTECTED]> + * server/asobj/xmlnode.cpp: make XMLNode.attributes + members enumerable. + * testsuite/actionscript.all/XML.as: test enumerability + of XMLNode.attributes. + +2007-12-20 Sandro Santilli <[EMAIL PROTECTED]> + * server/asobj/xmlnode.cpp: attributes are note instances of Object class. * testsuite/actionscript.all/XML.as: few more fixes. Index: server/asobj/xmlnode.cpp =================================================================== RCS file: /sources/gnash/gnash/server/asobj/xmlnode.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -u -b -r1.42 -r1.43 --- server/asobj/xmlnode.cpp 20 Dec 2007 23:29:04 -0000 1.42 +++ server/asobj/xmlnode.cpp 21 Dec 2007 00:10:11 -0000 1.43 @@ -16,7 +16,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -/* $Id: xmlnode.cpp,v 1.42 2007/12/20 23:29:04 strk Exp $ */ +/* $Id: xmlnode.cpp,v 1.43 2007/12/21 00:10:11 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -30,6 +30,8 @@ #include "xmlnode.h" #include "log.h" #include "Object.h" // for getObjectInterface +#include "VM.h" // for getting the string_table.. +#include "string_table.h" // ..for using the string_table #include <boost/algorithm/string/case_conv.hpp> @@ -630,19 +632,27 @@ static as_value xmlnode_attributes(const fn_call& fn) { -// GNASH_REPORT_FUNCTION; + //GNASH_REPORT_FUNCTION; boost::intrusive_ptr<XMLNode> ptr = ensureType<XMLNode>(fn.this_ptr); + VM& vm = ptr->getVM(); + string_table& st = vm.getStringTable(); + XMLNode::AttribList& attrs = ptr->attributes(); + //log_debug("Node %p has %d attributes", (void*)ptr.get(), attrs.size()); + boost::intrusive_ptr<as_object> ret = new as_object(); // attributes are not Object types (getObjectInterface()); for (XMLNode::AttribList::const_iterator it=attrs.begin(), - itEnd=attrs.end(); it != itEnd; ++it) { + itEnd=attrs.end(); it != itEnd; ++it) + { const XMLAttr& at = *it; const std::string& name = at.name(); const std::string& val = at.value(); - ret->init_member(name, val); + //log_debug("%s: %s", name.c_str(), val.c_str()); + // These must be enumerable ! + ret->set_member(st.find(name), val); } return as_value(ret); Index: testsuite/actionscript.all/XML.as =================================================================== RCS file: /sources/gnash/gnash/testsuite/actionscript.all/XML.as,v retrieving revision 1.52 retrieving revision 1.53 diff -u -b -r1.52 -r1.53 --- testsuite/actionscript.all/XML.as 20 Dec 2007 23:29:04 -0000 1.52 +++ testsuite/actionscript.all/XML.as 21 Dec 2007 00:10:12 -0000 1.53 @@ -20,7 +20,7 @@ // compile this test case with Ming makeswf, and then // execute it like this gnash -1 -r 0 -v out.swf -rcsid="$Id: XML.as,v 1.52 2007/12/20 23:29:04 strk Exp $"; +rcsid="$Id: XML.as,v 1.53 2007/12/21 00:10:12 strk Exp $"; #include "check.as" //#include "dejagnu.as" @@ -325,9 +325,16 @@ check_equals(typeof(nextSibling), 'null'); check_equals(typeof(previousSibling), 'null'); + // Check attributes check_equals(typeof(attributes), 'object'); check_equals(attributes.tna1, 'tna1val'); check_equals(attributes.tna2, 'tna2val'); + // Check attributes enumerability + var attrcopy = {}; + for (var i in attributes) attrcopy[i] = attributes[i]; + check_equals(attrcopy.tna1, 'tna1val'); + check_equals(attrcopy.tna2, 'tna2val'); + // Check that nodeValue is overridable nodeValue = 4; @@ -712,9 +719,9 @@ if ( this.onLoadCalls == 2 ) { #if OUTPUT_VERSION < 6 - check_totals(262); + check_totals(264); #else - check_totals(337); + check_totals(339); #endif play(); } _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit