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_start-


From: Bastiaan Jacques
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-178-g74198b7
Date: Sun, 06 Mar 2011 17:50:33 +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  74198b7a44c87000bfe6b9e2b0f30a2d9e95594f (commit)
       via  89ca17faa8e168be40a66f0b286b44b7ee5ea241 (commit)
      from  6f8f606ee6a0658067b67b6bda7fc8dfff54565a (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=74198b7a44c87000bfe6b9e2b0f30a2d9e95594f


commit 74198b7a44c87000bfe6b9e2b0f30a2d9e95594f
Author: Bastiaan Jacques <address@hidden>
Date:   Sun Mar 6 18:49:49 2011 +0100

    Query the DOM for cookies associated with the page if NPAPI returns nothing.

diff --git a/plugin/npapi/plugin.cpp b/plugin/npapi/plugin.cpp
index e8a23da..788481d 100644
--- a/plugin/npapi/plugin.cpp
+++ b/plugin/npapi/plugin.cpp
@@ -997,6 +997,55 @@ create_standalone_launcher(const std::string& page_url, 
const std::string& swf_u
 #endif
 }
 
+std::string
+nsPluginInstance::getDocumentProp(const std::string& propname) const
+{
+    std::string rv;
+
+    NPObject* windowobj;
+    NPError err = NPN_GetValue(_instance, NPNVWindowNPObject, &windowobj);
+    if (err != NPERR_NO_ERROR || !windowobj) {
+        return rv;
+    }
+
+    boost::shared_ptr<NPObject> window_obj(windowobj, NPN_ReleaseObject);
+  
+    NPIdentifier doc_id = NPN_GetStringIdentifier("document");
+
+    NPVariant docvar;
+    if(! NPN_GetProperty(_instance, windowobj, doc_id, &docvar) ) {
+        return rv;
+    }
+
+    boost::shared_ptr<NPVariant> doc_var(&docvar, NPN_ReleaseVariantValue);
+
+    if (!NPVARIANT_IS_OBJECT(docvar)) {
+        return rv;
+    }
+
+    NPObject* doc_obj = NPVARIANT_TO_OBJECT(docvar);
+    
+    NPIdentifier prop_id = NPN_GetStringIdentifier(propname.c_str());
+
+    NPVariant propvar;
+    if (!NPN_GetProperty(_instance, doc_obj, prop_id, &propvar)) {
+        return rv;
+    }
+
+    boost::shared_ptr<NPVariant> prop_var(&propvar, NPN_ReleaseVariantValue);
+
+    if (!NPVARIANT_IS_STRING(propvar)) {
+        return rv;
+    }
+
+    const NPString& prop_str = NPVARIANT_TO_STRING(propvar);
+
+    rv = NPStringToString(prop_str);
+    return rv;
+}
+
+
+
 void
 nsPluginInstance::setupCookies(const std::string& pageurl)
 {
@@ -1015,31 +1064,45 @@ nsPluginInstance::setupCookies(const std::string& 
pageurl)
     std::string::size_type pos;
     pos = pageurl.find("/", pageurl.find("//", 0) + 2) + 1;
     std::string url = pageurl.substr(0, pos);
-    
+
+    std::string ncookie;
+ 
     char *cookie = 0;
     uint32_t length = 0;
-    NPN_GetValueForURL(_instance, NPNURLVCookie, url.c_str(),
+
+    NPError rv = NPN_GetValueForURL(_instance, NPNURLVCookie, url.c_str(),
                        &cookie, &length);
+
+    // Firefox does not (always) return the cookies that are associated
+    // with a domain name through GetValueForURL.
+    if (rv == NPERR_GENERIC_ERROR) {
+        log_debug("Trying window.document.cookie for cookies");
+        ncookie = getDocumentProp("cookie");
+    }
     if (cookie) {
-        std::string ncookie (cookie, length);
-        gnash::log_debug("The Cookie for %s is %s", url, ncookie);
-        std::ofstream cookiefile;
-        std::stringstream ss;
-        ss << "/tmp/gnash-cookies." << getpid(); 
-        
-        cookiefile.open(ss.str().c_str(), std::ios::out | std::ios::trunc);
-        cookiefile << "Set-Cookie: " << ncookie << std::endl;
-        cookiefile.close();
-        
-        if (setenv("GNASH_COOKIES_IN", ss.str().c_str(), 1) < 0) {
-            gnash::log_error(
-                "Couldn't set environment variable GNASH_COOKIES_IN to %s",
-                ncookie);
-        }
+        ncookie.assign(cookie, length);
         NPN_MemFree(cookie);
-    } else {
+    }
+
+    if (ncookie.empty()) {
         gnash::log_debug("No stored Cookie for %s", url);
-    }    
+        return;
+    }
+
+    gnash::log_debug("The Cookie for %s is %s", url, ncookie);
+    std::ofstream cookiefile;
+    std::stringstream ss;
+    ss << "/tmp/gnash-cookies." << getpid(); 
+ 
+    cookiefile.open(ss.str().c_str(), std::ios::out | std::ios::trunc);
+    cookiefile << "Set-Cookie: " << ncookie << std::endl;
+    cookiefile.close();
+  
+    if (setenv("GNASH_COOKIES_IN", ss.str().c_str(), 1) < 0) {
+        gnash::log_error(
+            "Couldn't set environment variable GNASH_COOKIES_IN to %s",
+            ncookie);
+    }
 }
 
 void
@@ -1323,6 +1386,10 @@ nsPluginInstance::startProc()
     exit (-1);
 }
 
