[totem] Fix URL parameter usage in GMP plugin



commit ae5e1b16592a34f824713d655def63660f45100a
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 a30ffcc..25cf7ff 100644
--- a/browser-plugin/totemPlugin.cpp
+++ b/browser-plugin/totemPlugin.cpp
@@ -1042,7 +1042,6 @@ totemPlugin::RequestStream (bool aForceViewer)
 	/* Prefer filename over src */
 	if (mURLURI) {
 		requestURI = mURLURI;
-		baseURI = mSrcURI; /* FIXME: that correct? */
 	}
 #endif /* TOTEM_GMP_PLUGIN */
 
@@ -1655,7 +1654,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? */
 }
@@ -2006,6 +2021,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
@@ -2141,6 +2162,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 1cd33d1..d42b9e1 100644
--- a/browser-plugin/totemPlugin.h
+++ b/browser-plugin/totemPlugin.h
@@ -284,6 +284,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]