gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-240-ga6acec8
Date: Sun, 10 Apr 2011 11:02:08 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  a6acec8606c4dac4c642ad863d951f278ee3ab5a (commit)
       via  ffe91f0af82f6768def098099174d38f729db655 (commit)
       via  2ce5e6c59b2a423b59ab7a8887086284dd61ae1e (commit)
      from  369570e7d377fd68be9bab528574c5589383db19 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=a6acec8606c4dac4c642ad863d951f278ee3ab5a


commit a6acec8606c4dac4c642ad863d951f278ee3ab5a
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Apr 10 12:46:27 2011 +0200

    Implement XML.contentType correctly.
    
    It is a getter-setter, not a normal property. Add our own tests for
    this, as the relevant swfdec test has unrelated bogus tests meaning we
    can't pass it (according to pp 9 / Linux).

diff --git a/libcore/asobj/XML_as.cpp b/libcore/asobj/XML_as.cpp
index 1112f0e..cd2349a 100644
--- a/libcore/asobj/XML_as.cpp
+++ b/libcore/asobj/XML_as.cpp
@@ -55,6 +55,7 @@ namespace {
     as_value xml_onLoad(const fn_call& fn);
     as_value xml_xmlDecl(const fn_call& fn);
     as_value xml_docTypeDecl(const fn_call& fn);
+    as_value xml_contentType(const fn_call& fn);
     as_value xml_escape(const fn_call& fn);
     as_value xml_loaded(const fn_call& fn);
     as_value xml_status(const fn_call& fn);
@@ -86,6 +87,7 @@ XML_as::XML_as(as_object& object)
     XMLNode_as(getGlobal(object)),
     _loaded(XML_LOADED_UNDEFINED), 
     _status(XML_OK),
+    _contentType("application/x-www-form-urlencoded"),
     _ignoreWhite(false)
 {
     setObject(&object);
@@ -97,6 +99,7 @@ XML_as::XML_as(as_object& object, const std::string& xml)
     XMLNode_as(getGlobal(object)),
     _loaded(XML_LOADED_UNDEFINED), 
     _status(XML_OK),
+    _contentType("application/x-www-form-urlencoded"),
     _ignoreWhite(false)
 {
     setObject(&object);
@@ -571,10 +574,10 @@ attachXMLProperties(as_object& o)
     as_object* proto = o.get_prototype();
     if (!proto) return;
     const int flags = 0;
-    proto->init_member("contentType", "application/x-www-form-urlencoded",
-            flags);
     proto->init_property("docTypeDecl", &xml_docTypeDecl, &xml_docTypeDecl,
             flags);
+    proto->init_property("contentType", &xml_contentType, &xml_contentType,
+            flags);
     proto->init_property("ignoreWhite", xml_ignoreWhite, xml_ignoreWhite, 
flags);
     proto->init_property("loaded", xml_loaded, xml_loaded);
     proto->init_property("status", xml_status, xml_status, flags);
@@ -807,12 +810,28 @@ xml_xmlDecl(const fn_call& fn)
 }
 
 as_value
+xml_contentType(const fn_call& fn)
+{
+    XML_as* ptr = ensure<ThisIsNative<XML_as> >(fn);
+
+    if (!fn.nargs) {
+        // Getter
+        return as_value(ptr->getContentType());
+    }
+
+    // Setter
+    const std::string& contentType = fn.arg(0).to_string();
+    ptr->setContentType(contentType);
+    
+    return as_value();
+}
+
+as_value
 xml_docTypeDecl(const fn_call& fn)
 {
     XML_as* ptr = ensure<ThisIsNative<XML_as> >(fn);
 
-    if (!fn.nargs)
-    {
+    if (!fn.nargs) {
         // Getter
         const std::string& docType = ptr->getDocTypeDecl();
         if (docType.empty()) return as_value();
@@ -820,12 +839,10 @@ xml_docTypeDecl(const fn_call& fn)
     }
 
     // Setter
-
     const std::string& docType = fn.arg(0).to_string();
     ptr->setDocTypeDecl(docType);
     
     return as_value();
-
 }
 
 /// XML.prototype has an empty onLoad function defined.
diff --git a/libcore/asobj/XML_as.h b/libcore/asobj/XML_as.h
index b400008..1ee00cb 100644
--- a/libcore/asobj/XML_as.h
+++ b/libcore/asobj/XML_as.h
@@ -101,6 +101,14 @@ public:
         _docTypeDecl = docType;
     }
 
+    const std::string& getContentType() const {
+        return _contentType;
+    }
+
+    void setContentType(const std::string& contentType) {
+        _contentType = contentType;
+    }
+
     // Methods
 
     /// Parses an XML document into the specified XML object tree.
@@ -180,6 +188,8 @@ private:
 
     std::string _xmlDecl;
 
+    std::string _contentType;
+
     bool _ignoreWhite;
 };
 
diff --git a/testsuite/actionscript.all/XML.as 
b/testsuite/actionscript.all/XML.as
index 8c464c4..32c6134 100644
--- a/testsuite/actionscript.all/XML.as
+++ b/testsuite/actionscript.all/XML.as
@@ -910,12 +910,12 @@ myxml.onLoad = function(success)
 #endif
        {
 #if OUTPUT_VERSION < 6
-               check_totals(431);
+               check_totals(438);
 #else
 # if OUTPUT_VERSION < 8
-               check_totals(468);
+               check_totals(475);
 # else
-               check_totals(449);
+               check_totals(456);
 # endif
 #endif
                play();
@@ -1091,6 +1091,19 @@ check_equals(typeof(h.docTypeDecl), "string");
 check_equals(h.docTypeDecl, "98");
 check_equals(h.toString(), "798<tag />");
 
+check_equals(h.contentType, "application/x-www-form-urlencoded");
+
+h.contentType = 88;
+check_equals(typeof(h.contentType), "string");
+check_equals(h.contentType, "88");
+check_equals(h.toString(), "798<tag />");
+
+h.contentType = "";
+check_equals(typeof(h.contentType), "string");
+check_equals(h.contentType, "");
+check_equals(h.toString(), "798<tag />");
+
+
 #if OUTPUT_VERSION > 5
 
 /// Check special characters

http://git.savannah.gnu.org/cgit//commit/?id=ffe91f0af82f6768def098099174d38f729db655


commit ffe91f0af82f6768def098099174d38f729db655
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Apr 10 11:40:58 2011 +0200

    Print XMLNodes with an empty name.
    
    But only if they are of element type. Test more; actionscript.all test
    passes.

diff --git a/libcore/asobj/XMLNode_as.cpp b/libcore/asobj/XMLNode_as.cpp
index 5dd8e8a..e00ec30 100644
--- a/libcore/asobj/XMLNode_as.cpp
+++ b/libcore/asobj/XMLNode_as.cpp
@@ -403,7 +403,7 @@ XMLNode_as::stringify(const XMLNode_as& xml, std::ostream& 
xmlout, bool encode)
             nodeValue, xml._attributes.size(), xml._children.size());
 #endif
 
-    if (!nodeName.empty()) {
+    if (!nodeName.empty() || type == Element) {
 
         xmlout << "<" << nodeName;
 
@@ -452,7 +452,7 @@ XMLNode_as::stringify(const XMLNode_as& xml, std::ostream& 
xmlout, bool encode)
         (*itx)->toString(xmlout, encode);
     }
 
-    if (!nodeName.empty()) {
+    if (!nodeName.empty() || type == Element) {
         xmlout << "</" << nodeName << ">";
     }
 }
diff --git a/libcore/asobj/XML_as.cpp b/libcore/asobj/XML_as.cpp
index e365845..1112f0e 100644
--- a/libcore/asobj/XML_as.cpp
+++ b/libcore/asobj/XML_as.cpp
@@ -136,7 +136,11 @@ XML_as::toString(std::ostream& o, bool encode) const
     if (!_xmlDecl.empty()) o << _xmlDecl;
     if (!_docTypeDecl.empty()) o << _docTypeDecl;
 
-    XMLNode_as::toString(o, encode);
+    XMLNode_as* i = firstChild();
+    while (i) {
+        i->XMLNode_as::toString(o, encode);
+        i = i->nextSibling();
+    }
 }
 
 void
@@ -665,6 +669,10 @@ xml_status(const fn_call& fn)
         return as_value(ptr->status());
     }
 