+
+
+
+
 std::string
 nsPluginInstance::getCurrentPageURL() const
 {
@@ -1331,63 +1398,8 @@ nsPluginInstance::getCurrentPageURL() const
     //
     // Was (bogus):
     //  window.document.location.href
-    //
-
-    NPP npp = _instance;
-
-    NPIdentifier sDocument = NPN_GetStringIdentifier("document");
-
-    NPObject *window;
-    NPN_GetValue(npp, NPNVWindowNPObject, &window);
-
-    NPVariant vDoc;
-    NPN_GetProperty(npp, window, sDocument, &vDoc);
-    NPN_ReleaseObject(window);
-
-    if (!NPVARIANT_IS_OBJECT(vDoc)) {
-        gnash::log_error("Can't get window.document object");
-        return std::string();
-    }
-    
-    NPObject* npDoc = NPVARIANT_TO_OBJECT(vDoc);
-
-/*
-    NPIdentifier sLocation = NPN_GetStringIdentifier("location");
-    NPVariant vLoc;
-    NPN_GetProperty(npp, npDoc, sLocation, &vLoc);
-    NPN_ReleaseObject(npDoc);
-
-    if (!NPVARIANT_IS_OBJECT(vLoc)) {
-        gnash::log_error("Can't get window.document.location object");
-        return std::string();
-    }
-
-    NPObject* npLoc = NPVARIANT_TO_OBJECT(vLoc);
-
-    NPIdentifier sProperty = NPN_GetStringIdentifier("href");
-    NPVariant vProp;
-    NPN_GetProperty(npp, npLoc, sProperty, &vProp);
-    NPN_ReleaseObject(npLoc);
-
-    if (!NPVARIANT_IS_STRING(vProp)) {
-        gnash::log_error("Can't get window.document.location.href string");
-        return std::string();
-    }
-*/
-
-    NPIdentifier sProperty = NPN_GetStringIdentifier("baseURI");
-    NPVariant vProp;
-    NPN_GetProperty(npp, npDoc, sProperty, &vProp);
-    NPN_ReleaseObject(npDoc);
-
-    if (!NPVARIANT_IS_STRING(vProp)) {
-        gnash::log_error("Can't get window.document.baseURI string");
-        return std::string();
-    }
-
-    const NPString& propValue = NPVARIANT_TO_STRING(vProp);
 
-    return NPStringToString(propValue);
+    return getDocumentProp("baseURI");
 }
 
 void
diff --git a/plugin/npapi/plugin.h b/plugin/npapi/plugin.h
index 3ba09f1..409381e 100644
--- a/plugin/npapi/plugin.h
+++ b/plugin/npapi/plugin.h
@@ -95,6 +95,9 @@ private:
     void setupCookies(const std::string& pageURL);
     void setupProxy(const std::string& pageURL);
 
+    /// @return a string property of window.document.
+    std::string getDocumentProp(const std::string& propname) const;
+
     static bool handlePlayerRequestsWrapper(GIOChannel* iochan, GIOCondition 
cond, nsPluginInstance* plugin);
 
     bool handlePlayerRequests(GIOChannel* iochan, GIOCondition cond);

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


commit 89ca17faa8e168be40a66f0b286b44b7ee5ea241
Author: Bastiaan Jacques <address@hidden>
Date:   Sun Mar 6 18:49:21 2011 +0100

    New gettext doesn't define $shlibext, on which our scripts rely, so pick it 
up
    anyway.

diff --git a/configure.ac b/configure.ac
index 80b7a24..f4cdda1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -213,6 +213,17 @@ AM_GNU_GETTEXT([external])
 AM_CONDITIONAL(HAS_GETTEXT, test x$ac_cv_path_XGETTEXT != x)
 dnl AM_GNU_GETTEXT_VERSION(0.15)
 
+dnl Many of the Gnash macros depend on gettext macros defining shlibext; recent
+dnl gettext however does not.
+if test x"${shlibext}" = x; then
+  if text x"${acl_cv_shlibext}" = x; then
+    echo "Gettext macros were supposed to define shared library extensions"
+    exit 1;
+  else
+    shlibext="${acl_cv_shlibext}"
+  fi
+fi
+
 dnl This is primarily used when compiling for a similar architecture,
 dnl like pentium->geode, which can use the same compiler, but have
 dnl different development libraries.

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

Summary of changes:
 configure.ac            |   11 +++
 plugin/npapi/plugin.cpp |  162 +++++++++++++++++++++++++----------------------
 plugin/npapi/plugin.h   |    3 +
 3 files changed, 101 insertions(+), 75 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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