[GTK] media/video-src-blob.html
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Oct 2013 08:07:46 +0000 (08:07 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Oct 2013 08:07:46 +0000 (08:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=102586

Reviewed by Martin Robinson.

Source/WebCore:

Add support for loading videos using blob URLs.

Fixes media/video-src-blob.html.

* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webKitWebSrcStart): Use BufferData buffering policy for blob
URLs.
(webKitWebSrcGetProtocols): Add blob to the list of supported
protocols.
(webKitWebSrcSetUri): Consider blob URLs as valid.

LayoutTests:

* platform/gtk/TestExpectations: Unskip
media/video-src-blob.html.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157091 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/gtk/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp

index acb0d2d..92c83fa 100644 (file)
@@ -1,3 +1,13 @@
+2013-10-07  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] media/video-src-blob.html
+        https://bugs.webkit.org/show_bug.cgi?id=102586
+
+        Reviewed by Martin Robinson.
+
+        * platform/gtk/TestExpectations: Unskip
+        media/video-src-blob.html.
+
 2013-10-07  Alexey Proskuryakov  <ap@apple.com>
 
         webaudio/javascriptaudionode-upmix2-8channel-input.html is flaky on Mac WK2
index 3479905..0c2d021 100644 (file)
@@ -1191,8 +1191,6 @@ webkit.org/b/101539 editing/execCommand/switch-list-type-with-orphaned-li.html [
 webkit.org/b/102349 fast/dom/shadow/pseudoclass-update-enabled-anchor.html [ ImageOnlyFailure ]
 webkit.org/b/102349 fast/dom/shadow/pseudoclass-update-enabled-area.html [ ImageOnlyFailure ]
 
-webkit.org/b/102586 media/video-src-blob.html [ Failure ]
-
 # Fix for https://bugs.webkit.org/show_bug.cgi?id=97192 introduces these regressions
 webkit.org/b/102776 webkit.org/b/102993 media/media-document-audio-repaint.html [ Failure Timeout ]
 webkit.org/b/102776 media/track/track-cue-rendering-horizontal.html [ Failure ]
index 87989d7..f71f7cb 100644 (file)
@@ -1,3 +1,22 @@
+2013-10-07  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+
+        [GTK] media/video-src-blob.html
+        https://bugs.webkit.org/show_bug.cgi?id=102586
+
+        Reviewed by Martin Robinson.
+
+        Add support for loading videos using blob URLs.
+
+        Fixes media/video-src-blob.html.
+
+        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
+        (webKitWebSrcStart): Use BufferData buffering policy for blob
+        URLs.
+        (webKitWebSrcGetProtocols): Add blob to the list of supported
+        protocols.
+        (webKitWebSrcSetUri): Consider blob URLs as valid.
+
 2013-10-07  Ryosuke Niwa  <rniwa@webkit.org>
 
         EventDispatchBehavior is unnecessary
index 7964295..3f9a075 100644 (file)
@@ -646,6 +646,11 @@ static gboolean webKitWebSrcQuery(GstPad* pad, GstQuery* query)
 }
 #endif
 
+static bool urlHasSupportedProtocol(const URL& url)
+{
+    return url.isValid() && (url.protocolIsInHTTPFamily() || url.protocolIs("blob"));
+}
+
 // uri handler interface
 
 #ifdef GST_API_VERSION_1
@@ -656,7 +661,7 @@ static GstURIType webKitWebSrcUriGetType(GType)
 
 const gchar* const* webKitWebSrcGetProtocols(GType)
 {
-    static const char* protocols[] = {"http", "https", 0 };
+    static const char* protocols[] = {"http", "https", "blob", 0 };
     return protocols;
 }
 
@@ -689,8 +694,7 @@ static gboolean webKitWebSrcSetUri(GstURIHandler* handler, const gchar* uri, GEr
         return TRUE;
 
     URL url(URL(), uri);
-
-    if (!url.isValid() || !url.protocolIsInHTTPFamily()) {
+    if (!urlHasSupportedProtocol(url)) {
         g_set_error(error, GST_URI_ERROR, GST_URI_ERROR_BAD_URI, "Invalid URI '%s'", uri);
         return FALSE;
     }
@@ -707,7 +711,7 @@ static GstURIType webKitWebSrcUriGetType(void)
 
 static gchar** webKitWebSrcGetProtocols(void)
 {
-    static gchar* protocols[] = {(gchar*) "http", (gchar*) "https", 0 };
+    static gchar* protocols[] = {(gchar*) "http", (gchar*) "https", (gchar*) "blob", 0 };
     return protocols;
 }
 
@@ -740,8 +744,7 @@ static gboolean webKitWebSrcSetUri(GstURIHandler* handler, const gchar* uri)
         return TRUE;
 
     URL url(URL(), uri);
-
-    if (!url.isValid() || !url.protocolIsInHTTPFamily()) {
+    if (!urlHasSupportedProtocol(url)) {
         GST_ERROR_OBJECT(src, "Invalid URI '%s'", uri);
         return FALSE;
     }
@@ -1080,7 +1083,8 @@ void StreamingClient::handleNotifyFinished()
 CachedResourceStreamingClient::CachedResourceStreamingClient(WebKitWebSrc* src, CachedResourceLoader* resourceLoader, const ResourceRequest& request)
     : StreamingClient(src)
 {
-    CachedResourceRequest cacheRequest(request, ResourceLoaderOptions(SendCallbacks, DoNotSniffContent, DoNotBufferData, DoNotAllowStoredCredentials, DoNotAskClientForCrossOriginCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType));
+    DataBufferingPolicy bufferingPolicy = request.url().protocolIs("blob") ? BufferData : DoNotBufferData;
+    CachedResourceRequest cacheRequest(request, ResourceLoaderOptions(SendCallbacks, DoNotSniffContent, bufferingPolicy, DoNotAllowStoredCredentials, DoNotAskClientForCrossOriginCredentials, DoSecurityCheck, UseDefaultOriginRestrictionsForType));
     m_resource = resourceLoader->requestRawResource(cacheRequest);
     if (m_resource)
         m_resource->addClient(this);