Diff
Copied: branches/chromium/1132/LayoutTests/http/tests/security/resources/video-cross-origin-allow.php (from rev 119742, trunk/LayoutTests/http/tests/security/resources/video-cross-origin-allow.php) (0 => 119995)
--- branches/chromium/1132/LayoutTests/http/tests/security/resources/video-cross-origin-allow.php (rev 0)
+++ branches/chromium/1132/LayoutTests/http/tests/security/resources/video-cross-origin-allow.php 2012-06-11 18:37:19 UTC (rev 119995)
@@ -0,0 +1,13 @@
+<?php
+
+header("Access-Control-Allow-Origin: *");
+
+if ($_SERVER['REQUEST_METHOD'] == "OPTIONS") {
+ header("Access-Control-Allow-Methods: GET");
+ header("Access-Control-Allow-Headers: origin, accept-encoding, referer, range");
+ exit;
+}
+
+@include("../../media/resources/serve-video.php");
+
+?>
\ No newline at end of file
Copied: branches/chromium/1132/LayoutTests/http/tests/security/video-cross-origin-readback-expected.txt (from rev 119742, trunk/LayoutTests/http/tests/security/video-cross-origin-readback-expected.txt) (0 => 119995)
--- branches/chromium/1132/LayoutTests/http/tests/security/video-cross-origin-readback-expected.txt (rev 0)
+++ branches/chromium/1132/LayoutTests/http/tests/security/video-cross-origin-readback-expected.txt 2012-06-11 18:37:19 UTC (rev 119995)
@@ -0,0 +1,3 @@
+EVENT(playing)
+END OF TEST
+
Copied: branches/chromium/1132/LayoutTests/http/tests/security/video-cross-origin-readback.html (from rev 119742, trunk/LayoutTests/http/tests/security/video-cross-origin-readback.html) (0 => 119995)
--- branches/chromium/1132/LayoutTests/http/tests/security/video-cross-origin-readback.html (rev 0)
+++ branches/chromium/1132/LayoutTests/http/tests/security/video-cross-origin-readback.html 2012-06-11 18:37:19 UTC (rev 119995)
@@ -0,0 +1,33 @@
+<html>
+ <body _onload_="start()">
+ <script src=""
+ <script src=""
+ <script>
+ waitForEvent('error', function() {
+ failTest("error: " + JSON.stringify(video.error));
+ });
+
+ waitForEvent('playing', function() {
+ try {
+ var ctx = document.getElementsByTagName('canvas')[0].getContext("2d");
+ ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
+ ctx.getImageData(0, 0, video.videoWidth, video.videoHeight);
+ } catch (e) {
+ failTest("Caught error: " + e);
+ }
+ endTest();
+ });
+
+ function start() {
+ findMediaElement();
+ var mediaFile = findMediaFile("video", "../../media/resources/test");
+ var type = mimeTypeForExtension(mediaFile.split('.').pop());
+ video.src = "" + mediaFile + "&type=" + type;
+ video.play();
+ }
+ </script>
+
+ <video crossorigin></video>
+ <canvas></canvas>
+ </body>
+</head>
Modified: branches/chromium/1132/LayoutTests/platform/efl/Skipped (119994 => 119995)
--- branches/chromium/1132/LayoutTests/platform/efl/Skipped 2012-06-11 18:36:12 UTC (rev 119994)
+++ branches/chromium/1132/LayoutTests/platform/efl/Skipped 2012-06-11 18:37:19 UTC (rev 119995)
@@ -670,6 +670,9 @@
fast/images/exif-orientation.html
fast/images/exif-orientation-css.html
+# No CORS support for media elements is implemented yet.
+http/tests/security/video-cross-origin-readback.html
+
# --------------------------------
# Tests which are expected to fail
# --------------------------------
Modified: branches/chromium/1132/LayoutTests/platform/mac/Skipped (119994 => 119995)
--- branches/chromium/1132/LayoutTests/platform/mac/Skipped 2012-06-11 18:36:12 UTC (rev 119994)
+++ branches/chromium/1132/LayoutTests/platform/mac/Skipped 2012-06-11 18:37:19 UTC (rev 119995)
@@ -811,6 +811,9 @@
fast/sub-pixel/layout-boxes-with-zoom.html
fast/sub-pixel/size-of-box-with-zoom.html
+# No CORS support for media elements is implemented yet.
+http/tests/security/video-cross-origin-readback.html
+
# media/audio-repaint.html sometimes fails on Lion Debug (Tests)
# https://bugs.webkit.org/show_bug.cgi?id=84357
media/audio-repaint.html
Modified: branches/chromium/1132/LayoutTests/platform/qt/Skipped (119994 => 119995)
--- branches/chromium/1132/LayoutTests/platform/qt/Skipped 2012-06-11 18:36:12 UTC (rev 119994)
+++ branches/chromium/1132/LayoutTests/platform/qt/Skipped 2012-06-11 18:37:19 UTC (rev 119995)
@@ -417,6 +417,9 @@
fast/images/exif-orientation.html
fast/images/exif-orientation-css.html
+# No CORS support for media elements is implemented yet.
+http/tests/security/video-cross-origin-readback.html
+
# =========================================================================== #
# Drag and Drop Support in DRT. #
# =========================================================================== #
Modified: branches/chromium/1132/LayoutTests/platform/win/Skipped (119994 => 119995)
--- branches/chromium/1132/LayoutTests/platform/win/Skipped 2012-06-11 18:36:12 UTC (rev 119994)
+++ branches/chromium/1132/LayoutTests/platform/win/Skipped 2012-06-11 18:37:19 UTC (rev 119995)
@@ -1730,5 +1730,8 @@
fast/sub-pixel/layout-boxes-with-zoom.html
fast/sub-pixel/size-of-box-with-zoom.html
+# No CORS support for media elements is implemented yet.
+http/tests/security/video-cross-origin-readback.html
+
# http://webkit.org/b/82886
inspector/styles/override-screen-size.html
Modified: branches/chromium/1132/LayoutTests/platform/wk2/Skipped (119994 => 119995)
--- branches/chromium/1132/LayoutTests/platform/wk2/Skipped 2012-06-11 18:36:12 UTC (rev 119994)
+++ branches/chromium/1132/LayoutTests/platform/wk2/Skipped 2012-06-11 18:37:19 UTC (rev 119995)
@@ -1124,6 +1124,9 @@
fast/block/lineboxcontain/block-glyphs.html
fast/block/lineboxcontain/font.html
+# No CORS support for media elements is implemented yet.
+http/tests/security/video-cross-origin-readback.html
+
### END OF (2) Classified failures without bug reports (yet)
########################################
Modified: branches/chromium/1132/Source/WebCore/html/HTMLMediaElement.cpp (119994 => 119995)
--- branches/chromium/1132/Source/WebCore/html/HTMLMediaElement.cpp 2012-06-11 18:36:12 UTC (rev 119994)
+++ branches/chromium/1132/Source/WebCore/html/HTMLMediaElement.cpp 2012-06-11 18:37:19 UTC (rev 119995)
@@ -4385,6 +4385,15 @@
}
+MediaPlayerClient::CORSMode HTMLMediaElement::mediaPlayerCORSMode() const
+{
+ if (!fastHasAttribute(HTMLNames::crossoriginAttr))
+ return Unspecified;
+ if (equalIgnoringCase(fastGetAttribute(HTMLNames::crossoriginAttr), "use-credentials"))
+ return UseCredentials;
+ return Anonymous;
+}
+
void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture()
{
m_restrictions = NoRestrictions;
Modified: branches/chromium/1132/Source/WebCore/html/HTMLMediaElement.h (119994 => 119995)
--- branches/chromium/1132/Source/WebCore/html/HTMLMediaElement.h 2012-06-11 18:36:12 UTC (rev 119994)
+++ branches/chromium/1132/Source/WebCore/html/HTMLMediaElement.h 2012-06-11 18:37:19 UTC (rev 119995)
@@ -421,6 +421,7 @@
virtual String mediaPlayerReferrer() const OVERRIDE;
virtual String mediaPlayerUserAgent() const OVERRIDE;
+ virtual CORSMode mediaPlayerCORSMode() const OVERRIDE;
void loadTimerFired(Timer<HTMLMediaElement>*);
void progressEventTimerFired(Timer<HTMLMediaElement>*);
Modified: branches/chromium/1132/Source/WebCore/html/canvas/CanvasRenderingContext.cpp (119994 => 119995)
--- branches/chromium/1132/Source/WebCore/html/canvas/CanvasRenderingContext.cpp 2012-06-11 18:36:12 UTC (rev 119994)
+++ branches/chromium/1132/Source/WebCore/html/canvas/CanvasRenderingContext.cpp 2012-06-11 18:37:19 UTC (rev 119995)
@@ -77,11 +77,12 @@
if (!video || !canvas()->originClean())
return false;
- if (wouldTaintOrigin(video->currentSrc()))
+ if (!video->hasSingleSecurityOrigin())
return true;
- if (!video->hasSingleSecurityOrigin())
+ if (!(video->player() && video->player()->didPassCORSAccessCheck()) && wouldTaintOrigin(video->currentSrc()))
return true;
+
#else
UNUSED_PARAM(video);
#endif
Modified: branches/chromium/1132/Source/WebCore/platform/graphics/MediaPlayer.cpp (119994 => 119995)
--- branches/chromium/1132/Source/WebCore/platform/graphics/MediaPlayer.cpp 2012-06-11 18:36:12 UTC (rev 119994)
+++ branches/chromium/1132/Source/WebCore/platform/graphics/MediaPlayer.cpp 2012-06-11 18:37:19 UTC (rev 119995)
@@ -798,6 +798,11 @@
return m_private->hasSingleSecurityOrigin();
}
+bool MediaPlayer::didPassCORSAccessCheck() const
+{
+ return m_private->didPassCORSAccessCheck();
+}
+
MediaPlayer::MovieLoadType MediaPlayer::movieLoadType() const
{
return m_private->movieLoadType();
Modified: branches/chromium/1132/Source/WebCore/platform/graphics/MediaPlayer.h (119994 => 119995)
--- branches/chromium/1132/Source/WebCore/platform/graphics/MediaPlayer.h 2012-06-11 18:36:12 UTC (rev 119994)
+++ branches/chromium/1132/Source/WebCore/platform/graphics/MediaPlayer.h 2012-06-11 18:37:19 UTC (rev 119995)
@@ -101,6 +101,8 @@
class MediaPlayerClient {
public:
+ enum CORSMode { Unspecified, Anonymous, UseCredentials };
+
virtual ~MediaPlayerClient() { }
// Get the document which the media player is owned by
@@ -178,6 +180,7 @@
virtual String mediaPlayerReferrer() const { return String(); }
virtual String mediaPlayerUserAgent() const { return String(); }
+ virtual CORSMode mediaPlayerCORSMode() const { return Unspecified; }
};
class MediaPlayer {
@@ -340,6 +343,8 @@
bool hasSingleSecurityOrigin() const;
+ bool didPassCORSAccessCheck() const;
+
float mediaTimeForTimeValue(float) const;
double maximumDurationToCacheMediaTime() const;
Modified: branches/chromium/1132/Source/WebCore/platform/graphics/MediaPlayerPrivate.h (119994 => 119995)
--- branches/chromium/1132/Source/WebCore/platform/graphics/MediaPlayerPrivate.h 2012-06-11 18:36:12 UTC (rev 119994)
+++ branches/chromium/1132/Source/WebCore/platform/graphics/MediaPlayerPrivate.h 2012-06-11 18:37:19 UTC (rev 119995)
@@ -131,6 +131,8 @@
virtual bool hasSingleSecurityOrigin() const { return false; }
+ virtual bool didPassCORSAccessCheck() const { return false; }
+
virtual MediaPlayer::MovieLoadType movieLoadType() const { return MediaPlayer::Unknown; }
virtual void prepareForRendering() { }
Modified: branches/chromium/1132/Source/WebKit/chromium/public/WebMediaPlayer.h (119994 => 119995)
--- branches/chromium/1132/Source/WebKit/chromium/public/WebMediaPlayer.h 2012-06-11 18:36:12 UTC (rev 119994)
+++ branches/chromium/1132/Source/WebKit/chromium/public/WebMediaPlayer.h 2012-06-11 18:37:19 UTC (rev 119995)
@@ -108,7 +108,7 @@
virtual ~WebMediaPlayer() {}
- virtual void load(const WebURL&) = 0;
+ virtual void load(const WebURL&, CORSMode) = 0;
virtual void cancelLoad() = 0;
// Playback controls.
@@ -154,6 +154,7 @@
virtual unsigned long long totalBytes() const = 0;
virtual bool hasSingleSecurityOrigin() const = 0;
+ virtual bool didPassCORSAccessCheck() const = 0;
virtual MovieLoadType movieLoadType() const = 0;
virtual float mediaTimeForTimeValue(float timeValue) const = 0;
Modified: branches/chromium/1132/Source/WebKit/chromium/src/AssertMatchingEnums.cpp (119994 => 119995)
--- branches/chromium/1132/Source/WebKit/chromium/src/AssertMatchingEnums.cpp 2012-06-11 18:36:12 UTC (rev 119994)
+++ branches/chromium/1132/Source/WebKit/chromium/src/AssertMatchingEnums.cpp 2012-06-11 18:37:19 UTC (rev 119995)
@@ -568,3 +568,8 @@
COMPILE_ASSERT_MATCHING_ENUM(WebContentSecurityPolicyTypeReportOnly, ContentSecurityPolicy::ReportOnly);
COMPILE_ASSERT_MATCHING_ENUM(WebContentSecurityPolicyTypeEnforcePolicy, ContentSecurityPolicy::EnforcePolicy);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::CORSModeUnspecified, MediaPlayerClient::Unspecified);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::CORSModeAnonymous, MediaPlayerClient::Anonymous);
+COMPILE_ASSERT_MATCHING_ENUM(WebMediaPlayer::CORSModeUseCredentials, MediaPlayerClient::UseCredentials);
+
Modified: branches/chromium/1132/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp (119994 => 119995)
--- branches/chromium/1132/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp 2012-06-11 18:36:12 UTC (rev 119994)
+++ branches/chromium/1132/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp 2012-06-11 18:37:19 UTC (rev 119995)
@@ -301,7 +301,9 @@
// Make sure if we create/re-create the WebMediaPlayer that we update our wrapper.
m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider());
#endif
- m_webMediaPlayer->load(KURL(ParsedURLString, m_url));
+ m_webMediaPlayer->load(
+ KURL(ParsedURLString, m_url),
+ static_cast<WebMediaPlayer::CORSMode>(m_mediaPlayer->mediaPlayerClient()->mediaPlayerCORSMode()));
}
}
@@ -623,6 +625,13 @@
return false;
}
+bool WebMediaPlayerClientImpl::didPassCORSAccessCheck() const
+{
+ if (m_webMediaPlayer)
+ return m_webMediaPlayer->didPassCORSAccessCheck();
+ return false;
+}
+
MediaPlayer::MovieLoadType WebMediaPlayerClientImpl::movieLoadType() const
{
if (m_webMediaPlayer)
Modified: branches/chromium/1132/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h (119994 => 119995)
--- branches/chromium/1132/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h 2012-06-11 18:36:12 UTC (rev 119994)
+++ branches/chromium/1132/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h 2012-06-11 18:37:19 UTC (rev 119995)
@@ -128,6 +128,7 @@
virtual void paintCurrentFrameInContext(WebCore::GraphicsContext*, const WebCore::IntRect&);
virtual void setPreload(WebCore::MediaPlayer::Preload);
virtual bool hasSingleSecurityOrigin() const;
+ virtual bool didPassCORSAccessCheck() const;
virtual WebCore::MediaPlayer::MovieLoadType movieLoadType() const;
virtual float mediaTimeForTimeValue(float timeValue) const;
virtual unsigned decodedFrameCount() const;