[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

eric.carlson at apple.com eric.carlson at apple.com
Wed Dec 22 12:23:45 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit f59b68b2f97c3b58d193de958b8c9523b86af119
Author: eric.carlson at apple.com <eric.carlson at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Aug 20 22:19:39 2010 +0000

    2010-08-20  Eric Carlson  <eric.carlson at apple.com>
    
            Reviewed by Dan Bernstein.
    
            Media element canPlayType("application/octet-stream") not handled correctly
            https://bugs.webkit.org/show_bug.cgi?id=44343
    
            Test: media/media-can-play-octet-stream.html
    
            * platform/graphics/MediaPlayer.cpp:
            (WebCore::applicationOctetStream): New, accessor for static string used more than once.
            (WebCore::textPlain): Ditto.
            (WebCore::codecs): Ditto.
            (WebCore::chooseBestEngineForTypeAndCodecs): Special case "application/octet-stream".
            (WebCore::MediaPlayer::load): Use static static string methods.
            (WebCore::MediaPlayer::supportsType): Special case "application/octet-stream".
    
    2010-08-20  Eric Carlson  <eric.carlson at apple.com>
    
            Reviewed by Dan Bernstein.
    
            Media element canPlayType("application/octet-stream") not handled correctly
            https://bugs.webkit.org/show_bug.cgi?id=44343
    
            * media/media-can-play-octet-stream-expected.txt: Added.
            * media/media-can-play-octet-stream.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65758 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 4959d12..1bce5cf 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-08-20  Eric Carlson  <eric.carlson at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Media element canPlayType("application/octet-stream") not handled correctly
+        https://bugs.webkit.org/show_bug.cgi?id=44343
+
+        * media/media-can-play-octet-stream-expected.txt: Added.
+        * media/media-can-play-octet-stream.html: Added.
+
 2010-08-20  Ryosuke Niwa  <rniwa at webkit.org>
 
         Reviewed by Tony Chang.
diff --git a/LayoutTests/media/media-can-play-octet-stream-expected.txt b/LayoutTests/media/media-can-play-octet-stream-expected.txt
new file mode 100644
index 0000000..da68b21
--- /dev/null
+++ b/LayoutTests/media/media-can-play-octet-stream-expected.txt
@@ -0,0 +1,13 @@
+Test HTMLMediaElement canPlayType() method with "application/octet-stream".
+
+++ Test with <video> element.
+EXPECTED (mediaElement.canPlayType('application/octet-stream') == 'maybe') OK
+EXPECTED (mediaElement.canPlayType('application/octet-stream;codecs=theora') == '') OK
+EXPECTED (mediaElement.canPlayType('application/octet-stream;codecs=mp4') == '') OK
+
+++ Test with <audio> element.
+EXPECTED (mediaElement.canPlayType('application/octet-stream') == 'maybe') OK
+EXPECTED (mediaElement.canPlayType('application/octet-stream;codecs=theora') == '') OK
+EXPECTED (mediaElement.canPlayType('application/octet-stream;codecs=mp4') == '') OK
+END OF TEST
+
diff --git a/LayoutTests/media/media-can-play-octet-stream.html b/LayoutTests/media/media-can-play-octet-stream.html
new file mode 100644
index 0000000..6aad6a0
--- /dev/null
+++ b/LayoutTests/media/media-can-play-octet-stream.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+
+<html>
+    <head>
+        <style>
+            video { background-color: yellow; width: 320px; height: 240px;}
+        </style>
+        <script src=video-test.js></script>
+        <script>
+            function test()
+            {
+                testExpected("mediaElement.canPlayType('application/octet-stream')", "maybe");
+                testExpected("mediaElement.canPlayType('application/octet-stream;codecs=theora')", "");
+                testExpected("mediaElement.canPlayType('application/octet-stream;codecs=mp4')", "");
+             }
+
+            function start()
+            {
+                consoleWrite("<em>++ Test with &lt;video&gt; element.</em>");
+                mediaElement = document.getElementsByTagName('video')[0];
+                test();
+
+                consoleWrite("<br><em>++ Test with &lt;audio&gt; element.</em>");
+                mediaElement = new Audio();
+                test();
+
+                endTest();
+            }
+        </script>
+
+    </head>
+    <body onload="start()">
+
+        <video controls ></video>
+
+        <p>Test HTMLMediaElement <em>canPlayType()</em> method with "application/octet-stream".</p>
+
+    </body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e2f9b25..b9c7ed8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-08-20  Eric Carlson  <eric.carlson at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Media element canPlayType("application/octet-stream") not handled correctly
+        https://bugs.webkit.org/show_bug.cgi?id=44343
+
+        Test: media/media-can-play-octet-stream.html
+
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::applicationOctetStream): New, accessor for static string used more than once.
+        (WebCore::textPlain): Ditto.
+        (WebCore::codecs): Ditto.
+        (WebCore::chooseBestEngineForTypeAndCodecs): Special case "application/octet-stream".
+        (WebCore::MediaPlayer::load): Use static static string methods.
+        (WebCore::MediaPlayer::supportsType): Special case "application/octet-stream".
+
 2010-08-20  Adrienne Walker  <enne at google.com>
 
         Reviewed by Kenneth Russell.
