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. 75f7740ccaae48655d9e


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. 75f7740ccaae48655d9ef5e1dd40c45441a846a7
Date: Thu, 28 Oct 2010 10:59:00 +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  75f7740ccaae48655d9ef5e1dd40c45441a846a7 (commit)
       via  b3a8c2578b28ddc9f1a4e6efe933b59e21dc858f (commit)
      from  0893d097b4c3e2ebf153189bbcb0fbff5ecf7605 (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=75f7740ccaae48655d9ef5e1dd40c45441a846a7


commit 75f7740ccaae48655d9ef5e1dd40c45441a846a7
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Oct 28 12:46:39 2010 +0200

    Don't try to attach anything to the 'this' object of
    ExternalInterface.addCallback:
    
    1. It's wrong.
    2. It might be null.
    
    This means we don't store it anywhere now, but since it
    was stored and never accessed before that's no loss.

diff --git a/libcore/asobj/flash/external/ExternalInterface_as.cpp 
b/libcore/asobj/flash/external/ExternalInterface_as.cpp
index 40ec17f..eee1961 100644
--- a/libcore/asobj/flash/external/ExternalInterface_as.cpp
+++ b/libcore/asobj/flash/external/ExternalInterface_as.cpp
@@ -262,7 +262,7 @@ externalinterface_addCallback(const fn_call& fn)
         if (fn.arg(1).is_object()) {
             log_debug("adding callback %s", name);
             as_object* asCallback = toObject(fn.arg(1), getVM(fn));
-            mr.addExternalCallback(fn.this_ptr, name, asCallback);
+            mr.addExternalCallback(name, asCallback);
         }
     }
 
diff --git a/libcore/movie_root.cpp b/libcore/movie_root.cpp
index 598f62e..f8024a3 100644
--- a/libcore/movie_root.cpp
+++ b/libcore/movie_root.cpp
@@ -1509,14 +1509,14 @@ movie_root::executeAdvanceCallbacks()
     if (_controlfd) {
        boost::shared_ptr<ExternalInterface::invoke_t> invoke = 
            ExternalInterface::ExternalEventCheck(_controlfd);
-       if (invoke) {
-           if (processInvoke(invoke.get()) == false) {
-               if (!invoke->name.empty()) {
-                   log_error("Couldn't process ExternalInterface Call %s",
-                             invoke->name);
-               }
-           }
-       }       
+        if (invoke) {
+            if (processInvoke(invoke.get()) == false) {
+                if (!invoke->name.empty()) {
+                    log_error("Couldn't process ExternalInterface Call %s",
+                          invoke->name);
+                }
+            }
+        }      
     }
     
     processActionQueue();
