[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.20-204-g221d8e8
philn at webkit.org
philn at webkit.org
Wed Feb 10 22:12:22 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 81bbad30a86821892a8fe3ba27c40a131f86df8d
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/ChangeLog b/WebCore/ChangeLog
index a91a309..a7f44d3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+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.
+
2010-02-04 Mikhail Naganov <mnaganov at chromium.org>
Reviewed by Timothy Hatcher.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 9f973da..973eba3 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -2009,6 +2009,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/WebCore/platform/gtk/GOwnPtrGtk.cpp b/WebCore/platform/gtk/GOwnPtrGtk.cpp
new file mode 100644
index 0000000..3bb1335
--- /dev/null
+++ b/WebCore/platform/gtk/GOwnPtrGtk.cpp
@@ -0,0 +1,40 @@
+/*
+ * 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
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include "config.h"
+#include "GOwnPtrGtk.h"
+
+#include <gst/gstelement.h>
+#include <libsoup/soup-uri.h>
+
+namespace WTF {
+
+template <> void freeOwnedGPtr<SoupURI>(SoupURI* ptr)
+{
+ if (ptr)
+ soup_uri_free(ptr);
+}
+
+template <> void freeOwnedGPtr<GstElement>(GstElement* ptr)
+{
+ if (ptr)
+ gst_object_unref(ptr);
+}
+
+}
diff --git a/WebCore/platform/gtk/GOwnPtrGtk.h b/WebCore/platform/gtk/GOwnPtrGtk.h
new file mode 100644
index 0000000..c585002
--- /dev/null
+++ b/WebCore/platform/gtk/GOwnPtrGtk.h
@@ -0,0 +1,35 @@
+/*
+ * 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
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * 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 GOwnPtrGtk_h
+#define GOwnPtrGtk_h
+
+#include "GOwnPtr.h"
+
+typedef struct _SoupURI SoupURI;
+typedef struct _GstElement GstElement;
+
+namespace WTF {
+
+template<> void freeOwnedGPtr<SoupURI>(SoupURI* ptr);
+template<> void freeOwnedGPtr<GstElement>(GstElement* ptr);
+
+}
+
+#endif
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list