gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r12194: Undo most of the damage outs


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r12194: Undo most of the damage outside ExternalInterface. The testsuite now passes
Date: Fri, 21 May 2010 09:44:56 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 12194 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Fri 2010-05-21 09:44:56 +0200
message:
  Undo most of the damage outside ExternalInterface. The testsuite now passes
  again for the System class.
  
  Confine ugly hacks to the ExternalInterface code, instead of spreading
  errors to the rest of Gnash.
  
  The testsuite failed before and still fails after this commit for various
  ExternalInterface tests.
removed:
  testsuite/network.all/test_allowDomain.cpp
modified:
  libcore/Relay.cpp
  libcore/Relay.h
  libcore/asobj/flash/external/ExternalInterface_as.cpp
  libcore/asobj/flash/external/ExternalInterface_as.h
  libcore/asobj/flash/media/Sound_as.cpp
  libcore/asobj/flash/system/System_as.cpp
  libcore/asobj/flash/system/System_as.h
  testsuite/network.all/Makefile.am
=== modified file 'libcore/Relay.cpp'
--- a/libcore/Relay.cpp 2010-04-25 23:29:46 +0000
+++ b/libcore/Relay.cpp 2010-05-21 06:06:05 +0000
@@ -26,23 +26,15 @@
 /// Destructor of ActiveRelay needs definition of movie_root.
 ActiveRelay::~ActiveRelay()
 {
-    if (_owner) {
-        getRoot(*_owner).removeAdvanceCallback(this);
-    }
+    getRoot(*_owner).removeAdvanceCallback(this);
 }
 
+
 void
 ActiveRelay::setReachable()
 {
     markReachableResources();
-    if (_owner) {
-        _owner->setReachable();
-    }
-}
-
-}
-
-// local Variables:
-// mode: C++
-// indent-tabs-mode: nil
-// End:
+    _owner->setReachable();
+}
+
+}

=== modified file 'libcore/Relay.h'
--- a/libcore/Relay.h   2010-01-11 06:41:38 +0000
+++ b/libcore/Relay.h   2010-05-21 07:16:53 +0000
@@ -19,6 +19,8 @@
 #ifndef GNASH_RELAY_H
 #define GNASH_RELAY_H
 
+#include <boost/noncopyable.hpp>
+
 namespace gnash {
     class as_object;
 }
@@ -44,7 +46,7 @@
 //
 /// An as_object with a non-null _relay member is a native class, as this
 /// information cannot be accessed by normal ActionScript functions.
