gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10647: Allow MovieClip.getURL() to


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10647: Allow MovieClip.getURL() to be called as a method of any as_object. Fixes
Date: Tue, 03 Mar 2009 11:27:33 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10647
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2009-03-03 11:27:33 +0100
message:
  Allow MovieClip.getURL() to be called as a method of any as_object. Fixes
  more YouTube widgets. Thanks again to Michael Fötsch <address@hidden>
  for locating the bug.
  
  Test MovieClip.getSWFVersion() when attached to other objects.
modified:
  libcore/MovieClip.cpp
  testsuite/actionscript.all/MovieClip.as
=== modified file 'libcore/MovieClip.cpp'
--- a/libcore/MovieClip.cpp     2009-02-27 11:55:27 +0000
+++ b/libcore/MovieClip.cpp     2009-03-03 10:27:33 +0000
@@ -910,7 +910,6 @@
 
     // I'm not sure ENTERFRAME goes in a different queue then DOACTION...
     queueEvent(event_id::ENTER_FRAME, movie_root::apDOACTION);
-    //queueEvent(event_id::ENTER_FRAME, apENTERFRAME);
 
     // Update current and next frames.
     if (m_play_state == PLAY)
@@ -3955,13 +3954,15 @@
 
 /// MovieClip.getURL(url:String[, window:String[, method:String]])
 //
-/// TODO: test this properly.
+/// Tested manually to function as a method of any as_object. Hard to
+/// test automatically as it doesn't return anything and only has external
+/// side-effects.
 /// Returns void.
 as_value
 movieclip_getURL(const fn_call& fn)
 {
-    boost::intrusive_ptr<MovieClip> movieclip = 
-            ensureType<MovieClip>(fn.this_ptr);
+    boost::intrusive_ptr<as_object> movieclip =
+        ensureType<as_object>(fn.this_ptr);
 
     std::string urlstr;
     std::string target;
@@ -4006,8 +4007,7 @@
 
     std::string vars;
 
-    if (method != MovieClip::METHOD_NONE)
-    {
+    if (method != MovieClip::METHOD_NONE) {
         // Get encoded vars.
         movieclip->getURLEncodedVars(vars);
     }
@@ -4023,8 +4023,8 @@
 as_value
 movieclip_getSWFVersion(const fn_call& fn)
 {
-    boost::intrusive_ptr<MovieClip> movieclip =
-            ensureType<MovieClip>(fn.this_ptr);
+    boost::intrusive_ptr<MovieClip> movieclip = 
+        ensureType<MovieClip>(fn.this_ptr);
 
     return as_value(movieclip->getSWFVersion());
 }

=== modified file 'testsuite/actionscript.all/MovieClip.as'
--- a/testsuite/actionscript.all/MovieClip.as   2009-02-25 22:33:03 +0000
+++ b/testsuite/actionscript.all/MovieClip.as   2009-03-03 10:27:33 +0000
@@ -111,19 +111,19 @@
 endOfTest = function() 
 {
 #if OUTPUT_VERSION <= 5
-       check_totals(327); // SWF5
+       check_totals(332); // SWF5
 #endif
 
 #if OUTPUT_VERSION == 6
-       check_totals(884); // SWF6
+       check_totals(889); // SWF6
 #endif
 
 #if OUTPUT_VERSION == 7
-       check_totals(901); // SWF7
+       check_totals(906); // SWF7
 #endif
 
 #if OUTPUT_VERSION >= 8
-       check_totals(993); // SWF8+
+       check_totals(998); // SWF8+
 #endif
 
        play();
@@ -2304,4 +2304,20 @@
 
 // Can't rely on this to call onData!
 
+// Check MovieClip methods on other objects.
+check_equals(_root.getSWFVersion(), OUTPUT_VERSION);
+o = {};
+o.getSWFVersion = MovieClip.prototype.getSWFVersion;
+xcheck_equals(o.getSWFVersion(), -1);
+createTextField("t1", 3, 0, 100, 100, 100);
+#if OUTPUT_VERSION > 5
+check_equals(_level0.t1.getSWFVersion(), undefined);
+#else
+xcheck_equals(_level0.t1.getSWFVersion(), OUTPUT_VERSION);
+#endif
+xcheck_equals(_level0.t1.toString(), "[object Object]");
+_level0.t1.getSWFVersion = MovieClip.prototype.getSWFVersion;
+xcheck_equals(_level0.t1.getSWFVersion(), OUTPUT_VERSION);
+
+
 //endOfTest();


reply via email to

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