[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

philn at webkit.org philn at webkit.org
Thu Feb 4 21:32:15 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 920afe08a5ff4f78cb521c2858be9fb055dedf51
Author: philn at webkit.org <philn at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 29 15:04:43 2010 +0000

    2010-01-29  Philippe Normand  <pnormand at igalia.com>
    
            Reviewed by Gustavo Noronha Silva.
    
            [Gtk] Vimeo HTML5 player doesn't work
            https://bugs.webkit.org/show_bug.cgi?id=34327
    
            Send Referer when requesting media over HTTP.
    
            Test: http/tests/media/video-referer.html
    
            * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
            (WebCore::mediaPlayerPrivateSourceChangedCallback):
    
    2010-01-29  Philippe Normand  <pnormand at igalia.com>
    
            Reviewed by Gustavo Noronha Silva.
    
            [Gtk] Vimeo HTML5 player doesn't work
            https://bugs.webkit.org/show_bug.cgi?id=34327
    
            Test for HTTP Referer checking when playing remote media.
    
            * http/tests/media/resources/setCookieAndReferer.cgi: Added.
            * http/tests/media/resources/video-referer-check-referer.php: Added.
            * http/tests/media/video-referer-expected.txt: Added.
            * http/tests/media/video-referer.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54061 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7e81892..6f3c19c 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-01-29  Philippe Normand  <pnormand at igalia.com>
+
+        Reviewed by Gustavo Noronha Silva.
+
+        [Gtk] Vimeo HTML5 player doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=34327
+
+        Test for HTTP Referer checking when playing remote media.
+
+        * http/tests/media/resources/setCookieAndReferer.cgi: Added.
+        * http/tests/media/resources/video-referer-check-referer.php: Added.
+        * http/tests/media/video-referer-expected.txt: Added.
+        * http/tests/media/video-referer.html: Added.
+
 2010-01-29  Andras Becsi  <abecsi at webkit.org>
 
         Unreviewed.
diff --git a/LayoutTests/http/tests/media/resources/setCookieAndReferer.cgi b/LayoutTests/http/tests/media/resources/setCookieAndReferer.cgi
new file mode 100755
index 0000000..fc96efd
--- /dev/null
+++ b/LayoutTests/http/tests/media/resources/setCookieAndReferer.cgi
@@ -0,0 +1,15 @@
+#!/usr/bin/perl -wT
+use CGI;
+
+$query = new CGI;
+$name = $query->param('name');
+$referer = $query->param('referer');
+
+print "Content-Type: text/plain\n";
+print "Cache-Control: no-store\n";
+print 'Cache-Control: no-cache="set-cookie"' . "\n";
+
+print "Referer: ${referer}\n";
+
+# We only map the SET_COOKIE request header to "Set-Cookie"
+print "Set-Cookie: TEST=${name}\n\n";
diff --git a/LayoutTests/http/tests/media/resources/video-referer-check-referer.php b/LayoutTests/http/tests/media/resources/video-referer-check-referer.php
new file mode 100644
index 0000000..d888044
--- /dev/null
+++ b/LayoutTests/http/tests/media/resources/video-referer-check-referer.php
@@ -0,0 +1,24 @@
+<?php
+    if($_SERVER['HTTP_REFERER'])
+    {
+        $extension = substr($_COOKIE["TEST"], -3);
+
+        if ($extension == 'mp4') {
+               header("Content-Type: video/mp4");
+               $fileName = "test.mp4";
+        } else if ($extension == 'ogv') {
+               header("Content-Type: video/ogg");
+               $fileName = "test.ogv";
+        } else
+               die;
+
+        header("Cache-Control: no-store");
+        header("Connection: close");
+
+        $fn = fopen($fileName, "r");
+        fpassthru($fn);
+        fclose($fn);
+        exit;
+    } else
+        die;
+?>
diff --git a/LayoutTests/http/tests/media/video-referer-expected.txt b/LayoutTests/http/tests/media/video-referer-expected.txt
new file mode 100644
index 0000000..486e563
--- /dev/null
+++ b/LayoutTests/http/tests/media/video-referer-expected.txt
@@ -0,0 +1,3 @@
+EVENT(canplaythrough)
+Tests that the media player will send the relevant referer when requesting the media file.
+
diff --git a/LayoutTests/http/tests/media/video-referer.html b/LayoutTests/http/tests/media/video-referer.html
new file mode 100644
index 0000000..866099c
--- /dev/null
+++ b/LayoutTests/http/tests/media/video-referer.html
@@ -0,0 +1,37 @@
+<html>
+<head>
+</head>
+<body onload="loadCookieAndReferer()">
+<video id="video"></video>
+<script src=../../../media/video-test.js></script>
+<script src=../../../media/media-file.js></script>
+<script>
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+
+    function loadCookieAndReferer () {
+        var movie = findMediaFile("video", "resources/test");
+        var frame = document.createElement("iframe");
+        document.body.appendChild(frame);
+
+        frame.addEventListener('load', function () {
+                video = document.getElementById('video');
+                video.src="http://127.0.0.1:8000/media/resources/video-referer-check-referer.php";
+                video.play();
+        });
+
+        frame.width = 0;
+        frame.height = 0;
+        frame.src = "http://127.0.0.1:8000/media/resources/setCookieAndReferer.cgi?name=" + movie + "&referer=http://127.0.0.1:8000/media/resources";
+    }
+
+    waitForEvent("canplaythrough", function () {
+        if (window.layoutTestController)
+            window.layoutTestController.notifyDone();
+    } );
+</script>
+Tests that the media player will send the relevant referer when requesting the media file.<br/>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 881003f..500b136 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-01-29  Philippe Normand  <pnormand at igalia.com>
+
+        Reviewed by Gustavo Noronha Silva.
+
+        [Gtk] Vimeo HTML5 player doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=34327
+
+        Send Referer when requesting media over HTTP.
+
+        Test: http/tests/media/video-referer.html
+
+        * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::mediaPlayerPrivateSourceChangedCallback):
+
 2010-01-29  Oswald Buddenhagen <oswald.buddenhagen at nokia.com>
 
         Reviewed by Simon Hausmann.
diff --git a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
index a46d395..41f90f0 100644
--- a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
+++ b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp
@@ -29,6 +29,9 @@
 
 #include "CString.h"
 #include "DataSourceGStreamer.h"
+#include "Document.h"
+#include "Frame.h"
+#include "FrameView.h"
 #include "GraphicsContext.h"
 #include "IntRect.h"
 #include "KURL.h"
@@ -161,6 +164,16 @@ void mediaPlayerPrivateSourceChangedCallback(GObject *object, GParamSpec *pspec,
         char* cookiesStrv[] = {cookies, NULL};
         g_object_set(element, "cookies", cookiesStrv, NULL);
         g_free(cookies);
+
+        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);
+        }
     }
 
     gst_object_unref(element);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list