CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 08/02/17 14:03:57
Modified files: . : ChangeLog server/asobj : xml.cpp xml.h Log message: implement XML.sendAndLoad (untested). See bug #22334. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5677&r2=1.5678 http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xml.cpp?cvsroot=gnash&r1=1.70&r2=1.71 http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xml.h?cvsroot=gnash&r1=1.26&r2=1.27 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.5677 retrieving revision 1.5678 diff -u -b -r1.5677 -r1.5678 --- ChangeLog 17 Feb 2008 10:01:13 -0000 1.5677 +++ ChangeLog 17 Feb 2008 14:03:56 -0000 1.5678 @@ -1,3 +1,8 @@ +2008-02-17 Sandro Santilli <[EMAIL PROTECTED]> + + * server/asobj/xml.{cpp,h}: implement XML.sendAndLoad (untested). + See bug #22334. + 2008-02-16 Benjamin Wolsey <[EMAIL PROTECTED]> * gui/gtk.cpp: add mnemonics to menu bar for accessibility. Index: server/asobj/xml.cpp =================================================================== RCS file: /sources/gnash/gnash/server/asobj/xml.cpp,v retrieving revision 1.70 retrieving revision 1.71 diff -u -b -r1.70 -r1.71 --- server/asobj/xml.cpp 14 Feb 2008 13:27:56 -0000 1.70 +++ server/asobj/xml.cpp 17 Feb 2008 14:03:57 -0000 1.71 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: xml.cpp,v 1.70 2008/02/14 13:27:56 bwy Exp $ */ +/* $Id: xml.cpp,v 1.71 2008/02/17 14:03:57 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "gnashconfig.h" @@ -599,10 +599,40 @@ log_unimpl (__FUNCTION__); } -void -XML::sendAndLoad() +bool +XML::sendAndLoad(const URL& url) { - log_unimpl (__FUNCTION__); + //GNASH_REPORT_FUNCTION; + + std::stringstream ss; + toString(ss); + const std::string& data = ss.str(); + + VM& vm = getVM(); + string_table& st = vm.getStringTable(); + string_table::key ctypeKey = st.find("contentType"); + as_value ctypeVal; + if ( get_member(ctypeKey, &ctypeVal) ) + { + log_unimpl ("Custom ContentType (%s) in XML.sendAndLoad", ctypeVal.to_debug_string().c_str()); + } + + //log_msg(_("%s: mem is %d"), __FUNCTION__, mem); + + std::auto_ptr<tu_file> str ( StreamProvider::getDefaultInstance().getStream(url, data) ); + if ( ! str.get() ) + { + log_error(_("Can't load XML file: %s (security?)"), url.str().c_str()); + return false; + // TODO: this is still not correct.. we should still send onData later... + //as_value nullValue; nullValue.set_null(); + //callMethod(NSV::PROP_ON_DATA, nullValue); + } + + log_security(_("Loading XML file from url: '%s'"), url.str().c_str()); + queueLoad(str); + + return true; } @@ -865,9 +895,22 @@ GNASH_REPORT_FUNCTION; boost::intrusive_ptr<XML> ptr = ensureType<XML>(fn.this_ptr); -// return as_value(ptr->getAllocated()); - ptr->sendAndLoad(); + if ( ! fn.nargs ) + { + IF_VERBOSE_ASCODING_ERRORS( + log_aserror(_("XML.sendAndLoad(): missing argument")); + ); return as_value(); + } + + const std::string& filespec = fn.arg(0).to_string(); + + URL url(filespec, get_base_url()); + +// return as_value(ptr->getAllocated()); + bool ret = ptr->sendAndLoad(url); + + return ret; // TODO: check expected return values } static as_value Index: server/asobj/xml.h =================================================================== RCS file: /sources/gnash/gnash/server/asobj/xml.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -b -r1.26 -r1.27 --- server/asobj/xml.h 14 Feb 2008 13:27:56 -0000 1.26 +++ server/asobj/xml.h 17 Feb 2008 14:03:57 -0000 1.27 @@ -154,7 +154,7 @@ void send(); - void sendAndLoad(); + bool sendAndLoad(const URL& url); size_t getBytesLoaded() const; size_t getBytesTotal() const; _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit