2011-04-07 Nancy Piedra <nancy.piedra@nokia.com>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Apr 2011 18:46:23 +0000 (18:46 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Apr 2011 18:46:23 +0000 (18:46 +0000)
        Reviewed by Eric Carlson.

        Add tests for parsing codecs parameter in video-can-play-type.html
        https://bugs.webkit.org/show_bug.cgi?id=53275

        * media/video-can-play-type-expected.txt:
        * media/video-can-play-type.html:
2011-04-07  Nancy Piedra  <nancy.piedra@nokia.com>

        Reviewed by Eric Carlson.

        Parse quotes from content type parameters
        https://bugs.webkit.org/show_bug.cgi?id=53275

        This functionality is tested in video-can-play-type.html layout test
        where I've added codecs parameter with good and bad formatting.

        * platform/ContentType.cpp:
        (WebCore::ContentType::parameter):

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

LayoutTests/ChangeLog
LayoutTests/media/video-can-play-type-expected.txt
LayoutTests/media/video-can-play-type.html
Source/WebCore/ChangeLog
Source/WebCore/platform/ContentType.cpp

index 23f9100..9acd82a 100644 (file)
@@ -1,3 +1,13 @@
+2011-04-07  Nancy Piedra  <nancy.piedra@nokia.com>
+
+        Reviewed by Eric Carlson.
+
+        Add tests for parsing codecs parameter in video-can-play-type.html
+        https://bugs.webkit.org/show_bug.cgi?id=53275
+
+        * media/video-can-play-type-expected.txt:
+        * media/video-can-play-type.html:
+
 2011-04-07  Jessie Berlin  <jberlin@apple.com>
 
         [WebKit2 Tests] fast/events/select-element.html failing since introduction in r83096
index 60df4ac..eab2b7d 100644 (file)
@@ -7,5 +7,10 @@ EXPECTED (video.canPlayType('video/mpeg; Codecs="avc1.4D400C"') == 'probably') O
 EXPECTED (video.canPlayType(' Video/MP4 ; CODECS="mp4v.20.8, mp4a.40.2"') == 'probably') OK
 EXPECTED (video.canPlayType('audio/mpeg') == 'maybe') OK
 EXPECTED (video.canPlayType('audio/Wav') == 'maybe') OK
+EXPECTED (video.canPlayType('video/blahblah; codecs=blah') == '') OK
+EXPECTED (video.canPlayType('video/blahblah; codecs="blah"') == '') OK
+EXPECTED (video.canPlayType('video/blahblah; codecs="badcontent') == '') OK
+EXPECTED (video.canPlayType('video/blahblah; codecs=badcontent"') == '') OK
+EXPECTED (video.canPlayType('video/blahblah; codecs="badcontent"') == '') OK
 END OF TEST
 
index 03b3640..fe75445 100644 (file)
             testExpected("video.canPlayType('        Video/MP4 ; CODECS=\"mp4v.20.8, mp4a.40.2\"')", "probably");
             testExpected("video.canPlayType('audio/mpeg')", "maybe");
             testExpected("video.canPlayType('audio/Wav')", "maybe");
+            testExpected("video.canPlayType('video/blahblah; codecs=blah')", "");
+            testExpected("video.canPlayType('video/blahblah; codecs=\"blah\"')", "");
+            testExpected("video.canPlayType('video/blahblah; codecs=\"badcontent')", "");
+            testExpected("video.canPlayType('video/blahblah; codecs=badcontent\"')", "");
+            testExpected("video.canPlayType('video/blahblah; codecs=&quot;badcontent&quot;')", "");
 
             endTest();
         </script>
index 7a6d578..495ddb4 100644 (file)
@@ -1,3 +1,16 @@
+2011-04-07  Nancy Piedra  <nancy.piedra@nokia.com>
+
+        Reviewed by Eric Carlson.
+
+        Parse quotes from content type parameters
+        https://bugs.webkit.org/show_bug.cgi?id=53275
+
+        This functionality is tested in video-can-play-type.html layout test
+        where I've added codecs parameter with good and bad formatting.
+
+        * platform/ContentType.cpp:
+        (WebCore::ContentType::parameter):
+
 2011-04-07  Pavel Feldman  <pfeldman@google.com>
 
         Reviewed by Yury Semikhatsky.
index c094d54..b02bc7c 100644 (file)
@@ -45,11 +45,17 @@ String ContentType::parameter(const String& parameterName) const
     if (semi != notFound) {
         size_t start = strippedType.find(parameterName, semi + 1, false);
         if (start != notFound) {
-            start = strippedType.find('=', start + 6);
+            start = strippedType.find('=', start + parameterName.length());
             if (start != notFound) {
-                size_t end = strippedType.find(';', start + 6);
-                if (end == notFound)
-                    end = strippedType.length();
+                size_t quote = strippedType.find('\"', start + 1);
+                size_t end = strippedType.find('\"', start + 2);
+                if (quote != notFound && end != notFound)
+                    start = quote;
+                else {
+                    end = strippedType.find(';', start + 1);
+                    if (end == notFound)
+                        end = strippedType.length();
+                }
                 parameterValue = strippedType.substring(start + 1, end - (start + 1)).stripWhiteSpace();
             }
         }