+    if (fn.arg(0).is_undefined()) {
+        return as_value();
+    }
+
     const double status = toNumber(fn.arg(0), getVM(fn));
     if (isNaN(status) ||
             status > std::numeric_limits<boost::int32_t>::max() ||
@@ -673,8 +681,7 @@ xml_status(const fn_call& fn)
         ptr->setStatus(static_cast<XML_as::ParseStatus>(
                     std::numeric_limits<boost::int32_t>::min()));
     }
-
-    ptr->setStatus(static_cast<XML_as::ParseStatus>(int(status)));
+    else ptr->setStatus(static_cast<XML_as::ParseStatus>(int(status)));
     return as_value();
 }
     
diff --git a/testsuite/actionscript.all/XMLNode.as 
b/testsuite/actionscript.all/XMLNode.as
index c9e16c0..23d9e7d 100644
--- a/testsuite/actionscript.all/XMLNode.as
+++ b/testsuite/actionscript.all/XMLNode.as
@@ -386,8 +386,25 @@ check_equals(ns.prefix, "");
 xn = new XMLNode(1, "");
 xn.xmlDecl = "hello";
 xn.docTypeDecl = "dtd";
-xcheck_equals(xn.toString(), "< />");
+check_equals(xn.toString(), "< />");
 
+xn = new XMLNode(2, "");
+check_equals(xn.toString(), "");
 
