Title: [110754] trunk
- Revision
- 110754
- Author
- [email protected]
- Date
- 2012-03-14 14:34:23 -0700 (Wed, 14 Mar 2012)
Log Message
Opening a URL in a MediaDocument does not propagate MIME type info to media element
https://bugs.webkit.org/show_bug.cgi?id=81148
Reviewed by Eric Carlson.
Source/WebCore:
Test: http/tests/media/media-document.html
Pass through the mime type from the DocumentLoader into the <source type=""> attribute of the
generated video element.
* html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::createDocumentStructure):
LayoutTests:
* http/tests/media/media-document-expected.txt: Added.
* http/tests/media/media-document.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (110753 => 110754)
--- trunk/LayoutTests/ChangeLog 2012-03-14 21:27:48 UTC (rev 110753)
+++ trunk/LayoutTests/ChangeLog 2012-03-14 21:34:23 UTC (rev 110754)
@@ -1,3 +1,13 @@
+2012-03-14 Jer Noble <[email protected]>
+
+ Opening a URL in a MediaDocument does not propagate MIME type info to media element
+ https://bugs.webkit.org/show_bug.cgi?id=81148
+
+ Reviewed by Eric Carlson.
+
+ * http/tests/media/media-document-expected.txt: Added.
+ * http/tests/media/media-document.html: Added.
+
2012-03-14 David Grogan <[email protected]>
IndexedDB layout tests: factor out prefix-handling-code
Added: trunk/LayoutTests/http/tests/media/media-document-expected.txt (0 => 110754)
--- trunk/LayoutTests/http/tests/media/media-document-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-document-expected.txt 2012-03-14 21:34:23 UTC (rev 110754)
@@ -0,0 +1,6 @@
+
+Tests that a media document can open a media URL with an ambiguous extension.
+
+EXPECTED (frame.contentDocument.getElementsByTagName('video')[0].error == 'null') OK
+END OF TEST
+
Added: trunk/LayoutTests/http/tests/media/media-document.html (0 => 110754)
--- trunk/LayoutTests/http/tests/media/media-document.html (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-document.html 2012-03-14 21:34:23 UTC (rev 110754)
@@ -0,0 +1,29 @@
+<html>
+ <head>
+ <script src=""
+ <script src=""
+ <script>
+ var frame;
+ function loadMediaFrame()
+ {
+ var movie = findMediaFile('video', 'test');
+ var type = mimeTypeForExtension(movie.split('.').pop());
+ frame = document.createElement('iframe');
+ frame.addEventListener('load', function () {
+ testExpected("frame.contentDocument.getElementsByTagName('video')[0].error", null);
+ endTest();
+ });
+ waitForEventAndFail('error');
+ waitForEventAndEnd('canplay');
+ frame.src = '' + movie + '&type=' + type;
+ document.body.appendChild(frame);
+ }
+ </script>
+ </head>
+
+ <body _onload_="loadMediaFrame()">
+ <br>
+ Tests that a media document can open a media URL with an ambiguous extension.
+ <br>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (110753 => 110754)
--- trunk/Source/WebCore/ChangeLog 2012-03-14 21:27:48 UTC (rev 110753)
+++ trunk/Source/WebCore/ChangeLog 2012-03-14 21:34:23 UTC (rev 110754)
@@ -1,3 +1,18 @@
+2012-03-14 Jer Noble <[email protected]>
+
+ Opening a URL in a MediaDocument does not propagate MIME type info to media element
+ https://bugs.webkit.org/show_bug.cgi?id=81148
+
+ Reviewed by Eric Carlson.
+
+ Test: http/tests/media/media-document.html
+
+ Pass through the mime type from the DocumentLoader into the <source type=""> attribute of the
+ generated video element.
+
+ * html/MediaDocument.cpp:
+ (WebCore::MediaDocumentParser::createDocumentStructure):
+
2012-03-14 Stephen White <[email protected]>
[chromium] Fix accelerated Canvas2D with threaded compositing.
Modified: trunk/Source/WebCore/html/MediaDocument.cpp (110753 => 110754)
--- trunk/Source/WebCore/html/MediaDocument.cpp 2012-03-14 21:27:48 UTC (rev 110753)
+++ trunk/Source/WebCore/html/MediaDocument.cpp 2012-03-14 21:34:23 UTC (rev 110754)
@@ -35,6 +35,7 @@
#include "HTMLEmbedElement.h"
#include "HTMLHtmlElement.h"
#include "HTMLNames.h"
+#include "HTMLSourceElement.h"
#include "HTMLVideoElement.h"
#include "KeyboardEvent.h"
#include "MainResourceLoader.h"
@@ -89,8 +90,15 @@
m_mediaElement->setAttribute(autoplayAttr, "");
m_mediaElement->setAttribute(nameAttr, "media");
- m_mediaElement->setSrc(document()->url());
-
+
+ RefPtr<Element> sourceElement = document()->createElement(sourceTag, false);
+ HTMLSourceElement* source = static_cast<HTMLSourceElement*>(sourceElement.get());
+ source->setSrc(document()->url());
+
+ if (DocumentLoader* loader = document()->loader())
+ source->setType(loader->responseMIMEType());
+
+ m_mediaElement->appendChild(sourceElement, ec);
body->appendChild(mediaElement, ec);
Frame* frame = document()->frame();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes