[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/as_object.cpp testsuite/...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/as_object.cpp testsuite/... |
Date: |
Mon, 31 Mar 2008 11:58:47 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/03/31 11:58:47
Modified files:
. : ChangeLog
server : as_object.cpp
testsuite/actionscript.all: String.as
Log message:
Respect visibility flag also for __proto__.
Add tests for String.__proto__ exising and exposable after
assetpropflags
call.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6113&r2=1.6114
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.cpp?cvsroot=gnash&r1=1.107&r2=1.108
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/String.as?cvsroot=gnash&r1=1.52&r2=1.53
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6113
retrieving revision 1.6114
diff -u -b -r1.6113 -r1.6114
--- ChangeLog 31 Mar 2008 11:56:43 -0000 1.6113
+++ ChangeLog 31 Mar 2008 11:58:46 -0000 1.6114
@@ -1,5 +1,10 @@
2008-03-31 Sandro Santilli <address@hidden>
+ * server/as_object.cpp (findProperty): respect visibility flag also
+ for __proto__.
+ * testsuite/actionscript.all/String.as: test that __proto__ of String
+ still exists, but it's not-visible (assetpropflags can be used to
+ unhide).
* server/as_function.cpp: __proto__ is still attached to functions in
SWF5, only not-visible (a flag).
* server/asobj/Object.cpp: register natives despite swf version.
Index: server/as_object.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.cpp,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -b -r1.107 -r1.108
--- server/as_object.cpp 19 Mar 2008 14:36:21 -0000 1.107
+++ server/as_object.cpp 31 Mar 2008 11:58:46 -0000 1.108
@@ -405,18 +405,25 @@
as_object::findProperty(string_table::key key, string_table::key nsname,
as_object **owner)
{
+ int swfVersion = _vm.getSWFVersion();
+
// don't enter an infinite loop looking for __proto__ ...
if (key == NSV::PROP_uuPROTOuu && !nsname)
{
+ Property* prop = _members.getProperty(key, nsname);
+ // TODO: add ignoreVisibility parameter to allow using
__proto__ even when not visible ?
+ if (prop && prop->isVisible(swfVersion))
+ {
if (owner != NULL)
*owner = this;
- return _members.getProperty(key, nsname);
+ return prop;
+ }
+ return NULL;
}
// keep track of visited objects, avoid infinite loops.
std::set<as_object*> visited;
- int swfVersion = _vm.getSWFVersion();
int i = 0;
boost::intrusive_ptr<as_object> obj = this;
@@ -451,7 +458,7 @@
// We won't scan the inheritance chain if we find a member,
// even if invisible.
//
- if ( prop ) return prop;
+ if ( prop ) return prop; // TODO: what about isVisible ?
// don't enter an infinite loop looking for __proto__ ...
if (key == NSV::PROP_uuPROTOuu) return NULL;
Index: testsuite/actionscript.all/String.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/String.as,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- testsuite/actionscript.all/String.as 31 Mar 2008 07:25:26 -0000
1.52
+++ testsuite/actionscript.all/String.as 31 Mar 2008 11:58:47 -0000
1.53
@@ -17,7 +17,7 @@
// Original author: Mike Carlson - June 19th, 2006
-rcsid="$Id: String.as,v 1.52 2008/03/31 07:25:26 zoulunkai Exp $";
+rcsid="$Id: String.as,v 1.53 2008/03/31 11:58:47 strk Exp $";
#include "check.as"
check_equals(typeof(String), 'function');
@@ -783,8 +783,22 @@
check(a.hasOwnProperty('length'));
#endif
+//----------------------------------------------------------------------
+// Test that __proto__ is only hidden, but still existing , in SWF5
+//----------------------------------------------------------------------
+
+ASSetPropFlags(String, "__proto__", 0, 5248); // unhide String.__proto__
+check_equals(typeof(String.__proto__), 'object');
+check_equals(typeof(Object.prototype), 'object');
+Object.prototype.gotcha = 1;
+check_equals(String.gotcha, 1);
+Object.prototype.hasOwnProperty = ASnative (101, 5);
+check(!String.__proto__.hasOwnProperty("gotcha"));
+check(String.__proto__.__proto__.hasOwnProperty("gotcha")); // function
+check_equals(String.__proto__.__proto__, Object.prototype);
+
#if OUTPUT_VERSION < 6
- check_totals(213);
+ check_totals(219);
#else
- check_totals(247);
+ check_totals(253);
#endif