[SCM] WebKit Debian packaging branch, debian/unstable, updated. upstream/1.1.20-243-g5f6bf91
Gustavo Noronha Silva
kov at debian.org
Thu Feb 4 23:33:00 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit 231fbec75bf2f20cfb0386de71bf1d460a286f2a
Author: philn at webkit.org <philn at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Feb 4 08:32:14 2010 +0000
2010-02-02 Philippe Normand <pnormand at igalia.com>
Reviewed by Gustavo Noronha Silva.
[Gtk] libsoup critical warning in media player http cookies injection code
https://bugs.webkit.org/show_bug.cgi?id=34435
Fixed the critical warning and refactored the
User-Agent/Referer/cookies injection code, in that order. Previous
order (cookies first) was wrong because if cookies injection could
not be done neither the User-Agent nor Referer were injected. Also
started a non-JSC-specific, gtk-specific GOwnPtr module.
* GNUmakefile.am:
* platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
(WebCore::mediaPlayerPrivateSourceChangedCallback):
* platform/gtk/GOwnPtrGtk.cpp: Added.
(WTF::SoupURI):
(WTF::GstElement):
* platform/gtk/GOwnPtrGtk.h: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54330 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 2680a80..896479b 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -2006,6 +2006,8 @@ webcoregtk_sources += \
WebCore/platform/gtk/FileSystemGtk.cpp \
WebCore/platform/gtk/GRefPtrGtk.cpp \
WebCore/platform/gtk/GRefPtrGtk.h \
+ WebCore/platform/gtk/GOwnPtrGtk.cpp \
+ WebCore/platform/gtk/GOwnPtrGtk.h \
WebCore/platform/gtk/GtkPluginWidget.cpp \
WebCore/platform/gtk/GtkPluginWidget.h \
WebCore/platform/gtk/KURLGtk.cpp \
diff --git a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
index d96c1e3..4866112 100644
--- a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
+++ b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
@@ -131,52 +131,60 @@ gboolean mediaPlayerPrivateMessageCallback(GstBus* bus, GstMessage* message, gpo
void mediaPlayerPrivateSourceChangedCallback(GObject *object, GParamSpec *pspec, gpointer data)
{
MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data);
- GstElement* element;
+ GOwnPtr<GstElement> element;
- g_object_get(mp->m_playBin, "source", &element, NULL);
- gst_object_replace((GstObject**) &mp->m_source, (GstObject*) element);
+ g_object_get(mp->m_playBin, "source", &element.outPtr(), NULL);
+ gst_object_replace((GstObject**) &mp->m_source, (GstObject*) element.get());
- if (element) {
- GParamSpec* pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(element), "cookies");
+ if (!element)
+ return;
- // First check if the source element has a cookies property
- // of the format we expect
- if (!pspec || pspec->value_type != G_TYPE_STRV)
- return;
+ GOwnPtr<char> location;
+ g_object_get(element.get(), "location", &location.outPtr(), NULL);
- // Then get the cookies for the URI and set them
- SoupSession* session = webkit_get_default_session();
- SoupCookieJar* cookieJar = SOUP_COOKIE_JAR(soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR));
+ // Do injection only for elements dealing with uris.
+ if (!gst_uri_is_valid(location.get()))
+ return;
- char* location;
- g_object_get(element, "location", &location, NULL);
+ GOwnPtr<SoupURI> uri(soup_uri_new(location.get()));
- SoupURI* uri = soup_uri_new(location);
- g_free(location);
+ // Do injection only for http(s) uris.
+ if (!SOUP_URI_VALID_FOR_HTTP(uri))
+ return;
- // Let Apple web servers know we want to access their nice movie trailers.
- if (g_str_equal(uri->host, "movies.apple.com"))
- g_object_set(element, "user-agent", "Quicktime/7.2.0", NULL);
+ // Let Apple web servers know we want to access their nice movie trailers.
+ if (g_str_equal(uri->host, "movies.apple.com"))
+ g_object_set(element.get(), "user-agent", "Quicktime/7.2.0", NULL);
+
+ // Set the HTTP referer.
+ Frame* frame = mp->m_player->frameView() ? mp->m_player->frameView()->frame() : 0;
+ Document* document = frame ? frame->document() : 0;
+ if (document) {
+ GstStructure* extraHeaders = gst_structure_new("extra-headers",
+ "Referer", G_TYPE_STRING,
+ document->documentURI().utf8().data(), 0);
+ g_object_set(element.get(), "extra-headers", extraHeaders, NULL);
+ gst_structure_free(extraHeaders);
+ }
- char* cookies = soup_cookie_jar_get_cookies(cookieJar, uri, FALSE);
- soup_uri_free(uri);
+ // Deal with the cookies from now on.
+ GParamSpec* cookiesParamSpec = g_object_class_find_property(G_OBJECT_GET_CLASS(element.get()), "cookies");
- char* cookiesStrv[] = {cookies, NULL};
- g_object_set(element, "cookies", cookiesStrv, NULL);
- g_free(cookies);
+ // First check if the source element has a cookies property
+ // of the format we expect
+ if (!cookiesParamSpec || cookiesParamSpec->value_type != G_TYPE_STRV)
+ return;
- Frame* frame = mp->m_player->frameView() ? mp->m_player->frameView()->frame() : 0;
- Document* document = frame ? frame->document() : 0;
- if (document) {
- GstStructure* extraHeaders = gst_structure_new("extra-headers",
- "Referer", G_TYPE_STRING,
- document->documentURI().utf8().data(), 0);
- g_object_set(element, "extra-headers", extraHeaders, NULL);
- gst_structure_free(extraHeaders);
- }
- }
+ // Then get the cookies for the URI and set them
+ SoupSession* session = webkit_get_default_session();
+ SoupSessionFeature* cookieJarFeature = soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR);
+ if (!cookieJarFeature)
+ return;
- gst_object_unref(element);
+ SoupCookieJar* cookieJar = SOUP_COOKIE_JAR(cookieJarFeature);
+ GOwnPtr<char> cookies(soup_cookie_jar_get_cookies(cookieJar, uri.get(), FALSE));
+ char* cookiesStrv[] = {cookies.get(), 0};
+ g_object_set(element.get(), "cookies", cookiesStrv, NULL);
}
void mediaPlayerPrivateVolumeChangedCallback(GObject *element, GParamSpec *pspec, gpointer data)
diff --git a/JavaScriptCore/wtf/gtk/GRefPtr.cpp b/WebCore/platform/gtk/GOwnPtrGtk.cpp
similarity index 72%
copy from JavaScriptCore/wtf/gtk/GRefPtr.cpp
copy to WebCore/platform/gtk/GOwnPtrGtk.cpp
index e7cf34b..3bb1335 100644
--- a/JavaScriptCore/wtf/gtk/GRefPtr.cpp
+++ b/WebCore/platform/gtk/GOwnPtrGtk.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Martin Robinson
+ * Copyright (C) 2010 Igalia S.L
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -16,23 +16,25 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
#include "config.h"
-#include "GRefPtr.h"
+#include "GOwnPtrGtk.h"
-#include <glib.h>
+#include <gst/gstelement.h>
+#include <libsoup/soup-uri.h>
namespace WTF {
-template <> GHashTable* refGPtr(GHashTable* ptr)
+template <> void freeOwnedGPtr<SoupURI>(SoupURI* ptr)
{
if (ptr)
- g_hash_table_ref(ptr);
- return ptr;
+ soup_uri_free(ptr);
}
-template <> void derefGPtr(GHashTable* ptr)
+template <> void freeOwnedGPtr<GstElement>(GstElement* ptr)
{
- g_hash_table_unref(ptr);
+ if (ptr)
+ gst_object_unref(ptr);
}
-} // namespace WTF
+}
diff --git a/JavaScriptCore/wtf/GetPtr.h b/WebCore/platform/gtk/GOwnPtrGtk.h
similarity index 73%
copy from JavaScriptCore/wtf/GetPtr.h
copy to WebCore/platform/gtk/GOwnPtrGtk.h
index 25a0e6d..c585002 100644
--- a/JavaScriptCore/wtf/GetPtr.h
+++ b/WebCore/platform/gtk/GOwnPtrGtk.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2010 Igalia S.L
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -15,19 +15,21 @@
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
- *
*/
-#ifndef WTF_GetPtr_h
-#define WTF_GetPtr_h
+#ifndef GOwnPtrGtk_h
+#define GOwnPtrGtk_h
+
+#include "GOwnPtr.h"
+
+typedef struct _SoupURI SoupURI;
+typedef struct _GstElement GstElement;
namespace WTF {
- template <typename T> inline T* getPtr(T* p)
- {
- return p;
- }
+template<> void freeOwnedGPtr<SoupURI>(SoupURI* ptr);
+template<> void freeOwnedGPtr<GstElement>(GstElement* ptr);
-} // namespace WTF
+}
-#endif // WTF_GetPtr_h
+#endif
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list