[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/asobj/ClassHierarchy.cpp...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/asobj/ClassHierarchy.cpp... |
Date: |
Mon, 31 Mar 2008 22:12:06 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/03/31 22:12:06
Modified files:
. : ChangeLog
server/asobj : ClassHierarchy.cpp
testsuite/swfdec: PASSING
Log message:
Consider that __proto__ might be non-visible but existing for native
functions. Add debugging and error logging.
This is my first commit in this file. The code looks pretty prone to
compatibility issues, and contains some conceptual errors (like all
classes advertised to derive from Object, while indeed they derive from
Function).
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6128&r2=1.6129
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/ClassHierarchy.cpp?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/swfdec/PASSING?cvsroot=gnash&r1=1.115&r2=1.116
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6128
retrieving revision 1.6129
diff -u -b -r1.6128 -r1.6129
--- ChangeLog 31 Mar 2008 20:28:37 -0000 1.6128
+++ ChangeLog 31 Mar 2008 22:12:05 -0000 1.6129
@@ -1,3 +1,11 @@
+2008-03-31 Sandro Santilli <address@hidden>
+
+ * server/asobj/ClassHierarchy.cpp: use hasOwnProperty to find out
+ if a native class initialized its own __proto__ as get_member
+ won't return a non-visible one; add debugging and error
+ logging while loading on-demand classes.
+ * testsuite/swfdec/PASSING: boolean-properties-5.swf passes.
+
2008-03-31 Benjamin Wolsey <address@hidden>
* server/asobj/Date.cpp: drop dead code. Be more careful
Index: server/asobj/ClassHierarchy.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/ClassHierarchy.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/asobj/ClassHierarchy.cpp 30 Mar 2008 12:55:48 -0000 1.10
+++ server/asobj/ClassHierarchy.cpp 31 Mar 2008 22:12:05 -0000 1.11
@@ -89,6 +89,9 @@
virtual as_value operator()(const fn_call& /*fn*/)
{
+ string_table& st = VM::get().getStringTable();
+ log_debug("Loading extension class %s",
st.value(mDeclaration.name));
+
as_value super;
if (mDeclaration.super_name)
{
@@ -97,14 +100,18 @@
if (!mTarget->get_member(mDeclaration.super_name,
&super))
{
// Error here -- doesn't exist.
- // TODO: Log the error.
+ log_error("Can't find %s (Superclass of %s)",
+ st.value(mDeclaration.super_name),
+ st.value(mDeclaration.name));
super.set_undefined();
return super;
}
if (!super.is_as_function())
{
// Error here -- not an object.
- // TODO: Log the error.
+ log_error("%s (Superclass of %s) is not a
function (%s)",
+ st.value(mDeclaration.super_name),
+ st.value(mDeclaration.name),
super.to_debug_string());
super.set_undefined();
return super;
}
@@ -115,12 +122,14 @@
// Successfully loaded it, now find it, set its proto,
and return.
as_value us;
mTarget->get_member(mDeclaration.name, &us);
- if (mDeclaration.super_name &&
!us.to_object()->get_prototype())
+ if (mDeclaration.super_name &&
!us.to_object()->hasOwnProperty(NSV::PROP_uuPROTOuu))
+ {
us.to_object()->set_prototype(super.to_as_function()->getPrototype());
- fprintf(stderr, "Loaded ourselves.\n");
+ }
return us;
}
// Error here -- not successful in loading.
+ log_error("Could not load class %s",
st.value(mDeclaration.name));
super.set_undefined();
return super;
}
@@ -141,12 +150,22 @@
as_function(getObjectInterface()),
mDeclaration(c), mTarget(g), mExtension(e)
{
+ // does it make any sense to set a 'constructor' here ??
//init_member("constructor", this);
- init_member("constructor",
as_function::getFunctionConstructor().get());
+ //init_member("constructor",
as_function::getFunctionConstructor().get());
}
virtual as_value operator()(const fn_call& /*fn*/)
{
+ string_table& st = VM::get().getStringTable();
+
+ log_debug("Loading native class %s",
st.value(mDeclaration.name));
+
+ mDeclaration.initializer(*mTarget);
+ // Successfully loaded it, now find it, set its proto, and
return.
+ as_value us;
+ if ( mTarget->get_member(mDeclaration.name, &us) )
+ {
as_value super;
if (mDeclaration.super_name)
{
@@ -155,24 +174,38 @@
if (!mTarget->get_member(mDeclaration.super_name,
&super))
{
// Error here -- doesn't exist.
- // TODO: Log the error.
+ log_error("Can't find %s (Superclass of
%s)",
+
st.value(mDeclaration.super_name),
+ st.value(mDeclaration.name));
super.set_undefined();
return super;
}
if (!super.is_as_function())
{
// Error here -- not an object.
- // TODO: Log the error.
+ log_error("%s (Superclass of %s) is not
a function (%s)",
+
st.value(mDeclaration.super_name),
+ st.value(mDeclaration.name),
super.to_debug_string());
super.set_undefined();
return super;
}
+ assert(super.to_as_function());
}
- mDeclaration.initializer(*mTarget);
- // Successfully loaded it, now find it, set its proto, and
return.
- as_value us;
- mTarget->get_member(mDeclaration.name, &us);
- if (mDeclaration.super_name && !us.to_object()->get_prototype())
+ if ( ! us.to_object() )
+ {
+ log_error("Native class %s is not an object
after initialization (%s)",
+ st.value(mDeclaration.name),
us.to_debug_string());
+ }
+ if (mDeclaration.super_name &&
!us.to_object()->hasOwnProperty(NSV::PROP_uuPROTOuu))
+ {
us.to_object()->set_prototype(super.to_as_function()->getPrototype());
+ }
+ }
+ else
+ {
+ log_error("Native class %s is not found after
initialization",
+ st.value(mDeclaration.name));
+ }
return us;
}
};
Index: testsuite/swfdec/PASSING
===================================================================
RCS file: /sources/gnash/gnash/testsuite/swfdec/PASSING,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -b -r1.115 -r1.116
--- testsuite/swfdec/PASSING 31 Mar 2008 19:43:57 -0000 1.115
+++ testsuite/swfdec/PASSING 31 Mar 2008 22:12:06 -0000 1.116
@@ -63,6 +63,7 @@
bitwise-8.swf:a99b312eddd076f8b9df649bc4b33964
blur-filter-properties-5.swf:4c29ecc04df379ced45039fdbb79eb9c
blur-filter-properties-5.swf:f2e1d9ccc47765bd6c88095b19974c7b
+boolean-properties-5.swf:d955b32271cf8a073de42566eb13a5d8
boolean-properties-6.swf:606b0b8883de19dce98bbeb9c91e0215
boolean-properties-7.swf:f01da3f46a6a70f22682ad6655e1be6a
boolean-properties-8.swf:bcb5f70be1ae877fb31c198925ba1375
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/asobj/ClassHierarchy.cpp...,
Sandro Santilli <=