From: commit-queue@webkit.org Date: Thu, 7 Apr 2011 18:46:23 +0000 (+0000) Subject: 2011-04-07 Nancy Piedra X-Git-Url: http://git.webkit.org/?p=WebKit-https.git;a=commitdiff_plain;h=c8a1ba3b5c43770be85637382366e07bb444f1af;ds=sidebyside 2011-04-07 Nancy Piedra 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 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 --- diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 23f9100..9acd82a 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,13 @@ +2011-04-07 Nancy Piedra + + 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 [WebKit2 Tests] fast/events/select-element.html failing since introduction in r83096 diff --git a/LayoutTests/media/video-can-play-type-expected.txt b/LayoutTests/media/video-can-play-type-expected.txt index 60df4ac..eab2b7d 100644 --- a/LayoutTests/media/video-can-play-type-expected.txt +++ b/LayoutTests/media/video-can-play-type-expected.txt @@ -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 diff --git a/LayoutTests/media/video-can-play-type.html b/LayoutTests/media/video-can-play-type.html index 03b3640..fe75445 100644 --- a/LayoutTests/media/video-can-play-type.html +++ b/LayoutTests/media/video-can-play-type.html @@ -22,6 +22,11 @@ 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="badcontent"')", ""); endTest(); diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 7a6d578..495ddb4 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,16 @@ +2011-04-07 Nancy Piedra + + 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 Reviewed by Yury Semikhatsky. diff --git a/Source/WebCore/platform/ContentType.cpp b/Source/WebCore/platform/ContentType.cpp index c094d54..b02bc7c 100644 --- a/Source/WebCore/platform/ContentType.cpp +++ b/Source/WebCore/platform/ContentType.cpp @@ -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(); } }