diff --git a/WebCore/platform/graphics/MediaPlayer.cpp b/WebCore/platform/graphics/MediaPlayer.cpp
index fe45c0d..6f350ac 100644
--- a/WebCore/platform/graphics/MediaPlayer.cpp
+++ b/WebCore/platform/graphics/MediaPlayer.cpp
@@ -192,6 +192,24 @@ static void addMediaEngine(CreateMediaEnginePlayer constructor, MediaEngineSuppo
     installedMediaEngines().append(new MediaPlayerFactory(constructor, getSupportedTypes, supportsType));
 }
 
+static const AtomicString& applicationOctetStream()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, applicationOctetStream, ("application/octet-stream"));
+    return applicationOctetStream;
+}
+
+static const AtomicString& textPlain()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, textPlain, ("text/plain"));
+    return textPlain;
+}
+
+static const AtomicString& codecs()
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, codecs, ("codecs"));
+    return codecs;
+}
+
 static MediaPlayerFactory* chooseBestEngineForTypeAndCodecs(const String& type, const String& codecs)
 {
     Vector<MediaPlayerFactory*>& engines = installedMediaEngines();
@@ -199,6 +217,14 @@ static MediaPlayerFactory* chooseBestEngineForTypeAndCodecs(const String& type,
     if (engines.isEmpty())
         return 0;
 
+    // 4.8.10.3 MIME types - In the absence of a specification to the contrary, the MIME type "application/octet-stream" 
+    // when used with parameters, e.g. "application/octet-stream;codecs=theora", is a type that the user agent knows 
+    // it cannot render.
+    if (type == applicationOctetStream()) {
+        if (!codecs.isEmpty())
+            return 0;
+    }
+    
     MediaPlayerFactory* engine = 0;
     MediaPlayer::SupportsType supported = MediaPlayer::IsNotSupported;
 
@@ -248,10 +274,10 @@ MediaPlayer::~MediaPlayer()
 void MediaPlayer::load(const String& url, const ContentType& contentType)
 {
     String type = contentType.type();
-    String codecs = contentType.parameter("codecs");
+    String typeCodecs = contentType.parameter(codecs());
 
-    // if we don't know the MIME type, see if the extension can help
-    if (type.isEmpty() || type == "application/octet-stream" || type == "text/plain") {
+    // If the MIME type is unhelpful, see if the type registry has a match for the file extension.
+    if (type.isEmpty() || type == applicationOctetStream() || type == textPlain()) {
         size_t pos = url.reverseFind('.');
         if (pos != notFound) {
             String extension = url.substring(pos + 1);
@@ -263,7 +289,7 @@ void MediaPlayer::load(const String& url, const ContentType& contentType)
 
     MediaPlayerFactory* engine = 0;
     if (!type.isEmpty())
-        engine = chooseBestEngineForTypeAndCodecs(type, codecs);
+        engine = chooseBestEngineForTypeAndCodecs(type, typeCodecs);
 
     // if we didn't find an engine that claims the MIME type, just use the first engine
     if (!engine && !installedMediaEngines().isEmpty())
@@ -528,13 +554,26 @@ void MediaPlayer::paintCurrentFrameInContext(GraphicsContext* p, const IntRect&
 MediaPlayer::SupportsType MediaPlayer::supportsType(ContentType contentType)
 {
     String type = contentType.type();
-    String codecs = contentType.parameter("codecs");
-    MediaPlayerFactory* engine = chooseBestEngineForTypeAndCodecs(type, codecs);
+    String typeCodecs = contentType.parameter(codecs());
+
+    // 4.8.10.3 MIME types - In the absence of a specification to the contrary, the MIME type "application/octet-stream" 
+    // when used with parameters, e.g. "application/octet-stream;codecs=theora", is a type that the user agent knows 
+    // it cannot render.
+    if (type == applicationOctetStream()) {
+        if (!typeCodecs.isEmpty())
+            return IsNotSupported;
+        
+        // The MIME type "application/octet-stream" with no parameters is never a type that the user agent knows it 
+        // cannot render.
+        return MayBeSupported;
+    }
+
+    MediaPlayerFactory* engine = chooseBestEngineForTypeAndCodecs(type, typeCodecs);
 
     if (!engine)
         return IsNotSupported;
 
-    return engine->supportsTypeAndCodecs(type, codecs);
+    return engine->supportsTypeAndCodecs(type, typeCodecs);
 }
 
 void MediaPlayer::getSupportedTypes(HashSet<String>& types)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list