Author: toshok
Date: 2008-02-16 01:47:52 -0500 (Sat, 16 Feb 2008)
New Revision: 95851

Modified:
   trunk/moon/plugin/ChangeLog
   trunk/moon/plugin/plugin-class.cpp
Log:
2008-02-15  Chris Toshok  <[EMAIL PROTECTED]>

        * plugin-class.cpp (MoonlightStoryboardObject::Invoke): the seek
        method can take either an integer or a string representing a
        timespan.  Fixes the JS errors I mentioned in bug #362380.



Modified: trunk/moon/plugin/ChangeLog
===================================================================
--- trunk/moon/plugin/ChangeLog 2008-02-15 23:33:55 UTC (rev 95850)
+++ trunk/moon/plugin/ChangeLog 2008-02-16 06:47:52 UTC (rev 95851)
@@ -1,3 +1,9 @@
+2008-02-15  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * plugin-class.cpp (MoonlightStoryboardObject::Invoke): the seek
+       method can take either an integer or a string representing a
+       timespan.  Fixes the JS errors I mentioned in bug #362380.
+
 2008-02-06  Jackson Harper  <[EMAIL PROTECTED]>
 
        * plugin-class.cpp|h: Store all MoonlightDependencyObject classes

Modified: trunk/moon/plugin/plugin-class.cpp
===================================================================
--- trunk/moon/plugin/plugin-class.cpp  2008-02-15 23:33:55 UTC (rev 95850)
+++ trunk/moon/plugin/plugin-class.cpp  2008-02-16 06:47:52 UTC (rev 95851)
@@ -2691,11 +2691,21 @@
                return true;
 
        case MoonId_Seek: {
-               // XXX JS doesn't have 64bit ints?
-               if (argCount != 1 || !NPVARIANT_IS_INT32 (args[0]))
+               if (argCount != 1)
                        THROW_JS_EXCEPTION ("seek");
+               
+               TimeSpan ts;
 
-               TimeSpan ts = (TimeSpan)NPVARIANT_TO_INT32(args[0]);
+               if (NPVARIANT_IS_INT32 (args[0])) {
+                       ts = (TimeSpan)NPVARIANT_TO_INT32(args[0]);
+               }
+               else if (NPVARIANT_IS_STRING (args[0])) {
+                       if (!time_span_from_str (STR_FROM_VARIANT (args[0]), 
&ts))
+                               THROW_JS_EXCEPTION ("seek");
+               }
+               else
+                       THROW_JS_EXCEPTION ("seek");
+                     
                sb->Seek (ts);
 
                VOID_TO_NPVARIANT (*result);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to