gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r9709: Fix name clash of PropsSerial


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9709: Fix name clash of PropsSerializer class (fixes bug #24224).
Date: Wed, 10 Sep 2008 01:10:04 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9709
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Wed 2008-09-10 01:10:04 +0200
message:
  Fix name clash of PropsSerializer class (fixes bug #24224).
  Cleanups and tests for SharedObject.
modified:
  libcore/as_value.cpp
  libcore/asobj/SharedObject.cpp
  testsuite/actionscript.all/SharedObject.as
    ------------------------------------------------------------
    revno: 9708.1.1
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-09-10 00:20:51 +0200
    message:
      Make SharedObject.data enumerable, protected from deletion and read-only.
      Test this needs be.
    modified:
      libcore/asobj/SharedObject.cpp
      testsuite/actionscript.all/SharedObject.as
    ------------------------------------------------------------
    revno: 9708.1.2
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-09-10 00:48:49 +0200
    message:
      put PropsSerializer in the anonimous namespace
    modified:
      libcore/asobj/SharedObject.cpp
    ------------------------------------------------------------
    revno: 9708.1.3
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-09-10 00:50:20 +0200
    message:
      put PropsSerializer in the anonimous namespace
    modified:
      libcore/as_value.cpp
=== modified file 'libcore/as_value.cpp'
--- a/libcore/as_value.cpp      2008-09-09 09:55:16 +0000
+++ b/libcore/as_value.cpp      2008-09-09 22:50:20 +0000
@@ -98,6 +98,8 @@
 
 namespace gnash {
 
+namespace { 
+
 // This class is used to iterate through all the properties of an AS object,
 // so we can change them to children of an AMF0 element.
 class PropsSerializer {
@@ -149,6 +151,8 @@
         }
 };
 
+} // anonimous namespace
+
 /// Class used to serialize properties of an object to a buffer
 class PropsBufSerializer {
     SimpleBuffer& _buf;

=== modified file 'libcore/asobj/SharedObject.cpp'
--- a/libcore/asobj/SharedObject.cpp    2008-09-09 10:59:07 +0000
+++ b/libcore/asobj/SharedObject.cpp    2008-09-09 22:48:49 +0000
@@ -66,6 +66,8 @@
 
 void sharedobject_iter(SOL &sol, string_table::key key, const as_value 
&reference);
 
+namespace { 
+
 class PropsSerializer {
     SOL& _sol;
     string_table& _st;
@@ -84,7 +86,7 @@
 
             const std::string& name = _st.string_table::value(key);
 
-//          cerr << "FIXME: yes!!!!! " << name << ": "<< val << std::endl;
+            //log_debug("Serializing SharedObject property %s:%s", name, val);
 
             if (val.is_string()) {
                 std::string str;
@@ -116,12 +118,14 @@
         }
 };
 
+} // anonimous namespace
+
 static void
 attachProperties(as_object& o)
 {
 //    GNASH_REPORT_FUNCTION;
-     as_object *proto = new as_object();
-     o.init_member("data", proto);
+     as_object *proto = new as_object(getObjectInterface());
+     o.init_member("data", proto, 
as_prop_flags::dontDelete|as_prop_flags::readOnly);
 }
 
 static void
@@ -225,6 +229,7 @@
     string_table::key dataKey = vm.getStringTable().find("data");
     
     as_value as = const_cast<SharedObject*>(this)->getMember(dataKey);
+    log_debug("data member of this SharedObject is %s", as);
     boost::intrusive_ptr<as_object> ptr = as.to_object();
     if ( ! ptr ) {
         log_aserror("'data' member of SharedObject is not an object (%s)",

=== modified file 'testsuite/actionscript.all/SharedObject.as'
--- a/testsuite/actionscript.all/SharedObject.as        2008-09-09 10:38:10 
+0000
+++ b/testsuite/actionscript.all/SharedObject.as        2008-09-09 22:20:51 
+0000
@@ -157,9 +157,23 @@
 xcheck_equals(getCalls, 0); // flush didn't cal the getter
 
 //------------------------------------------
+// Test that 'data' is enumerable, read-only
+// and protected from deletion
+//------------------------------------------
+
+so6 = SharedObject.getLocal("so6");
+a = new Array;
+for (var i in so6) a.push(i);
+xcheck_equals(a.toString(), 'data');
+delete so6;
+check_equals(typeof(so.data), 'object');
+so6.data = 5;
+check_equals(typeof(so.data), 'object');
+
+//------------------------------------------
 // END OF TESTS
 //------------------------------------------
 
-check_totals(42);
+check_totals(45);
 
 #endif // OUTPUT_VERSION >= 6


reply via email to

[Prev in Thread] Current Thread [Next in Thread]