[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r12219: Correct ExternalInterface pr
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r12219: Correct ExternalInterface properties, drop old code from header. |
Date: |
Fri, 04 Jun 2010 16:14:24 +0200 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 12219 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Fri 2010-06-04 16:14:24 +0200
message:
Correct ExternalInterface properties, drop old code from header.
Swfdec test passes.
modified:
libcore/asobj/Globals.cpp
libcore/asobj/flash/external/ExternalInterface_as.cpp
libcore/asobj/flash/external/ExternalInterface_as.h
testsuite/swfdec/PASSING
=== modified file 'libcore/asobj/Globals.cpp'
--- a/libcore/asobj/Globals.cpp 2010-03-31 08:08:58 +0000
+++ b/libcore/asobj/Globals.cpp 2010-06-04 09:39:05 +0000
@@ -85,6 +85,7 @@
#include "flash/text/TextRenderer_as.h"
#include "flash/xml/XMLDocument_as.h"
#include "flash/xml/XMLNode_as.h"
+#include "flash/external/ExternalInterface_as.h"
#include "MovieClipLoader.h"
#include "movie_definition.h"
#include "Video.h"
@@ -1575,6 +1576,7 @@
registerLocalConnectionNative(global);
registerBitmapFilterNative(global);
registerColorTransformNative(global);
+ registerExternalInterfaceNative(global);
AsBroadcaster::registerNative(global);
registerTextFormatNative(global);
=== modified file 'libcore/asobj/flash/external/ExternalInterface_as.cpp'
--- a/libcore/asobj/flash/external/ExternalInterface_as.cpp 2010-06-03
19:29:37 +0000
+++ b/libcore/asobj/flash/external/ExternalInterface_as.cpp 2010-06-04
13:14:31 +0000
@@ -28,6 +28,7 @@
#include "ExternalInterface.h"
#include "ExternalInterface_as.h"
+#include "NativeFunction.h"
#include "StringPredicates.h"
#include "as_object.h" // for inheritance
#include "fn_call.h"
@@ -133,6 +134,23 @@
};
void
+registerExternalInterfaceNative(as_object& global)
+{
+ VM& vm = getVM(global);
+ vm.registerNative(externalinterface_uInitJS, 14, 0);
+ vm.registerNative(externalinterface_uObjectID, 14, 1);
+ vm.registerNative(externalinterface_uAddCallback, 14, 2);
+ vm.registerNative(externalinterface_uEvalJS, 14, 3);
+ vm.registerNative(externalinterface_uCallOut, 14, 4);
+ vm.registerNative(externalinterface_uEscapeXML, 14, 5);
+ vm.registerNative(externalinterface_uUnescapeXML, 14, 6);
+ vm.registerNative(externalinterface_uJsQuoteString, 14, 7);
+
+ vm.registerNative(externalinterface_available, 14, 100);
+
+}
+
+void
externalinterface_class_init(as_object& where, const ObjectURI& uri)
{
// GNASH_REPORT_FUNCTION;
@@ -148,67 +166,67 @@
{
// GNASH_REPORT_FUNCTION;
- const int swf7Flags = PropFlags::dontDelete | PropFlags::dontEnum
- | PropFlags::readOnly | PropFlags::onlySWF7Up;
- const int swf8Flags = PropFlags::dontDelete | PropFlags::dontEnum
- | PropFlags::readOnly | PropFlags::onlySWF8Up;
-
- // Initialize the properties
- o.init_readonly_property("available", &externalinterface_available,
swf7Flags);
-
- o.init_property("marshallExceptions", externalinterface_marshallExceptions,
- externalinterface_marshallExceptions, swf8Flags);
- o.init_readonly_property("objectID", &externalinterface_objectID,
swf8Flags);
-
- // Initialize the documented methods
- Global_as& gl = getGlobal(o);
+ const int swf8Flags = PropFlags::onlySWF8Up;
+
+ VM& vm = getVM(o);
+
+ // Native functions
+ o.init_member("_initJS", vm.getNative(14, 0), swf8Flags);
+ o.init_member("_objectID", vm.getNative(14, 1), swf8Flags);
+ o.init_member("_addCallback", vm.getNative(14, 2), swf8Flags);
+ o.init_member("_evalJS", vm.getNative(14, 3), swf8Flags);
+ o.init_member("_callOut", vm.getNative(14, 4), swf8Flags);
+ o.init_member("_escapeXML", vm.getNative(14, 5), swf8Flags);
+ o.init_member("_unescapeXML", vm.getNative(14, 6), swf8Flags);
+ o.init_member("_jsQuoteString", vm.getNative(14, 7), swf8Flags);
+
+ // Native properties
+ NativeFunction* n = vm.getNative(14, 100);
+ o.init_property("available", *n, *n, swf8Flags);
+
+ Global_as& gl = getGlobal(o);
+
+ // ActionScript functions
o.init_member("addCallback",
- gl.createFunction(externalinterface_addCallback), swf7Flags);
-
- o.init_member("call", gl.createFunction(externalinterface_call),
swf7Flags);
-
- // Initialize the other methods, most of which are undocumented
- // helper functions.
+ gl.createFunction(externalinterface_addCallback));
+
+ o.init_member("call", gl.createFunction(externalinterface_call));
+
+ // Undocumented ActionScript functions.
o.init_member("_argumentsToXML",
- gl.createFunction(externalinterface_uArgumentsToXML),
swf8Flags);
+ gl.createFunction(externalinterface_uArgumentsToXML));
o.init_member("_argumentsToAS",
- gl.createFunction(externalinterface_uArgumentsToAS),
swf8Flags);
- o.init_member("_addCallback",
- gl.createFunction(externalinterface_uAddCallback),
swf8Flags);
+ gl.createFunction(externalinterface_uArgumentsToAS));
o.init_member("_arrayToAS",
- gl.createFunction(externalinterface_uArrayToAS), swf8Flags);
+ gl.createFunction(externalinterface_uArrayToAS));
o.init_member("_arrayToJS",
- gl.createFunction(externalinterface_uArrayToJS), swf8Flags);
+ gl.createFunction(externalinterface_uArrayToJS));
o.init_member("_arrayToXML",
- gl.createFunction(externalinterface_uArrayToXML), swf8Flags);
+ gl.createFunction(externalinterface_uArrayToXML));
o.init_member("_callIn",
- gl.createFunction(externalinterface_uCallIn), swf8Flags);
- o.init_member("_callOut",
- gl.createFunction(externalinterface_uCallOut), swf8Flags);
- o.init_member("_escapeXML",
- gl.createFunction(externalinterface_uEscapeXML), swf8Flags);
- o.init_member("_evalJS",
- gl.createFunction(externalinterface_uEvalJS), swf8Flags);
- o.init_member("_initJS",
- gl.createFunction(externalinterface_uInitJS), swf8Flags);
- o.init_member("_jsQuoteString",
- gl.createFunction(externalinterface_uJsQuoteString),
swf8Flags);
- o.init_member("_objectID",
- gl.createFunction(externalinterface_uObjectID), swf8Flags);
+ gl.createFunction(externalinterface_uCallIn));
o.init_member("_objectToAS",
- gl.createFunction(externalinterface_uObjectToAS), swf8Flags);
+ gl.createFunction(externalinterface_uObjectToAS));
o.init_member("_objectToJS",
- gl.createFunction(externalinterface_uObjectToJS), swf8Flags);
+ gl.createFunction(externalinterface_uObjectToJS));
o.init_member("_objectToXML",
- gl.createFunction(externalinterface_uObjectToXML),
swf8Flags);
+ gl.createFunction(externalinterface_uObjectToXML));
o.init_member("_toAS",
- gl.createFunction(externalinterface_uToAS), swf8Flags);
+ gl.createFunction(externalinterface_uToAS));
o.init_member("_toJS",
- gl.createFunction(externalinterface_uToJS), swf8Flags);
+ gl.createFunction(externalinterface_uToJS));
o.init_member("_toXML",
- gl.createFunction(externalinterface_uToXML), swf8Flags);
- o.init_member("_unescapeXML",
- gl.createFunction(externalinterface_uUnescapeXML),
swf8Flags);
+ gl.createFunction(externalinterface_uToXML));
+
+ // Apparently the pp calls:
+ //
+ // AsSetPropFlags(flash.external.ExternalInterface, null, 4103)
+ //
+ // here, but it seems that the properties actually are visible in SWF6
+ // and SWF7, at least for the flashplayer 9. So we just make sure they
+ // are read-only.
+ as_object* null = 0;
+ callMethod(&gl, NSV::PROP_AS_SET_PROP_FLAGS, &o, null, 7);
}
as_value
=== modified file 'libcore/asobj/flash/external/ExternalInterface_as.h'
--- a/libcore/asobj/flash/external/ExternalInterface_as.h 2010-06-01
03:49:45 +0000
+++ b/libcore/asobj/flash/external/ExternalInterface_as.h 2010-06-04
09:40:46 +0000
@@ -21,9 +21,6 @@
#ifndef GNASH_ASOBJ_EXTERNALINTERFACE_H
#define GNASH_ASOBJ_EXTERNALINTERFACE_H
-#include <string>
-#include <vector>
-#include <map>
namespace gnash {
@@ -36,24 +33,14 @@
namespace gnash {
-class ExternalInterface_as
-{
-public:
- ExternalInterface_as(as_object* owner);
- ~ExternalInterface_as();
-
-private:
- int _fd;
- std::map<std::string, as_object *> _methods;
-};
-
/// Initialize the global ExternalInterface class
void externalinterface_class_init(gnash::as_object& where,
const gnash::ObjectURI& uri);
+void registerExternalInterfaceNative(as_object& global);
+
} // end of gnash namespace
-// __GNASH_ASOBJ_EXTERNALINTERFACE_H__
#endif
// local Variables:
=== modified file 'testsuite/swfdec/PASSING'
--- a/testsuite/swfdec/PASSING 2009-11-27 13:08:54 +0000
+++ b/testsuite/swfdec/PASSING 2010-06-04 12:23:30 +0000
@@ -521,6 +521,7 @@
external-interface-properties-5.swf:6c1da3512318203a18e0d5c3454f4a7e
external-interface-properties-6.swf:1042fe711f2229195781f9ea1405fe66
external-interface-properties-7.swf:1209e63fc5cadd41f854b3686ec9984f
+external-interface-properties-8.swf:5f7f99747c537d3227bd0ce902d5cd29
filename-with-%-character-5.swf:3c41dca0ae8b3c7b7331fb4ce7de24c3
filename-with-%-character-6.swf:7363947c9d60636ca005fe5f1228bc8f
filename-with-%-character-7.swf:0b30fab3f932a704f280a2cc36763271
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r12219: Correct ExternalInterface properties, drop old code from header.,
Benjamin Wolsey <=