gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10214: Test and implement __resolve


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10214: Test and implement __resolve property. Fixes the Flickr flash badge
Date: Fri, 31 Oct 2008 13:04:41 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10214
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Fri 2008-10-31 13:04:41 +0100
message:
  Test and implement __resolve property. Fixes the Flickr flash badge
  (example: 
http://www.widgetbox.com/widget/92061296-1f33-4713-bd33-11182bd5c7f5)
  (although the photos temporarily disappear when they should stay visible).
modified:
  libcore/as_object.cpp
  libcore/namedStrings.cpp
  libcore/namedStrings.h
  testsuite/actionscript.all/Object.as
=== modified file 'libcore/as_object.cpp'
--- a/libcore/as_object.cpp     2008-10-25 18:51:18 +0000
+++ b/libcore/as_object.cpp     2008-10-31 12:04:41 +0000
@@ -309,7 +309,20 @@
 
        Property* prop = findProperty(name, nsname);
        if (!prop)
-               return false;
+    {
+        /// If the property isn't found, try the __resolve property.
+        prop = findProperty(NSV::PROP_uuRESOLVE, nsname);
+        if (!prop) return false;
+
+        /// If __resolve exists, call it with the name of the undefined
+        /// property.
+        string_table& st = _vm.getStringTable();
+        const std::string& undefinedName = st.value(name);
+        log_debug("__resolve exists, calling with '%s'", undefinedName);
+
+        *val = callMethod(NSV::PROP_uuRESOLVE, undefinedName);
+        return true;
+    }
 
        try 
        {
@@ -526,7 +539,8 @@
 {
        static string_table::key key = NSV::PROP_uuPROTOuu;
 
-       // TODO: check what happens if __proto__ is set as a user-defined 
getter/setter
+       // TODO: check what happens if __proto__ is set as a user-defined 
+    // getter/setter
        // TODO: check triggers !!
        _members.setValue(key, as_value(proto.get()), *this, 0, flags);
 }

=== modified file 'libcore/namedStrings.cpp'
--- a/libcore/namedStrings.cpp  2008-10-26 10:40:03 +0000
+++ b/libcore/namedStrings.cpp  2008-10-31 12:04:41 +0000
@@ -117,6 +117,7 @@
        string_table::svt( "__proto__", NSV::PROP_uuPROTOuu ),
        string_table::svt( "prototype", NSV::PROP_PROTOTYPE ),
        string_table::svt( "push", NSV::PROP_PUSH ),
+       string_table::svt( "__resolve", NSV::PROP_uuRESOLVE ),
        string_table::svt( "r", NSV::PROP_R ),
        string_table::svt( "removeListener", NSV::PROP_REMOVE_LISTENER ),
        string_table::svt( "rightMargin", NSV::PROP_RIGHT_MARGIN ),

=== modified file 'libcore/namedStrings.h'
--- a/libcore/namedStrings.h    2008-10-26 10:40:03 +0000
+++ b/libcore/namedStrings.h    2008-10-31 12:04:41 +0000
@@ -205,6 +205,7 @@
                PROP_uTOTALFRAMES,
                PROP_uuCONSTRUCTORuu,
                PROP_uuPROTOuu,
+        PROP_uuRESOLVE,
                PROP_uURL,
                PROP_uVISIBLE,
                PROP_uWIDTH,

=== modified file 'testsuite/actionscript.all/Object.as'
--- a/testsuite/actionscript.all/Object.as      2008-04-28 15:09:59 +0000
+++ b/testsuite/actionscript.all/Object.as      2008-10-31 12:04:41 +0000
@@ -844,11 +844,42 @@
 nothing2.valueOf = function() { return "valueOf"; };
 check_equals ("string + " + nothing2, "string + valueOf");
 
+/// Test __resolve property
+
+o = {};
+check_equals(o.a, undefined);
+check_equals(o.b, undefined);
+
+resolveCalled = 0;
+
+delete result;
+
+o.__resolve = function(arg) {
+    result = arg;
+    resolveCalled++;
+    return "passed";
+};
+
+check_equals(o.a, "passed");
+check_equals(typeof(result), "string");
+check_equals(resolveCalled, 1);
+check_equals(result, "a");
+
+check_equals(o.b, "passed");
+check_equals(typeof(result), "string");
+check_equals(resolveCalled, 2);
+check_equals(result, "b");
+
+check_equals(o.quibbleDibblePropertyWithASillyName, "passed");
+check_equals(typeof(result), "string");
+check_equals(resolveCalled, 3);
+check_equals(result, "quibbleDibblePropertyWithASillyName");
+
 #if OUTPUT_VERSION <= 5
-totals(83);
+totals(97);
 #endif
 
 #if OUTPUT_VERSION >= 6
-totals(262);
+totals(276);
 #endif
 


reply via email to

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