@@ -1527,13 +1527,7 @@ movie_root::processInvoke(ExternalInterface::invoke_t 
*invoke)
 {
     GNASH_REPORT_FUNCTION;
 
-    if (invoke == 0) {
-       return false;
-    }
-    
-    if (invoke->name.empty()) {
-       return false;
-    }
+    if (!invoke || invoke->name.empty()) return false;
 
     log_debug("Processing %s call from the Browser.", invoke->name);
 
@@ -1586,9 +1580,9 @@ movie_root::processInvoke(ExternalInterface::invoke_t 
*invoke)
         MovieClip *mc = getLevel(0);
         int loaded = mc->get_bytes_loaded();
         int total = mc->get_bytes_total();
-       as_value val((loaded/total) * 100);
-       // PercentLoaded sends the percentage
-       ss << ExternalInterface::toXML(val);    
+        as_value val((loaded/total) * 100);
+        // PercentLoaded sends the percentage
+        ss << ExternalInterface::toXML(val);   
     } else if (invoke->name == "Play") {
         callInterface("ExternalInterface.Play");
        // Play doesn't send a response
@@ -1618,7 +1612,7 @@ movie_root::processInvoke(ExternalInterface::invoke_t 
*invoke)
         MovieClip *mc = getLevel(0);
         as_value val(mc->get_loaded_frames());
        // TotalFrames sends the number of frames in the movie
-       ss << ExternalInterface::toXML(val);
+        ss << ExternalInterface::toXML(val);
     } else {
         std::string result = callExternalCallback(invoke->name, invoke->args);
         if (result == ExternalInterface::makeString("Error")) {
@@ -1630,14 +1624,15 @@ movie_root::processInvoke(ExternalInterface::invoke_t 
*invoke)
     }
 
     if (!ss.str().empty()) {
-       if (_hostfd >= 0) {
-           log_debug(_("Attempt to write response to ExternalInterface 
requests fd %d"), _hostfd);
-           int ret = write(_hostfd, ss.str().c_str(), ss.str().size());
-           if (ret == -1) {
-               log_error(_("Could not write to user-provided host requests "
-                           "fd %d: %s"), _hostfd, std::strerror(errno));
-           }
-       }
+        if (_hostfd >= 0) {
+            log_debug(_("Attempt to write response to ExternalInterface "
+                        "requests fd %d"), _hostfd);
+            int ret = write(_hostfd, ss.str().c_str(), ss.str().size());
+            if (ret == -1) {
+            log_error(_("Could not write to user-provided host requests "
+                    "fd %d: %s"), _hostfd, std::strerror(errno));
+            }
+        }
     } else {
         log_debug("No response needed for %s request", invoke->name);
     }
@@ -1784,23 +1779,13 @@ movie_root::findDropTarget(boost::int32_t x, 
boost::int32_t y,
     return 0;
 }
 
-/// @example "Internal Gnash message 'addMethod'"
-///
-/// <pre>
-/// <invoke name="addMethod" returntype="xml">
-///      <arguments><string>methodname</string</arguments>
-/// </invoke>
-/// </pre>
+/// This should store a callback object in movie_root.
+//
+/// TODO: currently it doesn't.
 void
-movie_root::addExternalCallback(as_object *obj, const std::string &name,
-                                as_object *callback)
+movie_root::addExternalCallback(const std::string& name, as_object* callback)
 {
-    // GNASH_REPORT_FUNCTION;
-    
-    MovieClip *mc = getLevel(0);
-    as_object *me = getObject(mc);
-    string_table &st = getStringTable(*me);
-    obj->set_member(st.find(name), callback);
+    UNUSED(callback);
 
     // When an external callback is added, we have to notify the plugin
     // that this method is available.
diff --git a/libcore/movie_root.h b/libcore/movie_root.h
index b2e7e8c..76d7abc 100644
--- a/libcore/movie_root.h
+++ b/libcore/movie_root.h
@@ -853,8 +853,8 @@ public:
 
     const RunResources& runResources() const { return _runResources; }
 
-    void addExternalCallback(as_object *obj, const std::string &name,
-                             as_object *callback);
+    /// Add an ExternalInterface callback object with an associated name.
+    void addExternalCallback(const std::string& name, as_object* callback);
 
     bool processInvoke(ExternalInterface::invoke_t *);
 
diff --git a/testsuite/actionscript.all/ExternalInterface.as 
b/testsuite/actionscript.all/ExternalInterface.as
index be4bf30..74923d9 100644
--- a/testsuite/actionscript.all/ExternalInterface.as
+++ b/testsuite/actionscript.all/ExternalInterface.as
@@ -346,6 +346,13 @@ check_equals(typeof(EI._toAS(o)), "function");
 val = EI._objectToAS('<object><property 
id="b"><string>string</string></property><property 
id="a"><number>1</number></property></object>');
 xcheck_equals (typeOf(val), 'object');
 
+// Check what happens with addCallback
+
+// It doesn't add the callback as a member of ExternalInterface.
+o = {};
+EI.addCallback("func1", o);
+check_equals(EI.func1, undefined);
+
 #endif  // version > 7 }
 
 #endif // OUTPUT_VERSION >= 6 }
@@ -356,6 +363,6 @@ xcheck_equals (typeOf(val), 'object');
 #elif OUTPUT_VERSION < 8 // }{
        check_totals(49);
 #else // SWF8+ }{
-       check_totals(111);
+       check_totals(112);
 # endif // }
 

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


commit b3a8c2578b28ddc9f1a4e6efe933b59e21dc858f
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Oct 28 12:29:06 2010 +0200

    -1 doesn't convert to false.

diff --git a/libcore/movie_root.cpp b/libcore/movie_root.cpp
index ed5486e..598f62e 100644
--- a/libcore/movie_root.cpp
+++ b/libcore/movie_root.cpp
@@ -1630,7 +1630,7 @@ movie_root::processInvoke(ExternalInterface::invoke_t 
*invoke)
     }
 
     if (!ss.str().empty()) {
-       if (_hostfd) {
+       if (_hostfd >= 0) {
            log_debug(_("Attempt to write response to ExternalInterface 
requests fd %d"), _hostfd);
            int ret = write(_hostfd, ss.str().c_str(), ss.str().size());
            if (ret == -1) {
@@ -1639,7 +1639,7 @@ movie_root::processInvoke(ExternalInterface::invoke_t 
*invoke)
            }
        }
     } else {
-       log_debug("No response needed for %s request", invoke->name);
+        log_debug("No response needed for %s request", invoke->name);
     }
 
     return true;
@@ -1804,7 +1804,7 @@ movie_root::addExternalCallback(as_object *obj, const 
std::string &name,
 
     // When an external callback is added, we have to notify the plugin
     // that this method is available.
-    if (_hostfd) {
+    if (_hostfd >= 0) {
         std::vector<as_value> fnargs;
         fnargs.push_back(name);
         std::string msg = ExternalInterface::makeInvoke("addMethod", fnargs);
@@ -1839,7 +1839,7 @@ movie_root::callExternalJavascript(const std::string 
&name,
     std::string result;
     // If the browser is connected, we send an Invoke message to the
     // browser.
-    if (_controlfd && _hostfd) {
+    if (_controlfd >= 0 && _hostfd >= 0) {
         std::string msg = ExternalInterface::makeInvoke(name, fnargs);
         
         const size_t ret = ExternalInterface::writeBrowser(_hostfd, msg);
@@ -1900,7 +1900,7 @@ movie_root::callExternalCallback(const std::string &name,
         
     // If the browser is connected, we send an Invoke message to the
     // browser.
-    if (_hostfd) {
+    if (_hostfd >= 0) {
         const size_t ret = ExternalInterface::writeBrowser(_hostfd, result);
         if (ret != result.size()) {
             log_error(_("Could not write to browser fd #%d: %s"),
@@ -2110,7 +2110,7 @@ movie_root::getURL(const std::string& urlstr, const 
std::string& target,
 
     log_network("%s: HOSTFD is %d",  __FUNCTION__, _hostfd);
     
-    if (_hostfd == -1) {
+    if (_hostfd < 0) {
         /// If there is no hosting application, call the URL launcher. For
         /// safety, we resolve the URL against the base URL for this run.
         /// The data is not sent at all.

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

Summary of changes:
 .../asobj/flash/external/ExternalInterface_as.cpp  |    2 +-
 libcore/movie_root.cpp                             |   79 ++++++++------------
 libcore/movie_root.h                               |    4 +-
 testsuite/actionscript.all/ExternalInterface.as    |    9 ++-
 4 files changed, 43 insertions(+), 51 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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