+xn = new XMLNode(3, "");
+check_equals(xn.toString(), "");
 
-check_totals(176);
+xn = new XMLNode(4, "");
+check_equals(xn.toString(), "");
+
+xn = new XMLNode(5, "");
+check_equals(xn.toString(), "");
+
+xn = new XMLNode(6, "");
+check_equals(xn.toString(), "");
+
+xn = new XMLNode(7, "");
+check_equals(xn.toString(), "");
+
+
+check_totals(182);

http://git.savannah.gnu.org/cgit//commit/?id=2ce5e6c59b2a423b59ab7a8887086284dd61ae1e


commit 2ce5e6c59b2a423b59ab7a8887086284dd61ae1e
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Apr 10 11:40:48 2011 +0200

    Drop obsolete comment.

diff --git a/libcore/as_environment.cpp b/libcore/as_environment.cpp
index 9fef1de..3100085 100644
--- a/libcore/as_environment.cpp
+++ b/libcore/as_environment.cpp
@@ -555,7 +555,6 @@ getVariableRaw(const as_environment& env, const 
std::string& varname,
         return as_value(global);
     }
 
-    // Version 4 only has local variables.
     if (global->get_member(key, &val)) {
 #ifdef GNASH_DEBUG_GET_VARIABLE
         log_debug("Found %s in _global", varname);

-----------------------------------------------------------------------

Summary of changes:
 libcore/as_environment.cpp            |    1 -
 libcore/asobj/XMLNode_as.cpp          |    4 +-
 libcore/asobj/XML_as.cpp              |   42 +++++++++++++++++++++++++-------
 libcore/asobj/XML_as.h                |   10 ++++++++
 testsuite/actionscript.all/XML.as     |   19 ++++++++++++--
 testsuite/actionscript.all/XMLNode.as |   21 +++++++++++++++-
 6 files changed, 80 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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