- Revision
- 116960
- Author
- [email protected]
- Date
- 2012-05-14 10:17:40 -0700 (Mon, 14 May 2012)
Log Message
<video> won't load when URL ends with .php
https://bugs.webkit.org/show_bug.cgi?id=86308
Source/WebCore:
Reviewed by NOBODY (OOPS!).
Test: http/tests/media/video-query-url.html
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::MediaPlayer): Initialize m_typeInferredFromExtension.
(WebCore::MediaPlayer::load): Set m_typeInferredFromExtension appropriately.
(WebCore::MediaPlayer::loadWithNextMediaEngine): If we don't find a media engine registered
for a MIME type, and the type was inferred from the extension, give the first registered
media engine a chance anwyay just as we do when there is no MIME type at all.
* platform/graphics/MediaPlayer.h: Add m_typeInferredFromExtension.
LayoutTests:
Reviewed by Darin Adler.
* http/tests/media/resources/load-video.php: Added.
* http/tests/media/video-query-url-expected.txt: Added.
* http/tests/media/video-query-url.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (116959 => 116960)
--- trunk/LayoutTests/ChangeLog 2012-05-14 17:12:11 UTC (rev 116959)
+++ trunk/LayoutTests/ChangeLog 2012-05-14 17:17:40 UTC (rev 116960)
@@ -1,3 +1,14 @@
+2012-05-14 Eric Carlson <[email protected]>
+
+ <video> won't load when URL ends with .php
+ https://bugs.webkit.org/show_bug.cgi?id=86308
+
+ Reviewed by Darin Adler.
+
+ * http/tests/media/resources/load-video.php: Added.
+ * http/tests/media/video-query-url-expected.txt: Added.
+ * http/tests/media/video-query-url.html: Added.
+
2012-05-14 Andrey Kosyakov <[email protected]>
Web Inspector: [Extensions API] allow extensions to evaluate in the context of their content scripts
Added: trunk/LayoutTests/http/tests/media/resources/load-video.php (0 => 116960)
--- trunk/LayoutTests/http/tests/media/resources/load-video.php (rev 0)
+++ trunk/LayoutTests/http/tests/media/resources/load-video.php 2012-05-14 17:17:40 UTC (rev 116960)
@@ -0,0 +1,11 @@
+<?php
+
+ $fileName = $_GET["name"];
+ $type = $_GET["type"];
+
+ $_GET = array();
+ $_GET['name'] = $fileName;
+ $_GET['type'] = $type;
+ @include("./serve-video.php");
+
+?>
Added: trunk/LayoutTests/http/tests/media/video-query-url-expected.txt (0 => 116960)
--- trunk/LayoutTests/http/tests/media/video-query-url-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/media/video-query-url-expected.txt 2012-05-14 17:17:40 UTC (rev 116960)
@@ -0,0 +1,5 @@
+
+Tests that WebKit is able to open a media file specified with a query url.
+EVENT(canplay)
+END OF TEST
+
Added: trunk/LayoutTests/http/tests/media/video-query-url.html (0 => 116960)
--- trunk/LayoutTests/http/tests/media/video-query-url.html (rev 0)
+++ trunk/LayoutTests/http/tests/media/video-query-url.html 2012-05-14 17:17:40 UTC (rev 116960)
@@ -0,0 +1,34 @@
+<html>
+ <head>
+ <script src=""
+ <script src=""
+ <script>
+ function loadMediaFrame()
+ {
+ findMediaElement();
+
+ var movie = findMediaFile('video', 'test');
+ var type = mimeTypeForExtension(movie.split('.').pop());
+ var frame = document.createElement('iframe');
+
+ frame.width = 0;
+ frame.height = 0;
+ frame.addEventListener('load', function () {
+ video.src = '' + movie + '&type=' + type;
+
+ waitForEventAndFail('error');
+ waitForEventAndEnd('canplay');
+ });
+
+ frame.src = ""
+ document.body.appendChild(frame);
+ }
+ </script>
+ </head>
+
+ <body _onload_="loadMediaFrame()">
+ <video controls></video>
+ <br>
+ Tests that WebKit is able to open a media file specified with a query url.
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (116959 => 116960)
--- trunk/Source/WebCore/ChangeLog 2012-05-14 17:12:11 UTC (rev 116959)
+++ trunk/Source/WebCore/ChangeLog 2012-05-14 17:17:40 UTC (rev 116960)
@@ -1,3 +1,20 @@
+2012-05-14 Eric Carlson <[email protected]>
+
+ <video> won't load when URL ends with .php
+ https://bugs.webkit.org/show_bug.cgi?id=86308
+
+ Reviewed by Darin Adler.
+
+ Test: http/tests/media/video-query-url.html
+
+ * platform/graphics/MediaPlayer.cpp:
+ (WebCore::MediaPlayer::MediaPlayer): Initialize m_typeInferredFromExtension.
+ (WebCore::MediaPlayer::load): Set m_typeInferredFromExtension appropriately.
+ (WebCore::MediaPlayer::loadWithNextMediaEngine): If we don't find a media engine registered
+ for a MIME type, and the type was inferred from the extension, give the first registered
+ media engine a chance anwyay just as we do when there is no MIME type at all.
+ * platform/graphics/MediaPlayer.h: Add m_typeInferredFromExtension.
+
2012-05-14 Ilya Tikhonovsky <[email protected]>
Web Inspector: do not update $0-$4 console variables for the objects from loaded from file heap snapshot.
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (116959 => 116960)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2012-05-14 17:12:11 UTC (rev 116959)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2012-05-14 17:17:40 UTC (rev 116960)
@@ -325,6 +325,7 @@
, m_preservesPitch(true)
, m_privateBrowsing(false)
, m_shouldPrepareToRender(false)
+ , m_contentMIMETypeWasInferredFromExtension(false)
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
, m_playerProxy(0)
#endif
@@ -347,44 +348,45 @@
bool MediaPlayer::load(const KURL& url, const ContentType& contentType, const String& keySystem)
{
- String type = contentType.type().lower();
- String typeCodecs = contentType.parameter(codecs());
- String urlString = url.string();
+ m_contentMIMEType = contentType.type().lower();
+ m_contentTypeCodecs = contentType.parameter(codecs());
+ m_url = url.string();
+ m_keySystem = keySystem.lower();
+ m_contentMIMETypeWasInferredFromExtension = false;
// If the MIME type is missing or is not meaningful, try to figure it out from the URL.
- if (type.isEmpty() || type == applicationOctetStream() || type == textPlain()) {
- if (protocolIs(urlString, "data"))
- type = mimeTypeFromDataURL(urlString);
+ if (m_contentMIMEType.isEmpty() || m_contentMIMEType == applicationOctetStream() || m_contentMIMEType == textPlain()) {
+ if (protocolIs(m_url, "data"))
+ m_contentMIMEType = mimeTypeFromDataURL(m_url);
else {
String lastPathComponent = url.lastPathComponent();
size_t pos = lastPathComponent.reverseFind('.');
if (pos != notFound) {
String extension = lastPathComponent.substring(pos + 1);
String mediaType = MIMETypeRegistry::getMediaMIMETypeForExtension(extension);
- if (!mediaType.isEmpty())
- type = mediaType;
+ if (!mediaType.isEmpty()) {
+ m_contentMIMEType = mediaType;
+ m_contentMIMETypeWasInferredFromExtension = true;
+ }
}
}
}
- m_url = urlString;
- m_contentMIMEType = type;
- m_contentTypeCodecs = typeCodecs;
- m_keySystem = keySystem.lower();
loadWithNextMediaEngine(0);
return m_currentMediaEngine;
}
void MediaPlayer::loadWithNextMediaEngine(MediaPlayerFactory* current)
{
- MediaPlayerFactory* engine;
+ MediaPlayerFactory* engine = 0;
- // If no MIME type is specified, just use the next engine.
- if (m_contentMIMEType.isEmpty())
- engine = nextMediaEngine(current);
- else
+ if (!m_contentMIMEType.isEmpty())
engine = bestMediaEngineForTypeAndCodecs(m_contentMIMEType, m_contentTypeCodecs, m_keySystem, current);
+ // If no MIME type is specified or the type was inferred from the file extension, just use the next engine.
+ if (!engine && (m_contentMIMEType.isEmpty() || m_contentMIMETypeWasInferredFromExtension))
+ engine = nextMediaEngine(current);
+
// Don't delete and recreate the player unless it comes from a different engine.
if (!engine) {
LOG(Media, "MediaPlayer::loadWithNextMediaEngine - no media engine found for type \"%s\"", m_contentMIMEType.utf8().data());
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (116959 => 116960)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2012-05-14 17:12:11 UTC (rev 116959)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2012-05-14 17:17:40 UTC (rev 116960)
@@ -399,6 +399,7 @@
bool m_preservesPitch;
bool m_privateBrowsing;
bool m_shouldPrepareToRender;
+ bool m_contentMIMETypeWasInferredFromExtension;
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
WebMediaPlayerProxy* m_playerProxy; // not owned or used, passed to m_private
#endif