-class Relay
+class Relay : boost::noncopyable
 {
 public:
     virtual ~Relay() {};
@@ -69,7 +71,7 @@
 {
 public:
 
-    ActiveRelay(as_object* owner)
+    explicit ActiveRelay(as_object* owner)
         :
         _owner(owner)
     {}

=== modified file 'libcore/asobj/flash/external/ExternalInterface_as.cpp'
--- a/libcore/asobj/flash/external/ExternalInterface_as.cpp     2010-05-21 
01:26:20 +0000
+++ b/libcore/asobj/flash/external/ExternalInterface_as.cpp     2010-05-21 
07:16:17 +0000
@@ -595,14 +595,6 @@
     GNASH_REPORT_FUNCTION;
 }
 
-ExternalInterface_as::ExternalInterface_as()
-    : ActiveRelay(*this),
-       _fd(-1),
-       _marshallExceptions(false)
-{
-    GNASH_REPORT_FUNCTION;
-}
-
 ExternalInterface_as::~ExternalInterface_as()
 {
 //    GNASH_REPORT_FUNCTION;
@@ -890,7 +882,17 @@
 ExternalInterface_as &
 ExternalInterface_as::Instance()
 {
-    static ExternalInterface_as ei;
+
+    // TODO: this is a temporary hack to allow ExternalInterface to work as an
+    // ActiveRelay without changing the way ActiveRelay works.
+    // ExternalInterface shouldn't use ActiveRelay, neither should it need
+    // any of these singletons or statics.
+    static as_object* o = 0;
+    if (!o) {
+        o = new as_object(*VM::get().getGlobal());
+        VM::get().addStatic(o);
+    }
+    static ExternalInterface_as ei(o);
     
     return ei;
 }

=== modified file 'libcore/asobj/flash/external/ExternalInterface_as.h'
--- a/libcore/asobj/flash/external/ExternalInterface_as.h       2010-05-20 
21:56:06 +0000
+++ b/libcore/asobj/flash/external/ExternalInterface_as.h       2010-05-21 
06:15:36 +0000
@@ -41,7 +41,6 @@
 class ExternalInterface_as: public ActiveRelay
 {
 public:
-    ExternalInterface_as();
     ExternalInterface_as(as_object* owner);
     static ExternalInterface_as &Instance();
     virtual ~ExternalInterface_as();

=== modified file 'libcore/asobj/flash/media/Sound_as.cpp'
--- a/libcore/asobj/flash/media/Sound_as.cpp    2010-04-25 20:06:05 +0000
+++ b/libcore/asobj/flash/media/Sound_as.cpp    2010-05-21 06:02:23 +0000
@@ -46,36 +46,36 @@
 
 // Forward declarations
 namespace {
-as_value sound_new(const fn_call& fn);
-as_value sound_attachsound(const fn_call& fn);
-as_value sound_getbytesloaded(const fn_call& fn);
-as_value sound_setPosition(const fn_call& fn);
-as_value sound_areSoundsInaccessible(const fn_call& fn);
-as_value sound_duration(const fn_call& fn);
-as_value sound_position(const fn_call& fn);
-as_value sound_getbytestotal(const fn_call& fn);
-as_value sound_getpan(const fn_call& fn);
-as_value sound_setpan(const fn_call& fn);
-as_value sound_getDuration(const fn_call& fn);
-as_value sound_setDuration(const fn_call& fn);
-as_value sound_gettransform(const fn_call& fn);
-as_value sound_getPosition(const fn_call& fn);
-as_value sound_getvolume(const fn_call& fn);
-as_value sound_loadsound(const fn_call& fn);
-as_value sound_settransform(const fn_call& fn);
-as_value sound_setvolume(const fn_call& fn);
-as_value sound_start(const fn_call& fn);
-as_value sound_stop(const fn_call& fn);
-as_value checkPolicyFile_getset(const fn_call& fn);
-as_value sound_load(const fn_call& fn);
-as_value sound_play(const fn_call& fn);
-as_value sound_complete(const fn_call& fn);
-as_value sound_id3(const fn_call& fn);
-as_value sound_ioError(const fn_call& fn);
-as_value sound_open(const fn_call& fn);
-as_value sound_progress(const fn_call& fn);
-as_value sound_ctor(const fn_call& fn);
-void attachSoundInterface(as_object& o);
+    as_value sound_new(const fn_call& fn);
+    as_value sound_attachsound(const fn_call& fn);
+    as_value sound_getbytesloaded(const fn_call& fn);
+    as_value sound_setPosition(const fn_call& fn);
+    as_value sound_areSoundsInaccessible(const fn_call& fn);
+    as_value sound_duration(const fn_call& fn);
+    as_value sound_position(const fn_call& fn);
+    as_value sound_getbytestotal(const fn_call& fn);
+    as_value sound_getpan(const fn_call& fn);
+    as_value sound_setpan(const fn_call& fn);
+    as_value sound_getDuration(const fn_call& fn);
+    as_value sound_setDuration(const fn_call& fn);
+    as_value sound_gettransform(const fn_call& fn);
+    as_value sound_getPosition(const fn_call& fn);
+    as_value sound_getvolume(const fn_call& fn);
+    as_value sound_loadsound(const fn_call& fn);
+    as_value sound_settransform(const fn_call& fn);
+    as_value sound_setvolume(const fn_call& fn);
+    as_value sound_start(const fn_call& fn);
+    as_value sound_stop(const fn_call& fn);
+    as_value checkPolicyFile_getset(const fn_call& fn);
+    as_value sound_load(const fn_call& fn);
+    as_value sound_play(const fn_call& fn);
+    as_value sound_complete(const fn_call& fn);
+    as_value sound_id3(const fn_call& fn);
+    as_value sound_ioError(const fn_call& fn);
+    as_value sound_open(const fn_call& fn);
+    as_value sound_progress(const fn_call& fn);
+    as_value sound_ctor(const fn_call& fn);
+    void attachSoundInterface(as_object& o);
 }
 
 Sound_as::Sound_as(as_object* owner) 

=== modified file 'libcore/asobj/flash/system/System_as.cpp'
--- a/libcore/asobj/flash/system/System_as.cpp  2010-04-25 17:50:48 +0000
+++ b/libcore/asobj/flash/system/System_as.cpp  2010-05-21 07:16:17 +0000
@@ -38,31 +38,29 @@
 // Forward declarations.
 namespace {
 
-inline std::string trueFalse(bool x) { return x ? "t" : "f"; }
-
-template<typename T> inline void convertValue(const std::string& in,
-                                              T& val);
-
-const std::string& systemLanguage(as_object& proto);
-
-as_value system_security_allowdomain(const fn_call& fn);
-as_value system_security_allowinsecuredomain(const fn_call& fn);
-as_value system_security_loadpolicyfile(const fn_call& fn);
-as_value system_setClipboard(const fn_call& fn);
-as_value system_showsettings(const fn_call& fn);
-as_value system_exactsettings(const fn_call& fn);
-as_value system_usecodepage(const fn_call& fn);
-void attachSystemSecurityInterface(as_object& o);
-void attachSystemCapabilitiesInterface(as_object& o);
-void attachSystemInterface(as_object& proto);
-
-// AS3 functions.
-as_value system_gc(const fn_call& fn);
-as_value system_pause(const fn_call& fn);
-as_value system_resume(const fn_call& fn);
-
-// List of domains that can access/modify local data
-std::vector<std::string> _allowDataAccess;
+    inline std::string trueFalse(bool x) { return x ? "t" : "f"; }
+
+    template<typename T> inline void convertValue(const std::string& in,
+                                                  T& val);
+
+    const std::string& systemLanguage(as_object& proto);
+
+    as_value system_security_allowdomain(const fn_call& fn);
+    as_value system_security_allowinsecuredomain(const fn_call& fn);
+    as_value system_security_loadpolicyfile(const fn_call& fn);
+    as_value system_setClipboard(const fn_call& fn);
+    as_value system_showsettings(const fn_call& fn);
+    as_value system_exactsettings(const fn_call& fn);
+    as_value system_usecodepage(const fn_call& fn);
+    void attachSystemSecurityInterface(as_object& o);
+    void attachSystemCapabilitiesInterface(as_object& o);
+    void attachSystemInterface(as_object& proto);
+
+    // AS3 functions.
+    as_value system_gc(const fn_call& fn);
+    as_value system_pause(const fn_call& fn);
+    as_value system_resume(const fn_call& fn);
+
 }
 
 void
@@ -91,34 +89,6 @@
     // System.Product.download 2201, 3    
 }
 
-
-/// Get the current System.security allowDataAccess list of domains allowed to
-/// access/modify local data
-//
-/// @return a std::vector of strings containing urls that can access local data
-const std::vector<std::string>&
-getAllowDataAccess()
-{
-       return _allowDataAccess;
-}
-
-
-/// Adds a string containing url or ip info to the allowDataAccess list of
-/// domains that can access/modify local data
-//
-/// @param url a std::string containing the domain name
-bool
-addAllowDataAccess( const std::string& url )
-{
-       size_t s = _allowDataAccess.size();
-       _allowDataAccess.push_back( url );      
-
-       if( s+1 == _allowDataAccess.size()) return true;
-
-       return false;
-}
-
-
 namespace {
 
 void
@@ -127,22 +97,17 @@
     VM& vm = getVM(o);
     o.init_member("allowDomain", vm.getNative(12, 0));
 
-    const int swf7Flags = PropFlags::dontDelete | PropFlags::dontEnum
-        | PropFlags::readOnly | PropFlags::onlySWF7Up;
-
     Global_as& gl = getGlobal(o);
     o.init_member("allowInsecureDomain",
-                  gl.createFunction(system_security_allowinsecuredomain),
-                  swf7Flags);
+                  gl.createFunction(system_security_allowinsecuredomain));
     o.init_member("loadPolicyFile",
-                  gl.createFunction(system_security_loadpolicyfile),
-                  swf7Flags);
+                  gl.createFunction(system_security_loadpolicyfile));
 }
 
 void
 attachSystemCapabilitiesInterface(as_object& o)
 {
-       RcInitFile& rcfile = RcInitFile::getDefaultInstance();
+    RcInitFile& rcfile = RcInitFile::getDefaultInstance();
 
     //
     // Filesystem, access, miscellaneous hardware information
@@ -356,21 +321,10 @@
 as_value
 system_security_allowdomain(const fn_call& fn)
 {
-       // NOTE: This is the AS2 version of allowDomain, the AS3 version is 
located
-       // in Security_as.cpp
-    if (!fn.nargs) {
-        IF_VERBOSE_ASCODING_ERRORS(
-            log_aserror("System.security.allowDomain requires at least one "
-                "argument.");
-        );
+    LOG_ONCE(log_unimpl("System.security.allowDomain"));
+    if (fn.nargs < 1) {
         return as_value(false);
     }
-
-    LOG_ONCE(log_unimpl ("System.security.allowDomain currently stores "
-                "domains but does nothing else.")); 
-       for (unsigned int i = 0; i < fn.nargs; ++i) {
-               addAllowDataAccess(fn.arg(i).to_string());
-       }
     return as_value(true);
 }
 

=== modified file 'libcore/asobj/flash/system/System_as.h'
--- a/libcore/asobj/flash/system/System_as.h    2010-03-11 01:47:08 +0000
+++ b/libcore/asobj/flash/system/System_as.h    2010-05-21 06:01:28 +0000
@@ -35,13 +35,6 @@
 
 void registerSystemNative(as_object& where);
 
-
-/// Get the vector aof allowed domains to access
-const std::vector<std::string>& getAllowDataAccess();
-
-/// add a url string to the vector of allowed domains
-bool addAllowDataAccess( const std::string& url );
-
 } // gnash namespace
 
 // GNASH_ASOBJ3_SYSTEM_H

=== modified file 'testsuite/network.all/Makefile.am'
--- a/testsuite/network.all/Makefile.am 2010-03-14 02:26:46 +0000
+++ b/testsuite/network.all/Makefile.am 2010-05-21 06:01:28 +0000
@@ -76,7 +76,6 @@
 check_PROGRAMS = \
        Dejagnu \
        Dejagnu.swf \
-       test_allowDomain \
        $(TEST_SSL) \
        $(TEST_SSH) \
        $(NULL)
@@ -140,13 +139,6 @@
 test_ssh_DEPENDENCIES = site-update
 endif
 
-test_allowDomain_SOURCES = test_allowDomain.cpp
-test_allowDomain_LDADD = \
-       $(top_builddir)/libbase/libgnashbase.la \
-       $(top_builddir)/libcore/libgnashcore.la
-
-test_allowDomain_DEPENDENCIES = site-update
-
 clean-local: 
        -rm *.swf media *.pp *unner
 

=== removed file 'testsuite/network.all/test_allowDomain.cpp'
--- a/testsuite/network.all/test_allowDomain.cpp        2010-01-01 17:48:26 
+0000
+++ b/testsuite/network.all/test_allowDomain.cpp        1970-01-01 00:00:00 
+0000
@@ -1,197 +0,0 @@
-// 
-//   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
-// 
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-#ifdef HAVE_DEJAGNU_H
-
-#include <boost/shared_ptr.hpp>
-#include <string>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <iostream>
-#include <string>
-#include <vector>
-
-#include "flash/system/System_as.h"
-#include "as_object.h"
-#include "fn_call.h"
-#include "as_environment.h"
-#include "smart_ptr.h"
-#include "dejagnu.h"
-#include "log.h"
-#include "element.h"
-#include "arg_parser.h"
-
-using namespace gnash;
-using namespace std;
-
-static void usage (void);
-
-static TestState runtest;
-
-static void test_client();
-static string url;
-
-LogFile& dbglogfile = LogFile::getDefaultInstance();
-
-int
-main(int argc, char *argv[])
-{
-    const Arg_parser::Option opts[] =
-        {
-            { 'h', "help",          Arg_parser::no  },
-            { 'v', "verbose",       Arg_parser::no  },
-        };
-    
-    Arg_parser parser(argc, argv, opts);
-    if( ! parser.error().empty() ) {
-               cout << parser.error() << endl;
-        exit(EXIT_FAILURE);
-    }
-    
-    for( int i = 0; i < parser.arguments(); ++i ) {
-        const int code = parser.code(i);
-        try {
-            switch( code ) {
-              case 'h':
-                  usage ();
-                  exit(EXIT_SUCCESS);
-              case 'v':
-                                 dbglogfile.setVerbosity();
-                                 log_debug(_("Verbose output turned on"));
-                  break;
-              case 0:
-                  url = parser.argument(i);
-                                 log_debug(_("URL for testing the allowDomain 
function is: %s"), url);
-                  break;
-            }
-        }
-        
-        catch (Arg_parser::ArgParserException &e) {
-            cerr << _("Error parsing command line options: ") << e.what() << 
endl;
-            cerr << _("This is a Gnash bug.") << endl;
-        }
-    }
-    
-    test_client();
-}
-
-static void test_client()
-{
-       string domain1("www.google.com");
-       string domain2("www.youtube.com");
-       string domain3("cnn.com");
-       string domain4("92.123.68.89");
-
-       addAllowDataAccess( domain1 );
-
-       vector<string> vec = getAllowDataAccess();
-
-       string added = vec[0];
-       if( added == domain1 ) {
-               runtest.pass("addAllowDataAccess correctly added 
'www.google.com'");
-       } else {
-               runtest.fail("addAllowDataAccess did not correctly add 
'www.google.com'");
-       }
-       if( (int) vec.size() == 1 ) {
-               runtest.pass("_allowDataAccess vector contains 1 item");
-       } else {
-               runtest.fail("_allowDataAccess vector does not contain 1 item");
-       }
-
-       addAllowDataAccess( domain2 );
-       vec = getAllowDataAccess();
-       added = vec[1];
-       if( added == domain2 ) {
-               runtest.pass("addAllowDataAccess correctly added 
'www.youtube.com'");
-       } else {
-               runtest.fail("addAllowDataAccess did not correctly add 
'www.youtube.com'");
-       }
-       if( (int) vec.size()  == 2 ) {
-               runtest.pass("_allowDataAccess vector contains 2 items");
-       } else {
-               runtest.fail("_allowDataAccess vector does not contain 2 
items");
-       }
-
-       addAllowDataAccess( domain3 );
-       vec = getAllowDataAccess();
-       added = vec[2];
-       if( added == domain3 ) {
-               runtest.pass("'cnn.com' was correctly added to the vector");
-       } else {
-               runtest.fail("'cnn.com' was not correctly added to the vector");
-       }
-       if( (int)vec.size() == 3 ) {
-               runtest.pass("_allowDataAccess vector contains 3 items");
-       } else {
-               runtest.fail("_allowDataAccess vector does not contain 3 
items");
-       }
-
-       addAllowDataAccess( domain4 );
-       vec = getAllowDataAccess();
-       added = vec[3];
-       if( added == domain4 ) {
-               runtest.pass("'92.123.68.89' was correctly added to the 
vector");
-       } else {
-               runtest.fail("'92.123.68.89' was not correctly added to the 
vector");
-       }
-       if( (int)vec.size() == 4 ) {
-               runtest.pass("_allowDataAccess vector now contains 4 items");
-       } else {
-               runtest.fail("_allowDataAccess vector does not contain 4 
items");
-       }
-       
-       // TODO: Is there a way to call system_security_allowdomain() from here?
-       //boost::intrusive_ptr<as_object> obj = new as_object();
-       //boost::intrusive_ptr<as_environment> env = new 
as_environment(obj->getVM());
-       //auto_ptr< vector <as_value> > args;
-       //args->push_back( as_value("msn.com"));
-       //fn_call fn(obj, env, args);
-       //system_security_allowdomain(fn);
-
-
-
-}
-
-static void
-usage (void)
-{
-    cerr << "This program tests SSL support in the libnet library." << endl;
-    cerr << "Usage: test_ssl [hvsocpkwar]" << endl;
-    cerr << "-h\tHelp" << endl;
-    cerr << "-v\tVerbose" << endl;
-    exit (-1);
-}
-
-#else
-
-int
-main(int /*argc*/, char /* *argv[]*/)
-{
-  // nop
-    cerr << "This program needs to have DejaGnu installed!" << endl;
-    return 0;  
-}
-
-#endif


reply via email to

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