[totem/gnome-2-28] Fix URL parameter usage in GMP plugin



commit 418e67d538d8194e70772f0dc0086bc695ab5bb5
Author: Bastien Nocera <hadess hadess net>
Date:   Wed May 5 17:50:52 2010 +0100

    Fix URL parameter usage in GMP plugin
    
    The URL parameter is never the baseURI, it's the same as the SRC
    parameter, so some websites use both.
    
    Add support for the actual "baseURL" parameter instead.
    
    Fixes playback at:
    http://www.ta3.com/sk/relacie/23_hlavne-spravy/9167_hlavne-spravy-z-27-aprila
    
    https://bugzilla.gnome.org/show_bug.cgi?id=617639

 browser-plugin/totemPlugin.cpp |   26 ++++++++++++++++++++++++--
 browser-plugin/totemPlugin.h   |    1 +
 2 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/browser-plugin/totemPlugin.cpp b/browser-plugin/totemPlugin.cpp
index 5186ba1..0e11843 100644
--- a/browser-plugin/totemPlugin.cpp
+++ b/browser-plugin/totemPlugin.cpp
@@ -996,7 +996,6 @@ totemPlugin::RequestStream (bool aForceViewer)
 	/* Prefer filename over src */
 	if (mURLURI) {
 		requestURI = mURLURI;
-		baseURI = mSrcURI; /* FIXME: that correct? */
 	}
 #endif /* TOTEM_GMP_PLUGIN */
 
@@ -1585,7 +1584,23 @@ totemPlugin::SetURL (const char* aURL)
 
         mURLURI = g_strdup (aURL);
 
-	/* FIXME: what is the correct base for the URL param? mSrcURI or mBaseURI? */
+	/* FIXME: security checks? */
+        /* FIXMEchpe: resolve the URI here? */
+}
+
+void
+totemPlugin::SetBaseURL (const char *aBaseURL)
+{
+        g_free (mBaseURI);
+
+	/* Don't allow empty URL */
+        if (!aBaseURL || !aBaseURL[0]) {
+                mBaseURI = NULL;
+		return;
+        }
+
+        mBaseURI = g_strdup (aBaseURL);
+
 	/* FIXME: security checks? */
         /* FIXMEchpe: resolve the URI here? */
 }
@@ -2116,6 +2131,12 @@ totemPlugin::Init (NPMIMEType mimetype,
         if (filename) {
                 SetURL (filename);
         }
+
+        /* http://msdn.microsoft.com/en-us/library/dd564090(v=VS.85).aspx */
+        const char *base = (const char *) g_hash_table_lookup (args, "baseurl");
+        if (base)
+		SetBaseURL (base);
+
 #endif /* TOTEM_GMP_PLUGIN */
 
 #ifdef TOTEM_NARROWSPACE_PLUGIN
@@ -2288,6 +2309,7 @@ totemPlugin::Init (NPMIMEType mimetype,
 
 	/* Dump some disagnostics */
 	D ("mSrcURI: %s", mSrcURI ? mSrcURI : "");
+	D ("mBaseURI: %s", mBaseURI ? mBaseURI : "");
 	D ("mCache: %d", mCache);
 	D ("mControllerHidden: %d", mControllerHidden);
 	D ("mShowStatusbar: %d", mShowStatusbar);
diff --git a/browser-plugin/totemPlugin.h b/browser-plugin/totemPlugin.h
index 7eedaef..6c4df93 100644
--- a/browser-plugin/totemPlugin.h
+++ b/browser-plugin/totemPlugin.h
@@ -257,6 +257,7 @@ class totemPlugin {
 #ifdef TOTEM_GMP_PLUGIN
   public:
     void SetURL (const char* aURL);
+    void SetBaseURL (const char* aBaseURL);
     const char* URL() const { return mURLURI; }
 
   private:



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