gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10038: ExternalInterface.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10038: ExternalInterface.
Date: Tue, 21 Oct 2008 18:26:41 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10038
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2008-10-21 18:26:41 +0200
message:
  ExternalInterface.
modified:
  libcore/asobj/flash/external/ExternalInterface_as.cpp
  testsuite/actionscript.all/ExternalInterface.as
    ------------------------------------------------------------
    revno: 10029.1.4
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Tue 2008-10-21 17:50:46 +0200
    message:
      Stub all known methods of ExternalInterface. Make them properly static
      so that they log unimplemented when called.
    modified:
      libcore/asobj/flash/external/ExternalInterface_as.cpp
      testsuite/actionscript.all/ExternalInterface.as
=== modified file 'libcore/asobj/flash/external/ExternalInterface_as.cpp'
--- a/libcore/asobj/flash/external/ExternalInterface_as.cpp     2008-05-07 
09:38:06 +0000
+++ b/libcore/asobj/flash/external/ExternalInterface_as.cpp     2008-10-21 
16:26:41 +0000
@@ -35,11 +35,31 @@
 
 namespace gnash {
 
-
 static as_value ExternalInterface_addCallback(const fn_call& fn);
 static as_value ExternalInterface_call(const fn_call& fn);
+static as_value ExternalInterface_uArgumentsToXML(const fn_call& fn);
+static as_value ExternalInterface_uArgumentsToAS(const fn_call& fn);
+static as_value ExternalInterface_uAddCallback(const fn_call& fn);
+static as_value ExternalInterface_uArrayToAS(const fn_call& fn);
+static as_value ExternalInterface_uArrayToJS(const fn_call& fn);
+static as_value ExternalInterface_uArrayToXML(const fn_call& fn);
+static as_value ExternalInterface_uCallIn(const fn_call& fn);
+static as_value ExternalInterface_uCallOut(const fn_call& fn);
+static as_value ExternalInterface_uEscapeXML(const fn_call& fn);
+static as_value ExternalInterface_uEvalJS(const fn_call& fn);
+static as_value ExternalInterface_uInitJS(const fn_call& fn);
+static as_value ExternalInterface_uJsQuoteString(const fn_call& fn);
+static as_value ExternalInterface_uObjectID(const fn_call& fn);
+static as_value ExternalInterface_uObjectToAS(const fn_call& fn);
+static as_value ExternalInterface_uObjectToJS(const fn_call& fn);
+static as_value ExternalInterface_uObjectToXML(const fn_call& fn);
+static as_value ExternalInterface_uToAS(const fn_call& fn);
+static as_value ExternalInterface_uToJS(const fn_call& fn);
+static as_value ExternalInterface_uToXML(const fn_call& fn);
+static as_value ExternalInterface_uUnescapeXML(const fn_call& fn);
+static as_value ExternalInterface_available(const fn_call& fn);
 
-as_value ExternalInterface_ctor(const fn_call& fn);
+as_value ExternalInterface_uctor(const fn_call& fn);
 
 static void
 attachExternalInterfaceInterface(as_object& /*o*/)
@@ -49,9 +69,60 @@
 static void
 attachExternalInterfaceStaticProperties(as_object& o)
 {
-   
-    o.init_member("addCallback", new 
builtin_function(ExternalInterface_addCallback));
-    o.init_member("call", new builtin_function(ExternalInterface_call));
+    const int flags = as_prop_flags::dontEnum |
+                      as_prop_flags::dontDelete |
+                      as_prop_flags::readOnly;
+
+    o.init_member("addCallback", new builtin_function(
+                ExternalInterface_addCallback), flags);
+    o.init_member("call", new builtin_function(ExternalInterface_call), flags);
+    o.init_member("_argumentsToXML",
+            new builtin_function(ExternalInterface_uArgumentsToXML), flags);
+    o.init_member("_argumentsToAS",
+            new builtin_function(ExternalInterface_uArgumentsToAS), flags);
+    o.init_member("_addCallback",
+            new builtin_function(ExternalInterface_uAddCallback), flags);
+    o.init_member("_arrayToAS",
+            new builtin_function(ExternalInterface_uArrayToAS), flags);
+    o.init_member("_arrayToJS",
+            new builtin_function(ExternalInterface_uArrayToJS), flags);
+    o.init_member("_arrayToXML",
+            new builtin_function(ExternalInterface_uArrayToXML), flags);
+    o.init_member("_callIn",
+            new builtin_function(ExternalInterface_uCallIn), flags);
+    o.init_member("_callOut",
+            new builtin_function(ExternalInterface_uCallOut), flags);
+    o.init_member("_escapeXML",
+            new builtin_function(ExternalInterface_uEscapeXML), flags);
+    o.init_member("_evalJS",
+            new builtin_function(ExternalInterface_uEvalJS), flags);
+    o.init_member("_initJS",
+            new builtin_function(ExternalInterface_uInitJS), flags);
+    o.init_member("_jsQuoteString",
+            new builtin_function(ExternalInterface_uJsQuoteString), flags);
+    o.init_member("_objectID",
+            new builtin_function(ExternalInterface_uObjectID), flags);
+    o.init_member("_objectToAS",
+            new builtin_function(ExternalInterface_uObjectToAS), flags);
+    o.init_member("_objectToJS",
+            new builtin_function(ExternalInterface_uObjectToJS), flags);
+    o.init_member("_objectToXML",
+            new builtin_function(ExternalInterface_uObjectToXML), flags);
+    o.init_member("_toAS",
+            new builtin_function(ExternalInterface_uToAS), flags);
+    o.init_member("_toJS",
+            new builtin_function(ExternalInterface_uToJS), flags);
+    o.init_member("_toXML",
+            new builtin_function(ExternalInterface_uToXML), flags);
+    o.init_member("_unescapeXML",
+            new builtin_function(ExternalInterface_uUnescapeXML), flags);
+
+    int protectedFlags = as_prop_flags::dontEnum |
+                         as_prop_flags::dontDelete |
+                         as_prop_flags::isProtected;
+
+    o.init_member("available",
+            new builtin_function(ExternalInterface_available), protectedFlags);
 }
 
 static as_object*
@@ -93,19 +164,162 @@
 
 
 static as_value
-ExternalInterface_addCallback(const fn_call& fn)
+ExternalInterface_addCallback(const fn_call& /*fn*/)
 {
-       boost::intrusive_ptr<ExternalInterface_as> ptr = 
ensureType<ExternalInterface_as>(fn.this_ptr);
-       UNUSED(ptr);
        LOG_ONCE( log_unimpl (__FUNCTION__) );
        return as_value();
 }
 
 static as_value
-ExternalInterface_call(const fn_call& fn)
-{
-       boost::intrusive_ptr<ExternalInterface_as> ptr = 
ensureType<ExternalInterface_as>(fn.this_ptr);
-       UNUSED(ptr);
+ExternalInterface_call(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uArgumentsToXML(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uArgumentsToAS(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uAddCallback(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uArrayToAS(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uArrayToJS(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uArrayToXML(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uCallIn(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uCallOut(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uEscapeXML(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uEvalJS(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uInitJS(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uJsQuoteString(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uObjectID(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uObjectToAS(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uObjectToJS(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uObjectToXML(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uToAS(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uToJS(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uToXML(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_uUnescapeXML(const fn_call& /*fn*/)
+{
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+ExternalInterface_available(const fn_call& /*fn*/)
+{
        LOG_ONCE( log_unimpl (__FUNCTION__) );
        return as_value();
 }
@@ -126,17 +340,37 @@
        return as_value(obj.get()); // will keep alive
 }
 
+as_function*
+getFlashExternalExternalInterfaceConstructor()
+{
+    static builtin_function* cl=NULL;
+    if ( ! cl )
+    {
+        cl=new builtin_function(&ExternalInterface_ctor,
+                getExternalInterfaceInterface());
+        VM::get().addStatic(cl);
+           attachExternalInterfaceStaticProperties(*cl);
+    }
+    return cl;
+}
+
+
+static as_value
+get_flash_external_external_interface_constructor(const fn_call& /*fn*/)
+{
+    log_debug("Loading flash.external.ExternalInterface class");
+    return getFlashExternalExternalInterfaceConstructor();
+}
+
+
 // extern 
 void ExternalInterface_class_init(as_object& where)
 {
-       // This is going to be the ExternalInterface "class"/"function"
-       // in the 'where' package
-       boost::intrusive_ptr<builtin_function> cl;
-       cl=new builtin_function(&ExternalInterface_ctor, 
getExternalInterfaceInterface());
-       attachExternalInterfaceStaticProperties(*cl);
-
-       // Register _global.ExternalInterface
-       where.init_member("ExternalInterface", cl.get());
+    // Register _global.Point
+    string_table& st = where.getVM().getStringTable();
+    where.init_destructive_property(st.find("ExternalInterface"),
+            get_flash_external_external_interface_constructor);
 }
 
+
 } // end of gnash namespace

=== modified file 'testsuite/actionscript.all/ExternalInterface.as'
--- a/testsuite/actionscript.all/ExternalInterface.as   2008-10-21 15:45:17 
+0000
+++ b/testsuite/actionscript.all/ExternalInterface.as   2008-10-21 16:26:41 
+0000
@@ -33,28 +33,28 @@
 
 check(EI.hasOwnProperty("call"));
 check(EI.hasOwnProperty("addCallback"));
-xcheck(EI.hasOwnProperty("available"));
+check(EI.hasOwnProperty("available"));
 
-xcheck(EI.hasOwnProperty("_argumentsToXML"));
-xcheck(EI.hasOwnProperty("_argumentsToAS"));
-xcheck(EI.hasOwnProperty("_unescapeXML"));
-xcheck(EI.hasOwnProperty("_toXML"));
-xcheck(EI.hasOwnProperty("_toJS"));
-xcheck(EI.hasOwnProperty("_toAS"));
-xcheck(EI.hasOwnProperty("_objectToXML"));
-xcheck(EI.hasOwnProperty("_objectToJS"));
-xcheck(EI.hasOwnProperty("_objectToAS"));
-xcheck(EI.hasOwnProperty("_objectID"));
-xcheck(EI.hasOwnProperty("_jsQuoteString"));
-xcheck(EI.hasOwnProperty("_initJS"));
-xcheck(EI.hasOwnProperty("_evalJS"));
-xcheck(EI.hasOwnProperty("_escapeXML"));
-xcheck(EI.hasOwnProperty("_callOut"));
-xcheck(EI.hasOwnProperty("_callIn"));
-xcheck(EI.hasOwnProperty("_arrayToXML"));
-xcheck(EI.hasOwnProperty("_arrayToJS"));
-xcheck(EI.hasOwnProperty("_arrayToAS"));
-xcheck(EI.hasOwnProperty("_addCallback"));
+check(EI.hasOwnProperty("_argumentsToXML"));
+check(EI.hasOwnProperty("_argumentsToAS"));
+check(EI.hasOwnProperty("_unescapeXML"));
+check(EI.hasOwnProperty("_toXML"));
+check(EI.hasOwnProperty("_toJS"));
+check(EI.hasOwnProperty("_toAS"));
+check(EI.hasOwnProperty("_objectToXML"));
+check(EI.hasOwnProperty("_objectToJS"));
+check(EI.hasOwnProperty("_objectToAS"));
+check(EI.hasOwnProperty("_objectID"));
+check(EI.hasOwnProperty("_jsQuoteString"));
+check(EI.hasOwnProperty("_initJS"));
+check(EI.hasOwnProperty("_evalJS"));
+check(EI.hasOwnProperty("_escapeXML"));
+check(EI.hasOwnProperty("_callOut"));
+check(EI.hasOwnProperty("_callIn"));
+check(EI.hasOwnProperty("_arrayToXML"));
+check(EI.hasOwnProperty("_arrayToJS"));
+check(EI.hasOwnProperty("_arrayToAS"));
+check(EI.hasOwnProperty("_addCallback"));
 
 // An object
 o = { a: 1, b: "string" };


reply via email to

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